473,654 Members | 3,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<div> expands dramatically due to change in font-size property

please see

http://www.geocities.com/operationsengineer1/test.htm

for an idea of how i want my logo header div to be layed out.

when i went to resize "Test" to 2em (from 1em), this is what
happened...

http://www.geocities.com/operationsengineer1/test1.htm

the div expanded to twice the size, too!

this was totally unexpected to me, however, it displays this way in
both ie6 and ff1 so i think it is rendering correctly and i've coded
something incorrectly.

any guidance would be appreciated.

Jul 21 '05 #1
27 3312
i should say the div expands proportionally to an increase in the
font-size declaration of that div.

at font-size: 1em; everything is great.

at font-size: 2em; there is a double - even outside my "container" div
which houses the logo header div..

Jul 21 '05 #2
"skeeterbug " <js******@san.r r.com> wrote:
http://www.geocities.com/operationsengineer1/test.htm

for an idea of how i want my logo header div to be layed out.

when i went to resize "Test" to 2em (from 1em), this is what
happened...

http://www.geocities.com/operationsengineer1/test1.htm

the div expanded to twice the size, too!


Makes sense. You've told the div to be 6 times the font-size and then
you've doubled the font size.

When a length is defined in em the value of 1em varies on the property
being defined:
For font-size 1em = the font-size of the parent element.
For all other properties 1em = the font size of the current element.

Steve

Jul 21 '05 #3
On 11 Jan 2005 13:26:28 -0800, "skeeterbug " <js******@san.r r.com> wrote:
please see
http://www.geocities.com/operationsengineer1/test.htm
for an idea of how i want my logo header div to be layed out.
when i went to resize "Test" to 2em (from 1em), this is what
happened...
http://www.geocities.com/operationsengineer1/test1.htm
the div expanded to twice the size, too!


Hard to tell really.

Your "strict" doctype declaration will not be picked up by the doctype
sniffers when you serve a page from geocities, so anything that comes
out of that place will be rendered in "quirks" mode regardless of what
you do to try to get it right.

There is no such thing as a free lunch
(or a _free_ www server for that matter :-)

--
Rex
Jul 21 '05 #4

"skeeterbug " <js******@san.r r.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
please see

http://www.geocities.com/operationsengineer1/test.htm

for an idea of how i want my logo header div to be layed out.

when i went to resize "Test" to 2em (from 1em), this is what
happened...

http://www.geocities.com/operationsengineer1/test1.htm

the div expanded to twice the size, too!

this was totally unexpected to me, however, it displays this way in
both ie6 and ff1 so i think it is rendering correctly and i've coded
something incorrectly.


The height of the DIV is 6em, which means 6 times "the computed value of the
'font-size' property of the element on which it is used [i.e., the DIV]." If
you double the DIV's font-size property from 1em to 2em, you've doubled its
computed value, which means you've doubled any value that's defined in terms
of that computed value. In other words: this is the correct behavior.

Jul 21 '05 #5
Jan Roland Eriksson <jr****@newsguy .com> writes:
On 11 Jan 2005 13:26:28 -0800, "skeeterbug " <js******@san.r r.com> wrote:
please see
http://www.geocities.com/operationsengineer1/test.htm
for an idea of how i want my logo header div to be layed out.
when i went to resize "Test" to 2em (from 1em), this is what
happened...
http://www.geocities.com/operationsengineer1/test1.htm
the div expanded to twice the size, too!


Hard to tell really.

Your "strict" doctype declaration will not be picked up by the doctype
sniffers when you serve a page from geocities, so anything that comes
out of that place will be rendered in "quirks" mode regardless of what
you do to try to get it right.


Would you care to elaborate? If naïfely I wget the page, and
look at the first two lines I see:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Where do the "doctype sniffers" sniff?

--
Jón Fairbairn Jo***********@c l.cam.ac.uk

Jul 21 '05 #6
On 11 Jan 2005 22:58:32 +0000, "Jón Fairbairn"
<jo***********@ cl.cam.ac.uk> wrote:
Jan Roland Eriksson <jr****@newsguy .com> writes:
On 11 Jan 2005 13:26:28 -0800, "skeeterbug " <js******@san.r r.com> wrote:
>please see
>http://www.geocities.com/operationsengineer1/test.htm
>for an idea of how i want my logo header div to be layed out.
>when i went to resize "Test" to 2em (from 1em), this is what
>happened...
>http://www.geocities.com/operationsengineer1/test1.htm
>the div expanded to twice the size, too!
Hard to tell really.

Your "strict" doctype declaration will not be picked up by the doctype
sniffers when you serve a page from geocities...

Would you care to elaborate?
Sure, this is what the "sniffers" see...

<script language="JavaS cript">var PUpage="7600106 7"; var
PUprop="geociti es"; </script>
<script language="JavaS cript" src=
"http://www.geocities.c om/js_source/pu5geo.js"></script>
<script language="JavaS cript"> var thGetOv=
"http://themis.geocitie s.yahoo.com/themis/h.php";
var thCanURL=
"http://us.geocities.co m/operationsengin eer1/test.htm";
var thSpaceId="7600 1067";
var thIP="84.217.65 .78";
var thTs="110547950 3";
var thCs="2d54c51ab f084a05dd92c4ab f36a8ffd";
</script>
<noscript>
<link rel="stylesheet " href=

"http://themis.geocitie s.yahoo.com/jsoff.css?thIP= 84.217.65.78&th Ts=1105479503">
</noscript>
<!-- text above generated by server. PLEASE REMOVE -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html> ... etc...

I.e. all parts of Geocities crap gets served first, before your doctype
declaration. "Sniffers" wants to find your doctype declaration as the
first line ever...
If naïfely I wget the page, and look at the first two lines I see:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Seems like 'wget' is doing some filtering :-)
Where do the "doctype sniffers" sniff?


Right there at the <!DOCTYPE... thingy, but it has to be the first thing
they encounter, no crap up front that might look like "markup".

--
Rex
Jul 21 '05 #7
skeeterbug wrote :
please see

http://www.geocities.com/operationsengineer1/test.htm

for an idea of how i want my logo header div to be layed out.

when i went to resize "Test" to 2em (from 1em), this is what
happened...

http://www.geocities.com/operationsengineer1/test1.htm

the div expanded to twice the size, too!

this was totally unexpected to me, however, it displays this way in
both ie6 and ff1 so i think it is rendering correctly and i've coded
something incorrectly.

any guidance would be appreciated.


Not sure if this is what you should be considering, but take a look
here anyway....

http://mycoolfish.com/t/thing.html
All the divs are using the same class. They each have been applied the
same text size in /em/

resize the text and see what happens. This behaviour is because they
are each nested and inheret each others parent size.
So... the outermost uses 1.2em of its parent (the body) - 100%. the
first ensted element uses 1.2 em of its parent (which is already using
1.2em of its parent)... and so on.

play around and see what happens when you make the em size 1em, 1.2 em,
and .9em.

All expected results because of the nesting.

This may lead you into reason of the behaviour of your page.

Hope it helps.

--
dance with children in the rain

Jul 21 '05 #8
> Makes sense. You've told the div to be 6 times the font-size and then
you've doubled the font size.
that makes sense aqs you've explained it, but that IS NOT what i was
trying to do. i was trying to make the div 6em - period. well, you
know, at the normal text size in a browser.

i want em so that its size can be adjusted when folks adjust their
browser's text size.

i then want to be code different font-sizes within my 6em div.

i *thought* that is what i did, however, i'm obviously wrong.

i still don't see where i went wrong. can anyone help?

tia...

When a length is defined in em the value of 1em varies on the property being defined:
For font-size 1em = the font-size of the parent element.
For all other properties 1em = the font size of the current element.

Steve


Jul 21 '05 #9
"skeeterbug " <js******@san.r r.com> wrote:
Makes sense. You've told the div to be 6 times the font-size and then
you've doubled the font size.
that makes sense aqs you've explained it, but that IS NOT what i was
trying to do. i was trying to make the div 6em - period. well, you
know, at the normal text size in a browser.


Then make it 3em.

height of element relative to own font size = height of element
relative to default font size / element's own font size relative to
default font size*

3 = 6 / 2

*If there was an inbetween element with font-size 1.2em you would need
to take that into account as well. So instead of dividing by 2 you
would divide by 1.2 because he computed value for the element's
font-size would be 1.2*2 = 2.4 times the browser default.
i want em so that its size can be adjusted when folks adjust their
browser's text size.
How much text will you have in your header? As the font size increases
the text may wrap onto a second line, and then onto a third. In this
case it may spill out of the box you're providing. Instead of setting
a height set a bottom padding.
i still don't see where i went wrong. can anyone help?


Is there something missing from the description I gave and which you
quoted (and Harlan gives the same explanation in more technical
terms.):
When a length is defined in em the value of 1em varies on the
property being defined:
For font-size 1em = the font-size of the parent element.
For all other properties 1em = the font size of the current element.


Steve

Jul 21 '05 #10

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

Similar topics

8
14461
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a page, there is a huge gap (like 3/8 inch or 25 px) between them. This is driving me bananas. What the hey am I missing? dh ------------------------------------------------ Dan Hansen ------------------------------------------------
61
24462
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
1
3902
by: Alan Hoyle | last post by:
I was using a <table border> to generate borders around some info/images, and decided to follow the w3c guidelines and convert it to CSS boxes with borders since it wasn't really tabular data. It used to be something like this: <table> <tr> <td><img>caption</td> <td><img>caption</td>
8
5140
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is pulling a name and placing it under the thumbnail (the text is
44
919
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the scrolling box change on resize. Thanks in advance.
3
3806
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644" onclick="__doPostBack('SitesRadioButtonList_3','')" language="javascript" />
28
5351
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the </p>s included as well. <P>aaaaaaaaa</p><DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</p></DIV>
13
2255
by: Mark | last post by:
Dear folks, In Javascript, is it possible to get all id names within, say, a <div></divpair? Like the array of "document.images", I mean. The reason I ask, is that I have a calender whose <td></tdtable elements, within a given <div></div>, all have a class type, one of which is "today" (to highlight it). Once the calender is drawn, the Javascript has ended. And since Javascript has no known (to me) method of storing variables in say,...
5
13479
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as semantically meaningless containers for bunch's of other elements - like everyone keeps telling me to make my code standards compliant. This request is not because I want a fix, but because I want to
8
10029
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
8372
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7304
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5621
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.