473,388 Members | 1,426 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,388 software developers and data experts.

CSS Oddity

For whatever reason, I can't see this one.

See http://users.rcn.com/neal413/layouttest.html for a layout that should
be square and even in Opera and Firefox. See
http://users.rcn.com/neal413/layouttest2.html for one that is the same in
IE6.

The difference? In the former, floated div has margin: 0 1em 0 0.5em; in
the second example, it's changed to margin: 0 1em 0 0.5em; . I'm screwing
something up, I gotta be. There's a way to make this render more uniformly.

Clearly something stupid is wrong. I am either blind or something. Help?
Jul 20 '05 #1
7 1378
Neal <ne*****@yahoo.com> wrote:
For whatever reason, I can't see this one.

See http://users.rcn.com/neal413/layouttest.html for a layout that should
be square and even in Opera and Firefox. See
http://users.rcn.com/neal413/layouttest2.html for one that is the same in
IE6.

The difference? In the former, floated div has margin: 0 1em 0 0.5em; in
the second example, it's changed to margin: 0 1em 0 0.5em;


Changed? It's different in the code, but you've written identical
shorthand values above.

It renders differently according to the different margins, so what is
the problem?

--
Spartanicus
Jul 20 '05 #2
On Fri, 20 Aug 2004 08:58:40 +0100, Spartanicus <me@privacy.net> wrote:
Neal <ne*****@yahoo.com> wrote:
For whatever reason, I can't see this one.

See http://users.rcn.com/neal413/layouttest.html for a layout that
should
be square and even in Opera and Firefox. See
http://users.rcn.com/neal413/layouttest2.html for one that is the same
in
IE6.

The difference? In the former, floated div has margin: 0 1em 0 0.5em; in
the second example, it's changed to margin: 0 1em 0 0.5em;


Changed? It's different in the code, but you've written identical
shorthand values above.

It renders differently according to the different margins, so what is
the problem?


Late at night, and I should expect this... let me explain it more
accurately.

http://users.rcn.com/neal413/layouttest.html should render as nicely
aligned boxes in Opera and Firefox. In IE the floated element is 0.5em to
the right. By changing that element's left margin from 1em to 0.5em, the
IE rendering is corrected. http://users.rcn.com/neal413/layouttest2.html

It's simple enough to use a hack to give IE the value it seems to need,
but I'm at a loss to explain exactly why this is happening in the first
place. I've played with all the margins and paddings I can think of. I'm
wondering if there's something obvious I screwed up or am just overlooking
that would make this problem arise.
Jul 20 '05 #3
Neal <ne*****@yahoo.com> wrote:
Late at night, and I should expect this... let me explain it more
accurately.

http://users.rcn.com/neal413/layouttest.html


You could/should have reduced this to the relevant bit only:

body{margin:0;padding:0}
#nav{float:left;margin:0 1em}

<div id="nav">Foobar</div>

Anyway, it's an IE float/margin bug.

--
Spartanicus
Jul 20 '05 #4
On Fri, 20 Aug 2004 18:30:36 +0100, Spartanicus <me@privacy.net> wrote:
Neal <ne*****@yahoo.com> wrote:
Late at night, and I should expect this... let me explain it more
accurately.

http://users.rcn.com/neal413/layouttest.html


You could/should have reduced this to the relevant bit only:

body{margin:0;padding:0}
#nav{float:left;margin:0 1em}

<div id="nav">Foobar</div>

Anyway, it's an IE float/margin bug.

Figured it was. Sorry about the complexity, it was late when i was working
on that.

Any better fixes (like a containing block or something) than hacking the
margin?
Jul 20 '05 #5
Neal <ne*****@yahoo.com> wrote:
Any better fixes (like a containing block or something) than hacking the
margin?
#nav {
border: 1px solid white; display:inline;

float: left;
width: 8.5em;
margin: 0 1em;
padding: 0.5em;
}

Seems bizarre, but the float:left on the next line overrides the
display:inline (the width will stick), and IE now falls into line.

--
Spartanicus
Jul 20 '05 #6
Neal wrote:

See http://users.rcn.com/neal413/layouttest.html for a layout that should
be square and even in Opera and Firefox. See
http://users.rcn.com/neal413/layouttest2.html for one that is the same in
IE6.

There's a way to make this render more uniformly.


Trying to figure out why IE does what it does can take a whole lot of
time and head-banging. Sometimes it's just easier to find an alternative
route. Suggestion...

Drop margin:1em on all the individual boxes. Instead try
#wrapper { padding:1em }
#header { margin-bottom:1em }
#footer { margin-top:1em }

or something similar.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 20 '05 #7
On Fri, 20 Aug 2004 20:05:06 +0100, Spartanicus <me@privacy.net> wrote:
Neal <ne*****@yahoo.com> wrote:
Any better fixes (like a containing block or something) than hacking the
margin?


#nav {
border: 1px solid white;
display:inline;

float: left;
width: 8.5em;
margin: 0 1em;
padding: 0.5em;
}

Seems bizarre, but the float:left on the next line overrides the
display:inline (the width will stick), and IE now falls into line.


Thanks, I'm filing that away for the future!
Jul 20 '05 #8

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

Similar topics

6
by: Greg Bryant | last post by:
PHP Newbie question: I installed the above, and if I point directly to a ..php file (i.e. http://localhost/phpinfo.php, I get the php script executed properly. If I put a <?php ... ?> tag in...
3
by: Tom Barnes | last post by:
Check out this code: // Start Code ------------- function test_in_array($val) { $a = array('key' => $val); printf("in_array: %d, value:%s<BR>", in_array('key', $a), $a); } test_in_array(0);...
0
by: John | last post by:
I have a macro to input a date in Excel as follows : ActiveCell.Value = InputBox("Enter date (DD/MM/YYYY)") The active cell is formatted as custom dd/mm/yyyy However if I enter 12/08/2004...
8
by: Kris Caselden | last post by:
I noticed a strange yet easily fixed problem in Python's thread module. Consider the following code: #------------------------------- import thread data='this is data'
6
by: RT Lange | last post by:
>>> class E1(Exception): pass >>> class E2(E1): pass >>> i = E2('foo') >>> raise E1(i) Traceback (most recent call last): File "<pyshell#5>", line 1, in ? raise E1(i) E1: foo
12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
5
by: jmdocherty | last post by:
All, I've been trying to set up a CSS layout and all seems well in Firefox but in Safari it just seems to be plain weird! I hope someone can help tell me whether this is a problem with my code...
43
by: michael.f.ellis | last post by:
The following script puzzles me. It creates two nested lists that compare identically. After identical element assignments, the lists are different. In one case, a single element is replaced. In...
6
by: Rex the Strange | last post by:
Hello all, Traditionally I'm a Delphi and VB6 programmer and have recently started working with VB.NET (which, I might add, I love, but that's beside the point). Anyway, I was trying to make a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.