0
What two attributes can be use to resize image inside html code
6 Réponses
+ 1
height and width
+ 1
height and width, but it's recommanded to use css properties rather than element attributes (same name in this case)
+ 1
<img src="Image url" alt="alternative text" width="100%" <!-- Makes the image cover the web-width completely --> height="auto" <!-- keeps the image height to width ratio constant --> />
so we use height and width attribute to change the size of our inserted image.
width="100%" height="auto" is the best size.
You would be able to specify width and height with:
cm = centimeter
mm = millimeter
px = pixel
in = inch
Q = a quarter of millimeter
pc = pica
pt = point
cap = capital (letter) height
em = 16px
ex = 8px
ch = 10px
lh = line-height
ic = glyph in font
rem = root element
rlh = root element line-height
vw = viewport width
vh = viewport height
vb = initial containing block, in the direction of root element's block axis
vi = initial containing block, in the direction of root element's block axis
vmin = minimum viewport height and width
vmax = maximum vw and vh
Sorry that I can't explain them all
+ 1
height and with attribute must be filled with only number if you want to specify pixels, and with '%' ending for percentage of container size...
height and width css properties could have more units, and px should end the number if you want to specify pixels size...
0
Inside html code,
You can add inline style:
<img src = "Image URL address"
style = "height:160px; width:300px;"/>
With attribute:
<img src = "Image URL address"
height = "160px"
width = "300px"