473,545 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Question (2 column layout)

I essentially have the standard two column layout, but I'm running
into a quirk I'm hoping someone can help with. I have one column
which is the main content (75%) of the screen and the remaining 25% is
reserved for "side" content.

The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

-me

------ code
#main
{
float: left;
width: 75%;
}

#side
{
}

and then the following HTML code
<html>

<div id="main">
let's say the text in this section takes up three lines on the screen.
</div>

<div id="side">
let's say this section has ten lines of text, the first three lines
will be just fine in this div, the other seven lines will wrap and
begin where text in the #main div would start. (instead of wrapping
to the start of the #side div)
</div>

</html>
------ end code
Jul 20 '05 #1
10 2073
I should probably add that this was under IE6/Win

On 16 Apr 2004 21:16:48 -0700, Alfred wrote:
I essentially have the standard two column layout, but I'm running
into a quirk I'm hoping someone can help with. I have one column
which is the main content (75%) of the screen and the remaining 25% is
reserved for "side" content.

The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

-me

------ code
#main
{
float: left;
width: 75%;
}

#side
{
}

and then the following HTML code
<html>

<div id="main">
let's say the text in this section takes up three lines on the screen.
</div>

<div id="side">
let's say this section has ten lines of text, the first three lines
will be just fine in this div, the other seven lines will wrap and
begin where text in the #main div would start. (instead of wrapping
to the start of the #side div)
</div>

</html>
------ end code

Jul 20 '05 #2
I should probably add that this was under IE6/Win

On 16 Apr 2004 21:16:48 -0700, Alfred wrote:
I essentially have the standard two column layout, but I'm running
into a quirk I'm hoping someone can help with. I have one column
which is the main content (75%) of the screen and the remaining 25% is
reserved for "side" content.

The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

-me

------ code
#main
{
float: left;
width: 75%;
}

#side
{
}

and then the following HTML code
<html>

<div id="main">
let's say the text in this section takes up three lines on the screen.
</div>

<div id="side">
let's say this section has ten lines of text, the first three lines
will be just fine in this div, the other seven lines will wrap and
begin where text in the #main div would start. (instead of wrapping
to the start of the #side div)
</div>

</html>
------ end code

Jul 20 '05 #3

"Alfred" <om***@yahoo.co m> wrote...
The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

-me

------ code
#main
{
float: left;
width: 75%;
}

#side
{
}

Stylesheet:

#main {
width: 75%;
}

#side {
float: right;
width: 25%;
}

html:

<div id="side">
content
</div>

<div id="main">
content
</div>

Putting the #side div first, which is floated to the right, will allow
the main content to flow around it. The #side content will not flow
outside of it's declared width.

Regards,
Jim

Jul 20 '05 #4

"Jim Roberts" wrote...
Stylesheet:

#main {
width: 75%;
}

[snip]


correction:

Either remove width: 75% from #main or add float: left;. Without this
modification, it did not work correctly in IE, although it seemed fine
in Mozilla.

#main {
width: 75%;
float: left;
}

or

#main {
/* other declarations */
}

Jim

Jul 20 '05 #5

"Alfred" <om***@yahoo.co m> wrote...
The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

-me

------ code
#main
{
float: left;
width: 75%;
}

#side
{
}

Stylesheet:

#main {
width: 75%;
}

#side {
float: right;
width: 25%;
}

html:

<div id="side">
content
</div>

<div id="main">
content
</div>

Putting the #side div first, which is floated to the right, will allow
the main content to flow around it. The #side content will not flow
outside of it's declared width.

Regards,
Jim

Jul 20 '05 #6
Alfred wrote:
I essentially have the standard two column layout, but I'm running
into a quirk I'm hoping someone can help with. I have one column
which is the main content (75%) of the screen and the remaining 25% is
reserved for "side" content.

The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

[snip]

The "classic" answer to keeping things in columns is to give the non-floated
element a large margin on the side of the floated element. The margin should
be at least as wide as the width of the floated element.

The same technique works for avoiding superimposing onto absolutely-positioned
elements too, if you used that instead of float.

This "large margin" approach actually has a specific problem in the case of
floats, although I suspect that it won't matter much to you. If the viewport
becomes so narrow that the non-floated element drops below the floated one,
the non-floated element will still have that, now-inappropriate, large margin.
You need to experiment to see if it matter to you.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #7

"Jim Roberts" wrote...
Stylesheet:

#main {
width: 75%;
}

[snip]


correction:

Either remove width: 75% from #main or add float: left;. Without this
modification, it did not work correctly in IE, although it seemed fine
in Mozilla.

#main {
width: 75%;
float: left;
}

or

#main {
/* other declarations */
}

Jim

Jul 20 '05 #8
Alfred wrote:
I essentially have the standard two column layout, but I'm running
into a quirk I'm hoping someone can help with. I have one column
which is the main content (75%) of the screen and the remaining 25% is
reserved for "side" content.

The problem with my CSS is that if the main content's height is less
than the side content's height, the side content will wrap underneath
the main content instead of staying within the 25% bounds.

[snip]

The "classic" answer to keeping things in columns is to give the non-floated
element a large margin on the side of the floated element. The margin should
be at least as wide as the width of the floated element.

The same technique works for avoiding superimposing onto absolutely-positioned
elements too, if you used that instead of float.

This "large margin" approach actually has a specific problem in the case of
floats, although I suspect that it won't matter much to you. If the viewport
becomes so narrow that the non-floated element drops below the floated one,
the non-floated element will still have that, now-inappropriate, large margin.
You need to experiment to see if it matter to you.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #9
Thanks for your suggestions Jim. For some reason, only one of your
suggestions worked. (the one below. using IE6/Win in Standard mode) But
it worked, nonetheless. And with CSS, it almost seems best not to ask why.
:)

#main
{
float: left;
width: 75%;
}

#side
{
float: right;
width: 25%;
}
Jul 20 '05 #10

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

Similar topics

3
5459
by: Doug McCrae | last post by:
http://www.btinternet.com/~doug.mccrae/go4learning/index.html As it says in the subject, a two column layout (plus header and footer boxes). I feel the left column really needs to be fixed width (151px) as it contains an image, while everything else is fluid. However this only works in IE 6.0. In Netscape and Opera I found that the auto...
0
1780
by: Alfred | last post by:
I essentially have the standard two column layout, but I'm running into a quirk I'm hoping someone can help with. I have one column which is the main content (75%) of the screen and the remaining 25% is reserved for "side" content. The problem with my CSS is that if the main content's height is less than the side content's height, the side...
4
3099
by: Stian Lund | last post by:
Hi, I'm trying to create a 2 column layout with a footer on the bottom, where the (fixed-width) sidebar follows the content in the code, while showing on the left hand side of the content. The footer must stay at the bottom regardless of which column is the longest, so absolute positioning is out, I need to use floats with the clear: both;...
3
4333
by: Paul Burke | last post by:
Hi all I am hoping someone can help with a 2 column layout. It works ok in IE, but the second column (right) appears below the first column when viewed in FF or NS. Here is the url http://tinyurl.com/58ewa The html and css pass validation, but fail to see the problem. I am sure it is something probably really simple. But it beats me to
16
6151
by: Dan V. | last post by:
How do you do a css 2 column layout with header and footer, with the 2nd column auto-stretching so entire page looks good for 800 x 600 resolution as min. and 1024 x 768 resolution as a max? Ideally the layout would be centered so it scales better visually. This would be great for me. Thanks,
15
2308
by: Tamblyne | last post by:
This problem has got to have a simple solution and I can't be the first person who has ever handled it. Perhaps Google is no help because I'm not using the right terms? (I did find one post on-point, but no one responded to it.) I have a two column layout with a header and a footer. If the "content" is longer than the "navigation", there...
10
1715
by: Philipp E. Imhof | last post by:
Hi! I am experiencing a problem with a two-column layout -- apparently I am not the first person, but the solutions I found in GG did not give me what I was looking for. The page should be as follows: ................................ .. +----------+-------+ .
3
3197
by: =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= | last post by:
Hello. I seek confirmation for the reasons behind a margin-related behavior I have observed. I have set up a simple test page to illustrate the issue. The page shows a very simple 2-column layout, where columns are contained in /div/ elements. The first column is floated left and the second one is offset by a left margin. You should be...
3
788
by: Mark | last post by:
Hi all I would like to create a simple two column layout - navigation on the left and content on the right. I would like the columns to have a fluid width so they can grow and shrink according to the size of the text and the browser window. However, I do not want the content column to span the entire available width of the page (minus the...
1
8882
Death Slaught
by: Death Slaught | last post by:
I will be showing you how to make a very simple but effective three column layout. First we will begin with the HTML, or structure, of our three column layout. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"...
0
7502
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...
0
7434
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...
0
7946
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...
1
7457
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5360
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...
0
5078
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...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
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
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.