PDA

View Full Version : Background/Box Alignment in CSS



Genie1
Jan 19th, 2009, 08:20 PM
Hello Team,

I have just created a demo in Paint on how i would like to do this, but please note this is draft and id like to know how to align "box a" and "box b", rather than doing abosolute posistion as i dont know if that is the best option or not. But i want those boxes to at at the background so i can write on top of the box.

Can you some one please be kind enough to write some sort of code so i can see what you have done to achive this.

Thank you

http://img523.imageshack.us/img523/7751/demoge7.png

jcdevelopment
Jan 19th, 2009, 08:29 PM
.wrapper {
width:600px;
background-color:red;
height:300px;
}

.boxa {
width:200px;
height:100px;
background-color:white;
float:left;
}

.boxb {
width:200px;
height:100px;
background-color:white;
float:right;
}


HTML


<div class="wrapper">
<div class="boxa"></div>
<div class="boxb"></div>
</div>

You can use "margins as well to move from left and right to get the right distance. Be careful not to exceed the margins of each other, you might break the lay out.

example css of margins


margin-left:5px;