The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › CSS newbie
Hi, Im a beginner in CSS. pls clarify my doubt. I have to make a red coloured box and blue coloured box aligned horizontally. So i wrote the code as HTML:
and CSS for that as
#container{ border:1px solid #000; overflow:auto;position:relative;} #container div { width:40%; height:30px;} #red { background-color:#F00; left:0} #blue { background-color:#006; right:0}
But the boxes are appearing to be vertically stacked one over the other.How to make them horizontal ?
You probably want to float the #red and #blue boxes to the left. @TheDoc posted some good links about this recently.
https://css-tricks.com/forums/discussion/11137/floats-got-you-down/p1
@irfan – Here you go.
http://jsfiddle.net/93Svy/
Read up on floats, and you’ll see how easy it was to make this happen. Cheers!
@mixxmac @aaronsilber thanks buddies