473,402 Members | 2,053 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,402 software developers and data experts.

Problem with the width of DIV in IE6 using CSS and width:auto

I'm changing the layout of my site. Instead of using tables, I will use
DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not
the correct width. Mozilla and Opera are showing the page the way I
want. Does anybody know a solution for this?

First of all, the code I am using:

CSS
-------
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
color: #000000;
background-color: #FFFFFF;
padding: 0px;
margin: 0px;
}

div {
position: absolute;
margin: 0;
}

div.header {
position: absolute;
background-attachment: scroll;
width: 100%;
height: 27px;
left: 0;
right: 0;
top: 0;
bottom: auto;
background-color: FF00FF;
z-index: 999;
overflow: hidden;
}
div.logo {
position: absolute;
width: 133px;
height: 73px;
left: auto;
right: 0;
top: 0;
bottom: auto;
background-color: 0FF00F;
z-index: 1000;
}
div.search {
position: absolute;
left: 180;
right: 133;
width: auto;
height: 46px;
top: 27;
bottom: auto;
background-color: FFF00F;
z-index: 1000;
overflow: hidden;
}
div.layoutimage {
position: absolute;
width: 180px;
height: 120px;
left: 0;
right: auto;
top: 27;
bottom: auto;
background-color: 000FF0;
}
div.leftbar {
position: absolute;
width: 180px;
height: auto;
left: 0;
right: auto;
top: 147;
bottom: auto;
background-color: 00FFFF;
}
div.rightbar {
position: absolute;
width: 180px;
height: auto;
left: auto;
right: 0;
top: 73;
bottom: auto;
background-color: 00FFFF;
}
div.content {
position: absolute;
width: auto;
height: auto;
left: 180;
right: 180;
top: 73;
bottom: auto;
background-color: F0F0F0;
}
-------

HTML
-------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>div</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet href="div.css" type="text/css" media="screen">
</head>
<body>
<div class="header">Header</div>
<div class="logo">Logo</div>
<div class="layoutimage">Layoutimage</div>
<div class="leftbar">Leftbar</div>
<div class="rightbar">Rightbar</div>
<div class="search">Search</div>
<div class="content">Content</div>
</body>
</html>
-------

What's going wrong? The search- and the content DIV are not wide enough
when there is not so much content in it that it multiple lines of text
are needed. When there is enough content in it, it's working fine. How
can I make these two DIVs to listen to my CSS-properties and get rid of
the whitespace next to them in IE6? To make it sure, I'm describing the
yellow and the gray DIVs.

The URLs where these files are:
As described above: http://cglabbee.speed.planet.nl/test/div1.html
More content in the DIVs: http://cglabbee.speed.planet.nl/test/div2.html
The stylesheet: http://cglabbee.speed.planet.nl/test/div1.css

Jul 20 '05 #1
1 13934
In article <bj**********@reader08.wxs.nl>, Glabbeek wrote:
I'm changing the layout of my site. Instead of using tables, I will use
DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not
the correct width. Mozilla and Opera are showing the page the way I
want. Does anybody know a solution for this?

First of all, the code I am using:
[snipped CSS]
HTML
-------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

[..]

I could be wrong here, but you arent specifying a DTD file, which I think
puts IE6 into quirks mode, where it emulates IE5's broken box sizing model.

You could try replacing your doctype tag with

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">

and seeing if that solves your problem. If it does, you might want to add
some IE5 specific rules so the page displays as intended on that browser.

I prefer to do this by using IE's conditional comments after the main stylesheet
keeping the clutter out of the main CSS, eg

<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="ie5hacks.css">
<![endif-->

but there are other ways of making workarounds in the
same stylesheet.

Putting terms like ie5 box model hack into google should help.

Jon
Jul 20 '05 #2

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

Similar topics

1
by: Ryan Hubbard | last post by:
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this...
5
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
5
by: robin | last post by:
Hi, I've implemented a Style Sheet in Dreamweaver; one of the elements is supposed to stay right with the text flowing around it on the left. A similar tag is supposed to stay left with the...
2
by: VB Programmer | last post by:
I created a page which I am using to prevent the user from hitting the BACK button. I'll call it my "Auto Jump" page. When it is called it basically auto-redirects to a page specified in the...
1
by: bissatch | last post by:
Hi, How do I set the width of each column within a table? Would I use the auto value for width? I tried to do: #mytable td { width: auto; }
1
by: Dave | last post by:
I have a table with 3 fields of which the primary key is a autonumber. I have created my dataadapter, dataset and datagridview using a wizard. However, in the datagrid, the update and delete...
1
by: gwhite1 | last post by:
I am using the auto-generate fields option because my query can be different based on what the user selects. But I would still like to set the column alignment but I can;t seem to access the...
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: 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?
0
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,...
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
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...
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...
0
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...

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.