<div style="background-color:black; width:100%; height:30">
</div>

I would like to make a div with a real 100% width, but when I try the code above, I don't get what I want :[ It's not really 100% there are still some spaces between the div and body. what should I do?

Every browser has it's own default styling applied to HTML rendering. In this case, you're seeing that the body has a margin applied (which is really common). You can combat this by setting (in your css file):

body { margin: 0; }

Many people are using browser "reset" css files in effort to first normalize the browser styling before adding your own styles. There are many (each with their pros/cons), but they all work in the same general way - Eric Meyer might be a good one to start with (I've used it to great success in the past): http://meyerweb.com/eric/tools/css/reset/

commented: Thanks +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.