473,624 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with my DIV-based box model

Hi. I am trying to straighten out some DIV issues in the rendering of my
no-tables CSS website. Right now the biggest issue is trying to render 2
columns several DIVs deep in the box model for my index page. If you go to
http://galtsvalley.com/newindex.html - you will see the problem area. I've
highlighted the relevant blocks with nice, harsh primary colors.

Clearly there are positioning problems begetting flow issues - the blocks
subsequent to the 2 side-by-side columns are not positioned relative to
them. Instead, they act as if the columns were not there.

My page's box model breaks down into a TopSection (the header bar) and a
MidSection (content and menu). Both of these in turn contain 2 side-by-side
columns: TopSection-1 & TopSection-2; and MidSection-1 and a MidSection-2.
MidSection-1 is the left column, for content. MidSection-2 is the right
column, for the menu. There is no BottomSection as yet. The relevant style
is copied below.

My problem is in MidSection-1, in what I call the LeadContentSect . Under the
text heading "Consulting Domains" are those problem columns. Again, their
relevant broken style is copied below.

Any ideas where I'm going wrong. Feel free to lambaste me for my CSS!

Brian

p.s. a warning: I have no idea how this page will render on a Mac!

---

newdefault.css:

body
{
font-family: verdana, arial, helvetica, sans-serif;
color: #000000;
background-color: red;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}

/*************** *****
** Begin DIV defs **
*************** *****/

/* TopSection (Header) Style */

#TopSection {
position: fixed;
width: 100%;
height: 160px;
top: 0; right: 0; left: 0; bottom: auto;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
font-family: Arial, Helvetica, Serif;
font-size: 12px;
font-weight: normal;
border-bottom: 1px solid #003300;
background-color: #9999FF;
}
#TopCol-1 {
/* position: absolute;*/
float: left;
width: 40%;
height: auto;
top: 0; left: 0; bottom: auto;
color: #000066;
font-size: 14px;
padding: 140px 5px 0px 10px;
}
#TopCol-2 {
/* position: relative;*/
float: right;
width: 60%;
height: auto;
top: 0; left: 40%; bottom: auto;
text-align: right;
margin-right: 0px;
padding: 114px 10px 0px 0px; /* top right bot left */
/* background-image: url(/img/pine_at_dusk.jp g);
background-repeat: no-repeat;
background-position: right;*/
}

/* MidSection Style */

#MidSection {
position: absolute;
width: 100%;
height: 100%;
top: 160px; left: 0; bottom: auto;
background-color: #ffc;
padding: 0px 0px 0px 10px;
margin: 0;
}
#MidCol-1 {
float: left;
width: 68%;
height: auto;
top: 0; left: 0; bottom: auto;
border-bottom: 10px solid black;
margin-top: 40px;
margin-bottom: 40px;
padding-bottom: 40px;
}
#MidCol-2 {
float: right;
width: 30%;
height: auto;
top: 0; right: 0; left: 70%; bottom: auto;
font-size: 11px;
line-height: 13px;
color: #000000;
background-color: #cc0;
border-left: 2px dotted #000000;
border-bottom: 3px solid #444444;
min-width: 155px;
margin: 0px 0px 0px 0px;
padding: 10px 10px 10px 10px;
}

#LeadContentSec t {
position: relative;
width: 100%;
height: 100%;
background-color: none;
padding: 0px 5px 0px 7px;
margin-top: 0px;
margin-bottom: 0px;
border-top: 10px solid #999966;
border-left: 1px solid #999966;
border-right: 1px solid #999966;
border-bottom: 2px solid #999966;
}
..col-container {
position: absolute;
width: 100%;
height: auto;
top: auto; left: 0; right: 0; bottom: auto;
background-color: red;
}
..col-container .Col1 {
float: left;
width: 50%;
height: auto;
top: 0; left: 0; right: auto; bottom: auto;
background-color: blue;
}
..col-container .Col2 {
float: right;
width: 50%;
height: auto;
top: 0; left: 50%; right: auto; bottom: auto;
background-color: yellow;
}

Jul 20 '05 #1
6 2692
One more thing -

I just viewed the link (http://galtsvalley.com/newindex.html) on my Win XP
machine under IE 6. I see that I have other issues here. Suffice it to say
that my page renders as I expect it to on my Win 2000 machine under IE 5.5.
If anyone has any pointers on how to make my CSS IE 5.5 and IE 6 compatible,
please share!

Brian
Jul 20 '05 #2
After hacking around a little bit more I've made some progress. The flow
problem was apparently due to setting the position property of
..col-container (within <div id="LeadContent Sect">) to 'absolute'. I changed
this to 'relative' and got the desired result.

Getting the contents of the two columns to render properly side-by-side was
a bit trickier. First, I noticed (see link in my OP - i.e.,
http://galtsvalley.com/newindex.html) that as I changed the window width in
IE 5.5 the column 2 contents would "flip" up and down - from rendering
properly side-by-side with the column 1 contents to rendering side-by-side
but "after" the contents in column 1. (Please see link if this description
requires a visual!) The same thing was happening in IE 6. It now seems that
the 'width' percentages were causing problems. When I had the width Col1 and
Col2 set to 50% each this problem occurred. But when I dropped the width of
Col2 to 48% the problem went away. At least in IE 5.5. The problem persists
in IE 6.

I don't perfectly understand what I did that fixed the problem in IE 5.5. or
why the problem persists in IE 6. Any ideas on either count?

To see the new results please go here:

http://galtsvalley.com/newindex2.html (using newdefault2.css )

[Again the original link was http://galtsvalley.com/newindex.html using
newdefault.css]

The new style is copied below for the relevant divs.

TIA,

Brian

---
#LeadContentSec t {
position: relative;
width: 100%;
height: 100%;
background-color: none;
padding: 0px 5px 0px 7px;
margin-top: 0px;
margin-bottom: 0px;
border-top: 10px solid #999966;
border-left: 1px solid #999966;
border-right: 1px solid #999966;
border-bottom: 2px solid #999966;
}

..col-container {
position: relative;
width: 100%;
height: auto;
top: auto; left: 0; right: 0; bottom: auto;
background-color: none;
margin-left: 50px;
margin-right: 100px;
}
..col-container .Col1 {
float: left;
width: 50%;
height: auto;
padding-left: 50px;
background-color: none;
}
..col-container .Col2 {
float: right;
width: 48%;
height: auto;
background-color: none;
}
---

/* MidSection Style */

#MidSection {
position: absolute;
width: 100%;
height: 100%;
top: 160px; left: 0; bottom: auto;
background-color: #ffc;
padding: 0px 0px 0px 10px;
margin: 0;
}
#MidCol-1 {
float: left;
width: 68%;
height: auto;
top: 0; left: 0; bottom: auto;
border-bottom: 10px solid black;
margin-top: 40px;
margin-bottom: 40px;
padding-bottom: 40px;
}
#MidCol-2 {
float: right;
width: 30%;
height: auto;
top: 0; right: 0; left: 70%; bottom: auto;
font-size: 11px;
line-height: 13px;
color: #000000;
background-color: #cc0;
border-left: 2px dotted #000000;
border-bottom: 3px solid #444444;
min-width: 155px;
margin: 0px 0px 0px 0px;
padding: 10px 10px 10px 10px;
}

#LeadContentSec t {
position: relative;
width: 100%;
height: 100%;
background-color: none;
padding: 0px 5px 0px 7px;
margin-top: 0px;
margin-bottom: 0px;
border-top: 10px solid #999966;
border-left: 1px solid #999966;
border-right: 1px solid #999966;
border-bottom: 2px solid #999966;
}
.col-container {
position: absolute;
width: 100%;
height: auto;
top: auto; left: 0; right: 0; bottom: auto;
background-color: red;
}
.col-container .Col1 {
float: left;
width: 50%;
height: auto;
top: 0; left: 0; right: auto; bottom: auto;
background-color: blue;
}
.col-container .Col2 {
float: right;
width: 50%;
height: auto;
top: 0; left: 50%; right: auto; bottom: auto;
background-color: yellow;
}

Jul 20 '05 #3

"B McDonald" <no@spam.com> wrote in message
news:MZ******** *********@newss vr31.news.prodi gy.com...
After hacking around a little bit more I've made some progress. The flow
problem was apparently due to setting the position property of
.col-container (within <div id="LeadContent Sect">) to 'absolute'. I changed this to 'relative' and got the desired result.

Getting the contents of the two columns to render properly side-by-side was a bit trickier. First, I noticed (see link in my OP - i.e.,
http://galtsvalley.com/newindex.html) that as I changed the window width in IE 5.5 the column 2 contents would "flip" up and down - from rendering
properly side-by-side with the column 1 contents to rendering side-by-side
but "after" the contents in column 1. (Please see link if this description
requires a visual!) The same thing was happening in IE 6. It now seems that the 'width' percentages were causing problems. When I had the width Col1 and Col2 set to 50% each this problem occurred. But when I dropped the width of Col2 to 48% the problem went away. At least in IE 5.5. The problem persists in IE 6.

I don't perfectly understand what I did that fixed the problem in IE 5.5. or why the problem persists in IE 6. Any ideas on either count?
I think the problem is that you have specified width of the divs as well as
padding,
borders and margins and because your DOCTYPE is setting IE6 to standard mode
as
opposed to quirks mode (quirks mode is the same as earlier versions of IE.)

I'm not sure about IE5.5 but IE5 gets the box model wrong. According to the
CSS
specifications the total width of an item should be the width + padding +
border + margin.
IE5 sets the total width of an item = width and includes padding, border
and margins within it.

There is a box model hack (Tantek's hack) which allows you to set the
correct dimensions for Netscape, Opera, Mozilla
and IE6 standard mode and the width that IE5 will need as well. You can
find out more information about this
at http://www.tantek.com/CSS/Examples/boxmodelhack.html

As long as you don't specify width as wells as padding, border or margins
then you should't have a problem so you could start by removing the
width:100% property on your divs and see if that helps.

AM

To see the new results please go here:

http://galtsvalley.com/newindex2.html (using newdefault2.css )

[Again the original link was http://galtsvalley.com/newindex.html using
newdefault.css]

The new style is copied below for the relevant divs.

TIA,

Brian

---
#LeadContentSec t {
position: relative;
width: 100%;
height: 100%;
background-color: none;
padding: 0px 5px 0px 7px;
margin-top: 0px;
margin-bottom: 0px;
border-top: 10px solid #999966;
border-left: 1px solid #999966;
border-right: 1px solid #999966;
border-bottom: 2px solid #999966;
}

.col-container {
position: relative;
width: 100%;
height: auto;
top: auto; left: 0; right: 0; bottom: auto;
background-color: none;
margin-left: 50px;
margin-right: 100px;
}
.col-container .Col1 {
float: left;
width: 50%;
height: auto;
padding-left: 50px;
background-color: none;
}
.col-container .Col2 {
float: right;
width: 48%;
height: auto;
background-color: none;
}
---

/* MidSection Style */

#MidSection {
position: absolute;
width: 100%;
height: 100%;
top: 160px; left: 0; bottom: auto;
background-color: #ffc;
padding: 0px 0px 0px 10px;
margin: 0;
}
#MidCol-1 {
float: left;
width: 68%;
height: auto;
top: 0; left: 0; bottom: auto;
border-bottom: 10px solid black;
margin-top: 40px;
margin-bottom: 40px;
padding-bottom: 40px;
}
#MidCol-2 {
float: right;
width: 30%;
height: auto;
top: 0; right: 0; left: 70%; bottom: auto;
font-size: 11px;
line-height: 13px;
color: #000000;
background-color: #cc0;
border-left: 2px dotted #000000;
border-bottom: 3px solid #444444;
min-width: 155px;
margin: 0px 0px 0px 0px;
padding: 10px 10px 10px 10px;
}

#LeadContentSec t {
position: relative;
width: 100%;
height: 100%;
background-color: none;
padding: 0px 5px 0px 7px;
margin-top: 0px;
margin-bottom: 0px;
border-top: 10px solid #999966;
border-left: 1px solid #999966;
border-right: 1px solid #999966;
border-bottom: 2px solid #999966;
}
.col-container {
position: absolute;
width: 100%;
height: auto;
top: auto; left: 0; right: 0; bottom: auto;
background-color: red;
}
.col-container .Col1 {
float: left;
width: 50%;
height: auto;
top: 0; left: 0; right: auto; bottom: auto;
background-color: blue;
}
.col-container .Col2 {
float: right;
width: 50%;
height: auto;
top: 0; left: 50%; right: auto; bottom: auto;
background-color: yellow;
}


Jul 20 '05 #4
"Anne Marie Denley" <> wrote in message
news:10******** *******@ananke. eclipse.net.uk. ..

I think the problem is that you have specified width of the divs as well as padding, borders and margins and because your DOCTYPE is setting IE6 to standard mode as opposed to quirks mode (quirks mode is the same as earlier versions of IE.)
I'm not sure about IE5.5 but IE5 gets the box model wrong. According to the CSS specifications the total width of an item should be the width + padding + border + margin. IE5 sets the total width of an item = width and includes padding, border and margins within it.

There is a box model hack (Tantek's hack) which allows you to set the
correct dimensions for Netscape, Opera, Mozilla
and IE6 standard mode and the width that IE5 will need as well. You can
find out more information about this
at http://www.tantek.com/CSS/Examples/boxmodelhack.html

As long as you don't specify width as wells as padding, border or margins
then you should't have a problem so you could start by removing the
width:100% property on your divs and see if that helps.

AM


Thanks Anne Marie - for taking the time to penetrate my post.

I made a bunch of changes to my CSS and some to my XHTML as well. The CSS is
def. more correct - for the page header at least. I've not resolved the
style problems with the content section of the website yet. I'll start that
tomorrow.

Would you mind checking out the result? The link is the same:
http://galtsvalley.com/newindex2.html (using newdefault2.css )


I did take out a bunch of the 'width=100%;' properties from the major div
elements. In my post under the heading "why doesn't my com name display?"
you can find my elaboration on what I did to get my company name to display.

How's it look under IE 5 now?

Brian
Jul 20 '05 #5

"Anne Marie Denley" <am@denley.ecli pse.co.uk> wrote in message
news:10******** *******@ananke. eclipse.net.uk. ..

I was actually looking at your site in IE6. I was just explaining if you've been coding
the widths and heights for IE5.5 (which I think treats them the same as IE5) then you
have been coding them incorrectly (as per the CSS specifcation) because
total width of an item
= specified width + padding + border + margin.

Also I've had a look at your site in Opera 7.11 & Mozilla 1.4 and it seems
to be
badly broken, especially in Opera. Have you looked at your site in any
other
browsers? It is quite a simple process to download Netscape, Opera,
Mozilla,
Lynx to be able to check your site in various browsers.

I've noticed that you are also using % and px. This makes it more difficult to
work out your widths because you cannot add % and px together.


Thanks again. I hardly have time to explain myself - I'm out the door.
However, I've taken your advice and have gotten rid of many of the 'px'
measurements. I'm not through yet - but thinking about the box model in the
way you implied helped me to get more normal rendering. I've tested in IE
5.5, IE 6 and Opera 5. IE 5.5's rendering is no longer "perfect".. . or
rather, looking as I intend. But the discombobulatio n is much less than
before in the more standards compliant browsers. How does it look on your
end? Here's the new link:

http://galtsvalley.com/newindex3.html

Brian
Jul 20 '05 #6
> Here's the link for the test page: http://galtsvalley.com/newindex7.html
Here's the link for the page CSS:
http://galtsvalley.com/css/newdefault7.css.txt

I'm still (regretably) stuck on this - does anyone see my post??
newindex7.css renders similarly on MSIE5.5, MSIE6, Opera 7.1. But not on
NS7.1. Any ideas on what's wrong?

Brian
Jul 20 '05 #7

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

Similar topics

3
533
by: Mikael Hellström | last post by:
Hi all... I hava a problem . This pice of code (menu) works well with ie but don't work with netscape 6.2 .. why? Please tell me how i can get this to work. My site have the adress http://www.hyresbytet.se Regards Mikael (Newbie) <html> <head>
6
5164
by: Patrick | last post by:
Hi I am fairly new to CSS and the web.I am trying to build a site more to practice my skills than for the site itself. I have been focusing on CSS and try my best to make it work in I.E 6.0, Opera 7.23, Mozilla 1.4 and N.N. 7.1. My site was doing fine until i read i was supposed to keep everything validated so i entered a strict html 4.01 doctype with url following.My HTML validated fine. So i validated my CSS and beside a little...
9
2501
by: Theodore A. Jencks | last post by:
Hi All, I have a problem that is two fold. First a little about the enviroment I'm using; I am running Microsoft Windows XP with all security patches applied. I use Mozilla 1.6 for all testing before I test on IE 6 w/ all updates. I am editing my style sheet with StyleMaster 3.5.2 and am hand coding. I use Dreamweaver MX 2004 and am also hand coding. I have a problem that is easily solved by using tables however I don't want to use...
5
8328
by: javaguy | last post by:
I have a data entry web application that is formatted heavily with tables. Having learned a bit of CSS, I'm hoping to rewrite this using <div> tags. But I have run into a formatting problem that keeps me from a solution. I'm hoping for some trick. Assume that "label_a" is a <label> tag and "INPUT_A" is an <input> tag. A sample of my current web page is: <table> <tr><td>label_a</td><td>INPUT_A</td>
1
3049
by: books1999 | last post by:
Hi there, I have a problem with this css/div and i cannot work it out. I would like either container to be able to push the background box to grow but in Firefox it overflows. Can someone find a solution to the problem contained in the code. <!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">
1
10717
by: Rebecca Tsukalas | last post by:
Hello, I have a problem concerning removeChild. This is the XML structure I use with php: <xml_thing <language1 <site>bla1</site <site>bla2</site <site>bla3</site </language1
1
1952
by: Mahesh Devjibhai Dhola | last post by:
Hi, Scenario: The webservice was developed on windows 2000 Pro and deployed previously on windows XP pro for testing. We have tested for many days. The client for that service was 30+ and accessing the webservice each min. It was working 100% fine. Problem: But now in actual deployment, we have deployed webservice in Win Server 2003 and we have used all the default configurations. Now the clients are accessing that service the same way...
0
1121
by: hardikpatelmca | last post by:
Hi All, I am working on web application which communicate with Communicator Web Access and Live communication Server. I can successfully logged into LCS system using my web application. And also can start Poll method of Communicator web access Ajax API. But i am getting xml result from communicator web access instead of JSON. I send http web request to communicator web access server and get back the result using http web response. I got...
2
2265
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they should; however, as soon as you mouse towards any but the TOP sub-catagory, all those sub-catagories still view there. It will work first time quite fine..but if user clicks outsite anywhere in screen then this problem occur.. i think it's css...
5
1894
by: creative1 | last post by:
hi everyone, I am struck in layout of my site. Im using 1024 fixed width layout. I have a site layout designed in psd files. Bisically I have to stick with that design tightly and I am asked not to chnage even a pixel. As I am not too good so I though why not ask you. I am using dreameweaver for my ease in design. The problem is "expanding box problem and cruel appearance in IE and site looks better in FFox". I am not usinf any image bigger...
0
8177
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,...
0
8629
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8488
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
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
5570
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
4084
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
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
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
1488
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.