Jump to content

[SOLVED] divs side by side


AV1611

Recommended Posts

I've always made my overall sites the old way:

 

Make a table for the template, then css it to look good.

 

It works great, but it may not always,

 

Sooo....

 

I have to make sites using div's for layout.

 

One thing alludes me when using divs:

 

How do I line 3 of them side by side. 

 

 

 

Here is what I mean

 

main div

div1  div2  div3

close main container

 

what happens is this:

 

main div

div1

div2

div3

close main container

 

 

I have figured out that i can do 2 side by side with float left, float right, but what If I need 3 or more side by side? how do I do it then?

 

A good example would be a liquid header. 

 

Here is a site that does it with a table.  I want to convert this site to div's only:

 

http://windows.blmservices.com/newsite.

 

Thanks.

 

 

Link to comment
Share on other sites

I read through the last section that deal with liquid 3 column layout, which is what I'm doing kinda.

 

Here is a sample of my problem:

 

<div style="width: 800px; margin-left: auto; margin-right: 0px; background-color: yellow; text-align: center;";>

<div style="float: left;">left float</div>

<p>This text should be in the middle of the main div.</p>

<div style="float: right;">right float</div>

</div>

 

You can view the problem here:

 

http://windows.blmservices.com/site3

 

The right is under the container, not in the container. (and the whole container is right not centered...)

Link to comment
Share on other sites

OIC,

 

I changed it to this:

 

<div style="width: 800px; margin-left: auto; margin-right: 0px; background-color: yellow; text-align: center;";>

<div style="float: left;">left float</div>

<div style="float: right;">right float</div>

<p>This text should be in the middle of the main div.</p>

</div>

 

Now nothing is "broken out". 

 

I still don't understand why the container isn't centered, Do I need a clear: right or something? I don't understand that, but know it fixed a site once.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.