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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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;}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.