How to get rid of white border around 3 column CSS?

5 replies
  • WEB DESIGN
  • |
I can't figure out how to get rid of this white border around my floated divs. I've tried setting padding and margin to 0.

Here's my code:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.one { float: left; width: 300px; height: 850px; background: #666; padding: 0; margin: 0;}

.two { float: left; width: 300px; height: 850px; background: #CCC; padding: 0; margin: 0;}

.three { float: left; width: 300px; height: 850px; background: #9FF; padding: 0; margin: 0;}

footer { width: 900px; height: 100px; background: #009; clear: both;}

</style>
</head>

<body>
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
<footer></footer>
</body>
</html>

Here's what it looks like.

#border #column #css #rid #white
  • Profile picture of the author WPcrew
    Just add body {margin: 0;}. That will do it.
    {{ DiscussionBoard.errors[9002878].message }}
    • Profile picture of the author NateJasper
      That did it. Thank you.
      {{ DiscussionBoard.errors[9002895].message }}
  • Profile picture of the author watsonovedades
    thanks i was having some doubts with {margin: 0;}
    just helped me a lot
    thanks
    Signature
    Whatever your mind can conceive and BELIEVE you can achieve
    Follow me on Twitter - @DineroConPc
    I talk about Affiliate Marketing Methods
    {{ DiscussionBoard.errors[9003415].message }}
    • Profile picture of the author RobinInTexas
      If it's just one page, you're done, but if you are building a website, you can eliminate many unwanted css properties by setting everything to 0 instead of letting various browsers using their, often different, defaults.

      CSS Tools: Reset CSS
      Signature

      Robin



      ...Even if you're on the right track, you'll get run over if you just set there.
      {{ DiscussionBoard.errors[9004006].message }}
  • Profile picture of the author WPcrew
    Robin is right, use reset.css in the future. All basic styles will play fine.
    {{ DiscussionBoard.errors[9006412].message }}

Trending Topics