This forum is now read-only. Please use our new forums! Go to forums
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
Answer 50bf2bf7b2f9872634003084
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.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
3 comments
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.
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
That is a real quality piece of explanation. Visually clear and technically spot on too.