+ 19
Is HTML height/width attribute with number and no units always equivalent to the corresponding CSS property with px for pixels?
Or does this depend on the particular html element and attribute? E.g. the rule for image height/width is different from the rule for table height/width? Why can't html attributes always use a unit so that it is not ambiguous?
9 Antworten
+ 7
In addition to all the things Voxel said, I usually don't do height / width in px in the CSS, but will do it in HTML where required (for the whole "fallback" thing). The only thing I usually do in px in CSS is to set the initial font size -- the rest will generally be % or a relative unit. Just a way to keep things tidy.
+ 5
Your questions nice,but if you use CSS replace attribute HTML this best.
https://code.sololearn.com/WEO1gjrdXf1I/?ref=app
These are all Measurement Units CSS if you need,and in width and height HTML discuss the image.
HTML is support px an% just.
+ 3
Yep, those attributes are always in px, even percentages were deprecated. And height/width attributes for tables was also made obselete, so you need to use CSS instead anyway. Not sure why though, probably something to do with pushing HTML more towards semantics and leaving CSS to deal with that.
+ 2
1 px means 1 pixel
The smallest unit of your screen
like a dot which can emit rgb lights.
+ 1
good
+ 1
Yes, and greetings from Central europe
0
Of course no doubt about this
- 1
yes
- 1
ydgh