+ 3

A question is sololearn HTML , it ask what is the measurements units can be used for width attributes , Its shows pixel and %

I use fraction and it worked just like <hr width ="567/10" /> . Are fraction and % considered same.

11th Jul 2017, 3:07 PM
Priyanshu kumar Chaudhary
Priyanshu kumar Chaudhary - avatar
5 odpowiedzi
+ 7
Here that [width="567/10"] is just the same as [width="576px"] so it's actually a "PX" unit. if you doubt it try [width="567+100"] and see that the width is just the same as before. ...since html cannot solve maths, it usually ignore it or set the value to default when it encounters one! got it?
11th Jul 2017, 3:29 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
% is percent in HTML (not modulo). For example, from the left of your window to the right of your window is 100% width of the window. Get what I mean? 50% would be half of the window. etc.. So if you wanted a horizontal rule that's only 50% of the size of the window, you would set the width to 50%. As well, you can base it upon pixel value, such as 100px. That would make it 100px long. So why use one over the other? Percent is more dynamic when it comes to changes, as 50% is different depending upon the size of what its referencing, whereas 100px is always 100px since it's a specific value. Imagine that I pull up the same website on my phone. If it's based upon percents, it can adjust itself to the size of my display. If I told it to always be 100px, even on my phone, it'll be 100px. Hope that helps.
11th Jul 2017, 3:16 PM
AgentSmith
+ 1
Sir netkos Ent I really thank you but I wanted to know if the fraction values like 567/10 I use are considered as % , Clearly I mean that are % and fraction sane measurements unit
11th Jul 2017, 3:16 PM
Priyanshu kumar Chaudhary
Priyanshu kumar Chaudhary - avatar
0
no they are values of x and y axis or which ever axis you are using
11th Jul 2017, 3:19 PM
‎ ‏‏‎Anonymous Guy
0
My apologies, just seeing your response. As the other guy mentioned, HTML doesn't calculate; it's just a markup language.
11th Jul 2017, 5:49 PM
AgentSmith