Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder kyllle's Avatar
    Join Date
    Mar 2008
    Posts
    334
    Thanks
    85
    Thanked 2 Times in 2 Posts

    adding space between a background & its border

    Hi guys just want to know how to add space between a background color and its border, basically iv tried padding but with no luck:

    Code:
    <style type="text/css">
      
      .box{
    	width: 200px;
    	height: 100px;
    	background-color: #dedede;
    	border: 5px solid #000;
    	padding: 10px;
    	}
    	
      
      </style>
     </head>
    
     <body>
      <div class="box"></div>
     </body>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    You may need to have two divs, like
    Code:
    <style type="text/css">
      .box{
    	width: 200px;
    	height: 100px;
    	border: 5px solid #000;
    	padding: 10px;
    	postion:relative;
    	}
    	.box div{
    	postion:absolute;
    	width:100%;
    	height:100%;
    	background-color: #dedede;
    	}
    </style>
    Code:
    <div class="box" >
     <div></div>
    </div>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    kyllle (11-20-2008)

  • #3
    Regular Coder kyllle's Avatar
    Join Date
    Mar 2008
    Posts
    334
    Thanks
    85
    Thanked 2 Times in 2 Posts
    ah loads of thanks Abdul!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •