height - Specific css positioning / dynamic width with auto margin -


made image better understanding of problem.

picture showing problem

need code .bgimage , .content div

is possible crossbrowser css (ie7+ , other major browsers) without scripting?

it bit longer expected, got picture in real life. don't ask again questions here without doing more research first , writing actual code.

here demo

the code

html:

<body>   <div id = "header">   </div>   <div id = "bgimage">   </div>   <div id = "content">   </div>   <span class = "clear"></span>   <div id = "footer">   </div> </body> 

css:

*   {   margin: 0;   padding: 0;   }  body   {   width: 960px;   margin-left: auto;   margin-right: auto;   }  #header   {   width: 100%;   height: 200px;   background-color: purple;   }  #bgimage   {   position: absolute;   top: 200px;   left: 0px;   right: 50%;   height: 600px;   background-color: green;   }  #content   {   position: relative;   width: 700px;   height: 600px;   float: right;   z-index: 2;   background-color: blue;   }  .clear   {   clear: both;   }  #footer   {   position: relative;   top: 600px;   width: 100%;   height: 200px;   background-color: red;   } 

note: haven't optimized css, there's work done there.

the code here

explanation

elements i've used in code (you might want google them):

  • css reset
  • css clear
  • absolute positioning css
  • relative positioning css

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -