Jump to content

How to add a white color line in center of padding?


rv20

Recommended Posts

I have 3 div boxes side by side and all are contained in a container div, the middle div has padding on the left and right hand sides and hence making a space between the divs, i want though a white line running down the center of the padding to give a seperator effect, the background is black btw, any ideas,

 

So like,

 

<div class = "cont">

    <div class = "box1">

    <div class = "box2">

  <div class = "box1">

</div></div></div>

 

so box2 has a margin margin:0px 30px 0px 29px;

 

here is a pic to illustrate.

 

2dhrzft.jpg

Since you have padding, I think you can get away with creating a white border, something like

border-right:1px solid #fff

If not, you'll probably have to put another box in the middle (<div class="box1"><div id="separator"></div><div class="box2>...") and make that into a white background.

 

That's the first thought that came to mind. Sorry if it's a bit complicated!

This is how i would do it

 

HTML

 

<div id="wrap">
<div id="box1">box 1</div>
<div id="box2">box 2</div>
<div id="box3">box 3</div>
</div>

 

CSS

 

body {background:#000000; color:#FFFFFF;}
#wrap {width:600px; height:200px; margin:auto;}
#box1 {float:left; width:150px; height:200px; padding:0px 25px 0px 25px;}
#box2 {float:left; width:148px; height:200px; padding:0px 25px 0px 25px; border-left:solid 1px #FFFFFF; border-right:solid 1px #FFFFFF;}
#box3 {float:left; width:150px; height:200px; padding:0px 25px 0px 25px;}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.