473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Understanding EM

I'm trying to get my head around the EM concept. By saying p
{font-size:1.0em;} am I, in effect, saying that paragraphs in this
document should use the browser's default font size or whatever they
set it to in the browser's preferences? For example, if the user set
the font size to 24 point text, specifying p {font-size:1.0em;} would
result in paragraph text displaying at 24 points, with H1 text being
relatively larger than 24 points?

-Fleemo

Nov 7 '05 #1
2 2921
<fl******@comcast.net> wrote:
I'm trying to get my head around the EM concept. By saying p
{font-size:1.0em;} am I, in effect, saying that paragraphs in this
document should use the browser's default font size or whatever they
set it to in the browser's preferences?
Technically, you're setting the font size of the paragraph to whatever the
font size of the paragraph's parent element is. Something could change the
font size of its parent element (e.g., BODY, DIV), and that would affect
the font size of the paragraph.

But in principle, you're setting the font size to whatever the font size is
set to in the browser's preferences. If the user hasn't changed the
browser's preferences, then this will be the browser's default font size.

Another caveat: MSIE has a bug with em units. You can work around this bug
by adding

body { font-size: 100% }

to your style sheet. Or you can work around this bug by avoiding em units
and using percentages for font-size instead.
For example, if the user set the font size to 24 point text, specifying
p {font-size:1.0em;} would result in paragraph text displaying at 24
points, with H1 text being relatively larger than 24 points?


Assuming that there's a rule like

h1 { font-size: 200% }

somewhere--in the document style sheet(s), user style sheet(s), or
user-agent style sheet(s)--then yes, the H1 elements would be displayed
relatively larger than the default font size (200% of 24pt = 48pt in this
example).
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"How long is this Beta guy going to keep testing our stuff?"
Nov 7 '05 #2
fl******@comcast.net wrote:
I'm trying to get my head around the EM concept. By saying p
{font-size:1.0em;} am I, in effect, saying that paragraphs in this
document should use the browser's default font size or whatever they
set it to in the browser's preferences?
That depends on inheritance, see
http://www.w3.org/TR/CSS21/cascade.html#inheritance
For example, if the user set
the font size to 24 point text, specifying p {font-size:1.0em;} would
result in paragraph text displaying at 24 points, with H1 text being
relatively larger than 24 points?


No, an <h1> isn't going to be a descendant element to a <p>, so
specifying a size for a <p> will have no effect on <h1>s. To suggest a
font size that inherits down to all elements you need to specify it on
the <body> element.

Btw, given certain browser bugs it is generally wiser use % for font
sizing.

--
Spartanicus
Nov 7 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
Hey guys, need some help understanding some things that maybe someone can explain or clarify it a little better then a text book. Here is my understanding so far: Class - basically a shell for...
7
by: laura | last post by:
I'm trying to understand fully Server.MapPath. I am writing an intranet for a small company and want to be able to put some files accessible to all, hyperlinked from the intranet and therefore,...
19
by: Pugi! | last post by:
Currently I am studying PHP. I can understand the following : $a = 10; $b = $a++; print("$a, $b"); will print 11, 10 on the screen. because when $b = $a++ first thing that happens is $b = $a...
26
by: Bail | last post by:
I will have a exam on the oncoming friday, my professor told us that it will base upon this program. i am having troubles understanding this program, for example what if i want to add all the...
11
by: Leon | last post by:
Are dataset automatically stored in memory? Does the dispose() method automatically dispose of the dataset in the code below? Do I have to dispose a dataset from memory or does the dataset...
18
by: Simon | last post by:
Hi, I understand what one the differences between std::vector, std::deque and std::list is, the std::vector can have data inserted/deleted at the end. The std::deque can have data...
4
by: joelagnel | last post by:
I'm new to .NET and have a basic understanding of operating systems. I can also do some magic in Csharp, but I lack an understanding of what's going on under the hood, with respect to how windows...
10
by: sasquatch | last post by:
X-No-Archive: Are there any good books that provide tips about how to understand and "play with" large C++ programs? It seems like a very important skill, and yet its hardly taught in the...
8
by: boki_pfc | last post by:
Hi Everybody, I am looking for an advice on following: I have that "pleasure" of reading C++ codes that have been written by person(s) that have not attended the same C++ classes that I did or...
2
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.