css - Fixed-Fluid-Fixed Layout for 960.gs -


our website engine uses 960.gs grid system , trying modify 3 columns fixed(100px)-fluid(max width)-fixed(100px) view. unfortunately 960.gs online generators makes or full-fixed or full-fluid grids. trying modify generated full-fluid grid view:

<------------100%--------------->  ======== =============== ======== | fixed| |max screen| |fixed | ======== =============== ========  <-100px>                 <-100px> 

the code (after modification): http://jsfiddle.net/vzm8x/

  • problem 1) not sure how make central content area max left on screen. because width:auto; doesn't work @ all, width:100% wrapping divs.
  • problem 2) after fixed 100px div continues wrapping down anything. (display:inline; doesn't ideas?)

my question is: possible modify 960.gs template according our needs? if yes please give me advice fix problems? thank in advance!

with fixed-width side columns, it's easy. you're going want use floats, , may need faux columns trick, depending on specific design needs.

you'll want along lines of:

<div class="left"></div> <div class="right"></div> <div class="middle">content</div> 

and:

div {     /* border-box, make sure "width" our intended width */     -moz-box-sizing: border-box; /* firefox still uses prefix */     box-sizing: border-box; }  .left {     float: left;     width: 100px;     background: #f00; }  .right {     float: right;     width: 100px;     background: #00f; }  .middle {     width: 100%;     padding: 0 100px;     background: #ccc; } 

see in action here (this without faux column effect, should give starting point). if change width of section output, you'll see columns stay put, , content stays within bounds of outer columns.

the content column needs last, because it's still in document flow, right column end below content.

alternatively, can use position: absolute; on side columns this:

.wrapper {   position: relative; /* constrains columns within parent. not needed if parent <body> */ }  .left {   position: absolute;   top: 0;   left: 0; }  .right {   position: absolute;   top: 0;   right: 0; }  .middle {   padding: 0 100px; }  div {   -moz-box-sizing: border-box;   box-sizing: border-box; } 

these tricks work in ie8+, firefox, chrome, safari, , opera. ie7 might have issues due using w3c box model ("content-box") , not recognizing box-sizing css, there few tricks make work if need it. ie6 should okay, because uses "border-box" based box model default. (you may need play z-index ie behave. if so, set .middle{ position: relative; z-index: 1} , add z-index: 2 left , right columns.)

the position: absolute trick have advantage on float 1 in sidebars can appear before or after content div, making potentially more semantic option.

the reason these work because a) side columns fixed, set padding width of columns, , b) position: absolute , float: [left/right] take elements out of document flow, means far document concerned, aren't there , take no space. allows other elements move elements used be, layering them on top of each other.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -