468,136 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

Fluid layout breaks in IE

I have part of my website that has to be laid out with 3 DIVs like
this:

|---------------------------------------------------------||--------------------|
| ||
|
|---------------------------------------------------------||
|
| ||
|
|---------------------------------------------------------||--------------------|

here is the html:

<div id="Logo"></div>
<div id="Menu">...</div>
<div id="heading">.....</div>

here is the css:
#Main{
#Logo{
width: 100px;
height: 65px;
float: right;
background: #30304A url('Images/logoarea.jpg') bottom left no-repeat;
}
#Menu{
height: 30px;
background: #30304A url('Images/nav_bg.jpg') top left repeat-x;
white-space: nowrap;
margin-right: 100px;
}
#Heading{
height: 35px;
background: #8F93C3 url('Images/heading_bg.jpg') repeat-x;
padding-left: 13px;
margin-right: 100px;
}
}

My problem is that in IE there is a gap(approx 2px) between "Logo" and
the other two DIVs.

How can I fix this?

Jul 18 '06 #1
6 1372
hiazle wrote:
I have part of my website that has to be laid out with 3 DIVs like
this:

|---------------------------------------------------------||--------------------|
| ||
|
|---------------------------------------------------------||
|
| ||
|
|---------------------------------------------------------||--------------------|
Maybe you can see that your "diagram" is not so useful. Did you use tabs
at the end of some lines?
here is the html:
An actual URL would have been better than pasting some fake HTML and
fake CSS.
>
<div id="Logo"></div>
<div id="Menu">...</div>
<div id="heading">.....</div>

here is the css:
#Main{
#Logo{
width: 100px;
height: 65px;
float: right;
background: #30304A url('Images/logoarea.jpg') bottom left no-repeat;
}
#Menu{
height: 30px;
background: #30304A url('Images/nav_bg.jpg') top left repeat-x;
white-space: nowrap;
margin-right: 100px;
}
#Heading{
height: 35px;
background: #8F93C3 url('Images/heading_bg.jpg') repeat-x;
padding-left: 13px;
margin-right: 100px;
}
}
CSS does not nest like this. I think you're lucky that anything comes
out of your browser at all (assuming it does, but without an URL, I
can't really tell).

CSS is case sensitive, so "heading" is not the same as "Heading".

Next time, try validating your page first, before posting. Then provide
an URL.

--
John
Jul 19 '06 #2
John Hosking wrote:
CSS is case sensitive, so "heading" is not the same as "Heading".
^^^^^^^^^^^^^^^^^^^^^

In general, this is wrong.

<blockquote cite="http://www.w3.org/TR/REC-CSS2/syndata.html#q4">
All CSS style sheets are case-insensitive, except for parts that are not
under the control of CSS. For example, the case-sensitivity of values of
the HTML attributes "id" and "class", of font names, and of URIs lies
outside the scope of this specification. Note in particular that element
names are case-insensitive in HTML, but case-sensitive in XML.
</blockquote>

The same says <http://www.w3.org/TR/CSS21/syndata.html#q6>.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 19 '06 #3
Johannes Koch wrote:
John Hosking wrote:
>CSS is case sensitive, so "heading" is not the same as "Heading".

^^^^^^^^^^^^^^^^^^^^^

In general, this is wrong.
The same says <http://www.w3.org/TR/CSS21/syndata.html#q6>.
Hmm, that what the W3C says, all right. I had not read that before. Now
I've read it, but maybe not understood it completely.

What I get now is, CSS itself (the stylesheet) is not case sensitive
(nor is HTML itself), but as soon as I try to *connect* one with the
other, I have to pay attention to case.

This matches my experience, where my HTML includes <span class="Blurb">,
and all my tweaking to .blurb {color:#0000FF;} fails to change the
color, until I notice the differences in capitalization.

So CSS *isn't* case sensitive, until I try to use it...
Jul 19 '06 #4
John Hosking wrote:
>
Maybe you can see that your "diagram" is not so useful. Did you use tabs
at the end of some lines?
Next time, try validating your page first, before posting. Then provide
an URL.
Ok, I made a mistake on the HTML and CSS that I provided but you really
have to burn me for it? Unfortunately I do not have a url to provide at
that moment so I have to improvise in order to give you a visual of
what I'm trying to accomplish

The diagram was meant to look like this:

|-----------------------------------||--------------------|
| || |
|-----------------------------------|| |
| || |
|-----------------------------------||--------------------|

And the html was supposed to look like this:

<div id="main">
<div id="logo"></div>
<div id="menu">...</div>
<div id="heading">.....</div>
</div>

And the CSS:

#main{
margin: 0;
padding: 0;
}
#logo{
width: 100px;
height: 65px;
float: right;
background: #30304A url('Images/logoarea.jpg') bottom left no-repeat;
}
#menu{
height: 30px;
background: #30304A url('Images/nav_bg.jpg') top left repeat-x;
white-space: nowrap;
margin-right: 100px;
}
#heading{
height: 35px;
background: #8F93C3 url('Images/heading_bg.jpg') repeat-x;
padding-left: 13px;
margin-right: 100px;
}
Basically, what I'm trying to achieve here is to have two divs on the
left and one on the right (The same effect you get when you do
rowspan="2" in a table). In the end, the total height of the two divs
on the left equals the height of the div on the right.

All this works fine in Firefox and Opera, but in IE there is a white
space between the two divs on the left and the one on the right

Jul 26 '06 #5
hiazle wrote:
Ok, I made a mistake on the HTML and CSS that I provided but you really
have to burn me for it?
Sorry, but I didn't mean to "burn" you; I was just pointing out a
problem. It was hindering my understanding of this problem (and could
get in the way for other people and in other posts you might make in the
future). I tried to phrase it as best I could. (I also wasn't sure if
your diagram looked hunky-dory in your newsreader; maybe everything
looked fine yo you, even in my reply. At least I'm not crazy. ;-)
Unfortunately I do not have a url to provide at
that moment so I have to improvise in order to give you a visual of
what I'm trying to accomplish

The diagram was meant to look like this:

|-----------------------------------||--------------------|
| || |
|-----------------------------------|| |
| || |
|-----------------------------------||--------------------|
Yay! Much better.
And the html was supposed to look like this:
<snipped; see below>
>
And the CSS:
<snipped; see below>
>
All this works fine in Firefox and Opera, but in IE there is a white
space between the two divs on the left and the one on the right
Well, I don't know the answer to your problem, but I spent some time
looking at it, and maybe somebody else (or you!) can figure it out from
here.

First, I've taken your HTML and CSS and posted it on a server to which I
have access: http://www.zugerfechtclub.ch/MM/Junk/hiazle.htm

Second, I modified your styles to provide contrasting (ugly) colors and
some visible texts. Doesn't change your problem at all. This gives your
"white space" an ugly orangey color; the space is from div#main.

Third, I added a second (tweaked) instance of your code, separated from
your otherwise unchanged code by a clear and some <HR>s.

I see by trial and error that your backgrounds, margin-rights, and
padding-left are all irrelevant to your problem. If this had been *my*
problem I was posting, I would have left all that stuff out.

What does seem to make a difference, although it doesn't solve your
problem, is removing the heights for the two left-hand DIVs (menu and
heading). For some reason I don't know, this eliminates the space in IE.
Of course, then your DIVs are the wrong size...

I had rather suspected the 3-pixel jog, but as I tried to understand the
explanation at
<http://www.positioniseverything.net/explorer/threepxtest.htmland
played with the code, I came to think it must be something else. But
maybe somebody else here knows.

--
John
Jul 28 '06 #6

John Hosking wrote:
>
What does seem to make a difference, although it doesn't solve your
problem, is removing the heights for the two left-hand DIVs (menu and
heading). For some reason I don't know, this eliminates the space in IE.
Of course, then your DIVs are the wrong size....

--
John
Thanks a lot John... I'll give that a try. If I really have to do away
with the heights, then I'll try specifying a height in a div inside.
hopefully that does the trick

Hiazle

Jul 30 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Alex Bell | last post: by
47 posts views Thread by Neal | last post: by
22 posts views Thread by Jam Pa | last post: by
12 posts views Thread by JB | last post: by
2 posts views Thread by James Frayne | last post: by
9 posts views Thread by TristaSD | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.