This forum is now read-only. Please use our new forums at discuss.codecademy.com.

CSS: An Overview Forum

View Course » View Exercise

1614 points
4fb158a493057b0003001be5_262341435
Submitted by
Swinners Music
about 5 years ago

3.3 let me relate this to VB. via Hercule Poirot

I like this discussion on pixels and ems; but it has left me with many questions.
Lets consider a screen that is landscape and is 800 pixels across by 600 pixels down. This is known as the screen resolution? N'est pas?
If the screen is physically 160mm across by 120mm down, then one pixel will be 0.5mm by 0.5mm. The pixels are square because of the 4:3 aspect ratio. N'est pas?
If the font size is 20 pixels, then the font size will measure 10mm x 10mm N'est pas?
Q1 What size font will be 1em on this screen?
Q2 Does Visual Basic (VB) have a concept like

twips per pixel

to overcome this dilemma?
Q3 Does ems overcome this in HTML


3 votes

permalink

Actually, in French it's "n’est-ce* pas*?"

Actually, 160mm divided by 800 pixels is 0.2mm (not 0.5mm) per pixel – or, 5 pixels per millimeter. Thus, 20 pixels are physically 4mm on that screen.

I don't quite understand your question about the em – that is a relative size unit (1em is essentially the same as 100%, and 1.2em is 120% and so on), which depends entirely on the element's current font size. I recommend this CSS-Tricks article for some background info on font sizes.

3117 points
Picture
Submitted by
Alex J
about 5 years ago

3 Comments

4fb158a493057b0003001be5_262341435 Swinners Music about 5 years ago

tres bon, Alex. Thanks for pointing out my mathematical howler. I can understand the concept of percentage but when the font size is declared as 1em in the stylesheet, I have to ask again: what size is 1em. Thanks also for link which I am now going to read.

4fb158a493057b0003001be5_262341435 Swinners Music about 5 years ago

found the answer from the link thankssssss...........QUOTE
If you haven't set font size anywhere on the page, then it would be the browser default, which is probably 16px. So by default 1em = 16px. If you were to go and set a font-size of 20px on your body, then 1em = 20px.
ENDQUOTE

4fb158a493057b0003001be5_262341435 Swinners Music about 5 years ago

That is a real quality piece of explanation. Visually clear and technically spot on too.