473,783 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem aligning DIVs

I seem to be missing something in my understanding. If I leave off absolute
positioning, shouldn't nested DIV/SPAN be displayed inside the parent, and
ones outside that display separately?

Here is some sample code:
----------------------------------------------------------
<div id='header' style='border:r ed solid medium'>
<p>This is the Header</p>
</div>

<div id='container' style='border:g reen solid meduim'>
<span style='border:r ed dashed medium; float:left;'>
<p>This is the left column</p>
</span>
<span style='border:b lue dashed medium; float:right;'>
<p>This is the right column</p>
</span>
</div>

<div id='footer' style='border:g reen dashed medium;'>
<p>This is the footer</p>
</div>

<div id='lost' style='backgrou nd:yellow'>
<p>Where is this one</p>
</div>
--------------------------------------------------------

The borders are there just to see how things display.

The INTENT is to have a header across the full page, two columns below that,
and a footer underneath all of it. Like:

+---------------------+
| HEADER |
+---------------------+
| l-col | r-col |
+---------------------+
| FOOTER |
+---------------------+

The code above works in IE & Opera, but the footer overlaps the left & right
columns in Firefox & Netscape. The "container" division is practically
nonexistent.

Eliminating the container division results in the same display - with the
columns appearing to be inside the footer.

What am I missing - to make the footer display UNDER the container DIV,
without using absolute positioning?
Jul 21 '05 #1
5 3967
Tony:
<span style='border:r ed dashed medium; float:left;'>
<p>This is the left column</p>
</span>


Look closely at this. Let an HTML validator help you if you don't see it
yourself.

PS: I guess that's the source of your problem, but I didn't bother to
verify.
Jul 21 '05 #2

"Christoph Päper" <ch************ **@nurfuerspam. de> wrote in message
news:d8******** ***@ariadne.rz. tu-clausthal.de...
Tony:
<span style='border:r ed dashed medium; float:left;'>
<p>This is the left column</p>
</span>


Look closely at this. Let an HTML validator help you if you don't see it
yourself.

PS: I guess that's the source of your problem, but I didn't bother to
verify.


The W3C validator didn't like the <p> tags.

Removing them did nothing to change the formatting, but the page did
validate
Jul 21 '05 #3
Tony wrote:
"Christoph Päper" <ch************ **@nurfuerspam. de> wrote in message
news:d8******** ***@ariadne.rz. tu-clausthal.de...
Tony:
<span style='border:r ed dashed medium; float:left;'>
<p>This is the left column</p>
</span>


Look closely at this. Let an HTML validator help you if you don't see it
yourself.

PS: I guess that's the source of your problem, but I didn't bother to
verify.

The W3C validator didn't like the <p> tags.

Removing them did nothing to change the formatting, but the page did
validate


The item pointed out is that you are placing a block (p) inside an
inline element (span), which is not legal.

The item pointed out is not your problem, however. The problem of your
footer overlapping the columns is because you are floating your columns.
Any floated item is taken out of the normal flow. This means that the
vertical space that it occupies is not accounted for (no height);
similar to an absolutely positioned item.

--
Gus
Jul 21 '05 #4
"Gus Richter" <gu********@net scape.net> wrote in message
news:Xc******** ************@go lden.net...
Tony wrote:
"Christoph Päper" <ch************ **@nurfuerspam. de> wrote in message
news:d8******** ***@ariadne.rz. tu-clausthal.de...
Tony:

<span style='border:r ed dashed medium; float:left;'>
<p>This is the left column</p>
</span>

Look closely at this. Let an HTML validator help you if you don't see it
yourself.

PS: I guess that's the source of your problem, but I didn't bother to
verify.

The W3C validator didn't like the <p> tags.

Removing them did nothing to change the formatting, but the page did
validate


The item pointed out is that you are placing a block (p) inside an inline
element (span), which is not legal.

The item pointed out is not your problem, however. The problem of your
footer overlapping the columns is because you are floating your columns.
Any floated item is taken out of the normal flow. This means that the
vertical space that it occupies is not accounted for (no height); similar
to an absolutely positioned item.


OK - I got that (Thanks for the clarification).

So what is the 'proper' method to do this, then?

I tried removing the "float" and setting both to "width:50%" - in IE, this
SOMETIMES does what I want, but as I resize the screen, the right-column
sometimes drops to the line below. Making one or the other "width:49%"
solves this, but leaves a gap at the right edge - I could live with this if
I could get the gap in the middle, instead, but it seems rather poor to
settle.

Jul 21 '05 #5
Tony wrote:

So what is the 'proper' method to do this [two columns with footer], then?


http://www.google.com/search?hl=en&l...er&btnG=Search

--
Gus
Jul 21 '05 #6

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

Similar topics

2
3169
by: Iain Hallam | last post by:
Hi. I've got a few divs on a page that are positioned as "fixed". I now want my text to centre itself both horizontally and vertically. "text-align: center" on the body works for horizontal, but I can't seem to get the text to move from the top of each div. Any suggestions? Incidentally, the page layout I'm aiming for is as follows: ..-------------------------------------------.
9
4077
by: Dustin | last post by:
Here's what I am trying to do: (Names represent CSS classes.) I want to create a photo gallery. I want the entire gallery to be surrounded by a box named PhotoGallery. I want a fluid placement of the individual Items within PhotoGallery. An Item is a box that has two child boxes, PhotoBox and Caption. Photobox has an explicit width and height. PhotoBox contains an image whose dimensions may vary, but are constrained to be within...
4
9734
by: Mimo Zus | last post by:
I'm hoping that someone can explain what's going on; better yet provide a workaround. I'm designing a centered CSS site based on a 550 pixel wide vertical background image. Onto this background I built a two column layout with nested navigation and content divs. The background image is centered via "background: ... center;", the divs are centered over it via "margin: 0 auto 0 auto;". The problem I'm having in IE6 is inconsistent...
3
1977
by: Mark Wiewel | last post by:
hi all, i am a newbie in ASP.NET and i couldn't find the solution to this one: i have a form with three datagrids on it. i would like to align them vertically with a space between each grid of about 20px. the amount of rows in those grids is changing, but the position of each datagrid seems to be fixed. this results in a grid overlaying another one or the space between two grids is way too high.
0
4953
by: friendlycoder | last post by:
Hi there, How do you align DIVS next to each other? I have 3 images, each image is assocated in the style sheet as background image. I want the images to align to each other like this example http://www.btinternet.com/~lee_friend/layers/layerexample.jpg
4
3295
by: O11Y | last post by:
Hello, I've read numerous posts & guides on this subject but i'm still having problems. I'm writing some HTML for the company intranet and all our browsers are currently (you guessed it) IE6. In most of the guides that I've read you can "fix" this problem in IE6 by nesting a series of divs inside each other and fiddling the margins. However this only seems to work when you know the size of the content you're putting in. It also seems to...
0
1710
by: nlindsay | last post by:
I am trying to center align 2 left floated divs within a % width background. I know that setting the wrapper div to a fixed width works, but can it be done with a fluid background? (basically I want 2 fixed width divs to center on a background image that stretches across the whole screen). thanks
2
2125
by: brixton | last post by:
Hello, I have an "accordion menu" where I want the structure to be like this for a menu item with "children" who are supposed to drop down when an "expand image" is clicked: <li> <span>some text</span> <img src="the_expand_image.gif" /> </li> Now, for each menu item like that I want to align the span to the left, and the img to the right in my <li>. I haven't been able to find a cross-browser solution, setting float:left and...
0
9643
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
9480
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
10147
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
9946
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...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.