473,543 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does 1em = 100% ?

If I have a style:

body
{
font-size: 1em;
}

Is that any different than:

body
{
font-size: 100%;
}

Regards,
Peter Foti
Jul 20 '05 #1
17 24673
Peter Foti wrote:
font-size: 1em;
Is that any different than:
font-size: 100%;


Technically they mean the same (just as 1m is the same as 100cm). In
practise, different browsers have different bugs relating to them.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #2
"Peter Foti" <pe****@systoli cnetworks.com> wrote:
font-size: 1em; vs. font-size: 100%;

for body.

By the specification, there is no difference, since for the font-size
property, both the em unit and percentages are relative to the font-size
of the enclosing element.

Browsers have some bugs and deficiencies for both, but on the average,
percentages are a little safer.

But what would be the point of setting font-size of body to 1em or to
100%? That would just tell the browser to use whatever it does anyway. If
you think there is a particular trick (maybe intended to overcome a
browser bug) involved, please explain.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #3
"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
news:Xn******** *************** ******@193.229. 0.31...
But what would be the point of setting font-size of body to 1em or to
100%? That would just tell the browser to use whatever it does anyway. If
you think there is a particular trick (maybe intended to overcome a
browser bug) involved, please explain.


I read somewhere in this newsgroup that setting the font size to 100% takes
care of some IE 5.5 bugs.

Peter

Jul 20 '05 #4
Peter Foti wrote:
"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
news:Xn******** *************** ******@193.229. 0.31...
But what would be the point of setting font-size of body to 1em or to
100%? That would just tell the browser to use whatever it does anyway. If
you think there is a particular trick (maybe intended to overcome a
browser bug) involved, please explain.


I read somewhere in this newsgroup that setting the font size to 100% takes
care of some IE 5.5 bugs.


The bug in question is related to setting font sizes in em units and
affects multiple WinIE versions, not just 5.5. If you aren't using em
units for font-size, there is no real reason to set body text size.

--
To email a reply, remove (dash)un(dash). Mail sent to the un
address is considered spam and automatically deleted.
Jul 20 '05 #5
"kchayka" <kc*********@si hope.com> wrote in message
news:3f******** *************** @news.twtelecom .net...
Peter Foti wrote:
"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
news:Xn******** *************** ******@193.229. 0.31...
But what would be the point of setting font-size of body to 1em or to
100%? That would just tell the browser to use whatever it does anyway. If you think there is a particular trick (maybe intended to overcome a
browser bug) involved, please explain.


I read somewhere in this newsgroup that setting the font size to 100% takes care of some IE 5.5 bugs.


The bug in question is related to setting font sizes in em units and
affects multiple WinIE versions, not just 5.5. If you aren't using em
units for font-size, there is no real reason to set body text size.


So, for instance, if I wanted to set my <h1> elements to have a font size of
2em, then I *should* set the body to have a font size of 100%, correct?

Thanks,
Peter


Jul 20 '05 #6
On Tue, 4 Nov 2003 13:23:49 -0500, "Peter Foti"
<pe****@systoli cnetworks.com> wrote:
If I have a style:

body
{
font-size: 1em;
}

Is that any different than:

body
{
font-size: 100%;
}


They should be identical. And should also be identical to not defining
any font-size at all. And are identical in decent browsers.

But some (all? I'm not sure) versions of IE screw up if you subsequently
define other relative font sizes - it produces differing results for the
three cases.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #7
"Peter Foti" <pe****@systoli cnetworks.com> wrote:
"kchayka" <kc*********@si hope.com> wrote in message
news:3f******* *************** *@news.twteleco m.net...
Peter Foti wrote:
> "Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message
> news:Xn******** *************** ******@193.229. 0.31...
>> But what would be the point of setting font-size of body to 1em or to
>> 100%? That would just tell the browser to use whatever it does anyway.If >> you think there is a particular trick (maybe intended to overcome a
>> browser bug) involved, please explain.
>
> I read somewhere in this newsgroup that setting the font size to 100%takes > care of some IE 5.5 bugs.


The bug in question is related to setting font sizes in em units and
affects multiple WinIE versions, not just 5.5. If you aren't using em
units for font-size, there is no real reason to set body text size.


So, for instance, if I wanted to set my <h1> elements to have a font size of
2em, then I *should* set the body to have a font size of 100%, correct?


Not quite.

If you want your h1 to appear twice the user's chosen default, even
when they are using Windows IE and when they're chosen default is
something other than 'medium' then you either:
need to set body to 100% and h1 to 2em
or
set h1 to 200%.

If you have Windows IE handy you can see this effect on
http://steve.pugh.net/test/test47.html (note that the comments about
Opera and percentage sizes don't apply to recent releases).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 20 '05 #8
"Steve Pugh" <st***@pugh.net > wrote in message
news:df******** *************** *********@4ax.c om...
If you want your h1 to appear twice the user's chosen default, even
when they are using Windows IE and when they're chosen default is
something other than 'medium' then you either:
need to set body to 100% and h1 to 2em
or
set h1 to 200%.

If you have Windows IE handy you can see this effect on
http://steve.pugh.net/test/test47.html (note that the comments about
Opera and percentage sizes don't apply to recent releases).


Fascinating! For the longest time I have been hearing that ems were the
best unit to use. It seems that is not so. I'll be switching to
percentages.
Thanks!

Peter

Jul 20 '05 #9
Peter Foti wrote:

I read somewhere in this newsgroup that setting the font size to
100% takes care of some IE 5.5 bugs.


And exposes the site to a new bug in NS4, so do hide it from that
browser if you use it.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #10

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

Similar topics

6
4642
by: Lasse Skyum | last post by:
I'm currently learning STL and I hate not knowing what is gooing on "inside" STL... not because I really _need_ to know it to develop my game project, but that's just my nature... like most of you at this grounp I suspect. So the question is: How does a std::vector construct and destruct the elements in it? I know it has something to do...
8
3002
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and whether it was docked or not. I added the following code to my "OnConnection" function but it fails with an error, "Run-time exception thrown :...
5
1563
by: | last post by:
newbie code -------------------------- #include <iostream> using namespace std; #include <cstring> class aaa {
2
1308
by: sdowney717 | last post by:
I have a table with a column defined thus: LOCNumber Varchar(100) in a table called Bookdata. If I execute ALTER TABLE BookData ALTER COLUMN LOCNumber varchar(100) on the table, does any work get done on the table and column? Or does SqlServer know that the column is already varchar(100) and nothing needs to be done? If it does do some...
4
3837
by: David Link | last post by:
Hi, Why does adding SUM and GROUP BY destroy performance? details follow. Thanks, David Link s1.sql: SELECT t.tid, t.title, COALESCE(s0c100r100.units, 0) as w0c100r100units,
2
319
by: Michael | last post by:
Hi. Here is my codes, which run too long. It takes about 8 minutes to complete the "for" loop. Why does it run so long? What's wrong? Thanks for any help. Yours sincerely, Michael
4
12502
by: reycri | last post by:
I have a page that works as I intend in IE but not in Firefox: <html> <head> <title>Overflow Test</title> </head> <body style='overflow:hidden; margin:0; padding:0;'> <table border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse; width:100%; height:100%;'> <tr><td colspan='2' style='height:3em; border-bottom:1px solid
1
6476
by: Mike Collins | last post by:
I am trying to create some pages and have them take 100% of the window, but I cannot get 100% to work. If I set the height of my div, the page displays a scroll bar and it looks like I set the height to about 150%. I tried using CSS, now I am trying tables. Can someone show me where I am mixing things up? Thanks. --Master Sheet <%@ Master...
2
2021
by: gunnuk | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>WELCOME TO HEMA CREATIVE HOUSE</title> <style type="text/css"> <!-- @import...
1
10826
by: psion | last post by:
Hi, We have a gridview on a webpage, which we would like to be 100% of the table cell in which it is placed. When we specify the width to be 100%, this has no effect, but only if we specify a pixel number, i.e. 800, will the gridview be 800 px wide. Here is an example: http://www.valuetronics.com/Results.aspx?keywords=8050&x=0&y=0 And...
0
7412
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5892
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4900
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.