Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3 column layout with fixed left and right column. Right column flows into center column on smaller screens

HTML Setup

<div id="fixed-wrapper">
<div id="header">
        <h1>Site Name</h1>
</div>
<div id="leftCol"></div>
<div id="centerCol"></div>
<div id="rightCol"></div>

CSS:

#fixed-wrapper{
    min-width: 1264px;
}
#header{
    width: 100%;
    height: 75px;   
    text-align: center;
}
#header h1 
{
    line-height: 75px;   
}
 #centerCol {
    margin-left: 310px;
    margin-right: 360px;
    height: 100%;
    min-width: 604px;
}
#rightCol {
    width: 285px;
    height: auto;
    position: absolute;
    top: 75px;
    right: 0;
    margin-right: 75px;
}
#leftCol {
    width: 235px;
    height: auto;
    position: absolute;
    top: 75px;
    left: 0;
    margin-left: 75px; 
}

The issue is that the center column needs to have a min-width, but the right column shouldn't move into the center column.

like image 723
Hyper Avatar asked Oct 10 '22 09:10

Hyper


1 Answers

Try set width of center column as auto rather define its minimum width,

 #centerCol {
    margin-left: 310px;
    margin-right: 360px;
    height: 100%;
    width: auto;
}
like image 60
toopay Avatar answered Oct 20 '22 05:10

toopay