html - CSS Dynamic Left/Right column Static Width -


the problem is, have background in 2 parts.

background image #1 background image repeats (endlessly) #1 background image #2 background image repeats (endlessly) #2 

in css cant create background sticking elements on so:

#leftcolumn {     background-image:url('http://i53.tinypic.com/2ezlb7n.png');     background-repeat:no-repeat;     background-position:right top;     background-z-index:1;          background-image:url('repeat.png');       background-repeat:repeat-x;       background-z-index:0; } 

what want result be:

[ background left ] [ content ]  [ background right ] 

the content should 768px. background on both sides should show as possible.


i can't believe it, able solve myself. code made possible:

<style type="text/css"> * {     padding:0px;     margin:0px; }  html, body {     width:100%;     height:100%;     background-color:#333333; }  #leftcolumn {     background-image:url('http://i54.tinypic.com/aa83lw.png');       background-repeat:repeat-x;       display:none;    }  #rightcolumn {     background-image:url('http://i52.tinypic.com/kcjdwi.png');       background-repeat:repeat-x;      display:none;    }  #leftimage {     background-image:url('http://i53.tinypic.com/2ezlb7n.png');     background-repeat:no-repeat;     background-position:right;     width:100%;     height:128px; }  #rightimage {     background-image:url('http://i56.tinypic.com/noh6on.png');     background-repeat:no-repeat;     width:100%;     height:128px; }  #content {     width:768px;     background-color:#666666; }  @media screen , (min-width:769px) {      #leftcolumn, #rightcolumn {         display:table-cell;     }  }  </style>  <table width="100%" height="100%"> <tr>     <td id="leftcolumn" align="right"><div id="leftimage"></div></td>     <td id="content">&nbsp;</td>     <td id="rightcolumn" align="left"><div id="rightimage"></div></td> </tr> </table> 

i think you're wanting have content area in center background spans width no matter how wide runs.

the html:

<div id="wrapper">     <div id="content">your center content goes here</div> </div><!-- close wrapper --> 

the css:

#wrapper {     background: #fff url(/images/widebackground) repeat-x center top; }  #content {     margin: 0 auto; /*centers div - change 0 if want different top margin*/     width: 768px; } 

this repeat background horizontally. centered in window. if image wide enough (4000px, maybe?) you're unlikely see repeat on display without several monitors. can set color areas not covered vertically, or visible through transparent areas. set #fff, can choose color or leave out.

here's jsfiddle demonstrating suggesting. changed few things (colors, content size) make more visible, key parts still there.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -