Jump to content

Recommended Posts

Something like this?

 

html code:

<div class="headerCont">
<div class="columns column1">
    	column 1
    </div>
    <div class="columns column2">
    	column 2
    </div>
    <div class="columns column3">
    	column 3
    </div>
    <div class="clear"></div>
</div>

 

css code:

<style type="text/css">
.headerCont {
width:1000px;
height:250px;
text-align:center;
margin-left:auto;
margin-right:auto;
}

.columns {
height:250px;
float:left;
}
.column1 {
width:60%;
background-color:#6FC;
}
.column2 {
width:20%;
background-color:#CC0;
}

.column3 {
width:20%;
background-color:#0F0;
}

.clear {
clear:both;
}
</style>

 

To get this to happen you have to use float and clear. When you float a div or element it looses its strict height and width that pushed surrounding elements into position, however if you clear the floats as in my .clear class then the elements gain their strict height and widths back.

 

thanks

 

algidDes523

Link to comment
https://forums.phpfreaks.com/topic/261108-three-column-css/#findComment-1338801
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.