+ 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?

9th Oct 2018, 11:59 PM
Sonic
Sonic - avatar
9 Respuestas
+ 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.
10th Oct 2018, 5:20 AM
Janning⭐
Janning⭐ - avatar
+ 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.
11th Oct 2018, 8:17 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 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.
10th Oct 2018, 2:06 AM
Voxel
Voxel - avatar
+ 2
1 px means 1 pixel The smallest unit of your screen like a dot which can emit rgb lights.
11th Oct 2018, 4:48 AM
Ubaid Siddiqui
Ubaid Siddiqui - avatar
+ 1
good
10th Oct 2018, 11:01 AM
شوريا نجلاء
شوريا نجلاء - avatar
+ 1
Yes, and greetings from Central europe
18th Oct 2018, 1:44 AM
lawrence
lawrence - avatar
0
Of course no doubt about this
11th Oct 2018, 8:36 PM
Vishvesh Jain
Vishvesh Jain - avatar
- 1
yes
11th Oct 2018, 7:36 AM
Abdulhayev Muhammadrasul
Abdulhayev Muhammadrasul - avatar
- 1
ydgh
11th Oct 2018, 9:54 AM
علی هادیان
علی هادیان - avatar