0

2 column div layout: right column with fixed width, left fluid

I have the same problem, only in the code box on the right goes first, second left

#container {
  width: 100%;
  max-width: 1400px;
  min-width: 1024px; 
  margin: 0 auto;
  text-align: left;
}

/*left block */
    .block_side {
        width: 236px;
        height: 400px;
        float: left;
        margin: 19px 0 0 30px;
    }


/* Right block */    
.content_side {
        float: none;
        overflow: hidden;
        width: auto;
        margin: 0 30px 0 0;
    }

content_side be right and left block_side, but they must have the document in that order

<div id="container">
   <div class="content_side">
     {CONTENT}
   </div>
   <div class="block_side">
     {BLOCK}
   </div>
 </div>

"content_side" replaces a unit that should be left, occupies the entire available width

Demo in Jsfiddle

Community
  • 1
  • 1

3 Answers3

1

change #containet to #container and text-align: left; to text-align: center;

#container {
  width: 100%;
  max-width: 1400px;
  min-width: 1024px; 
  margin: 0 auto;
  text-align: center;
}

Demo in jsfiddle

Gildas.Tambo
  • 22,173
  • 7
  • 50
  • 78
0

Change css rule float:none to float:right would do the trick if I understand your question correctly.

.content_side {
    float: right;
}
Johan Sundén
  • 447
  • 4
  • 9
0

CSS

#container {
  width: 100%;
  max-width: 1400px;
  min-width: 1024px; 
  margin: 0 auto;
  text-align: left;
    position:relative;
    height:auto;
}

/*left block */
    .block_side {
        width: 256px;
        height: 400px;
        float: left;
        margin: 0px 0 0 30px;

    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */

    background-color:green;
    }


/* Right block */    
.content_side {
        float: right;
        width: 738px;
        margin: 0;
    height:400px;
    overflow:auto;

    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */

    background-color:red;
    }

HTML

<div id="container">
   <div class="block_side">
     {BLOCK}
   </div>
   <div class="content_side">
     {CONTENT}
   </div>
 </div>

You need to float:left or float:right your blocks (side and content).

DEMO HERE

More about box-sizing trick here: http://css-tricks.com/box-sizing/

Ernest Sawyer
  • 360
  • 2
  • 13