PDA

View Full Version : question about lists and css



MrMJS
January 15th, 2007, 02:00 PM
Hello,
I've been messing with lists and css and I was wondering why there is a space between my two divs.

see example below...........

http://www.mrmjs.com/images/cssQ1.jpg

I made a container div, a banner div and then a nav div. I put the lists in the nav div and it adds a space between banner div and nav div. my question is how do I remove this space and why is it there?

here is the code i have so far


<body>
<div class="container">
<div class="banner">Banner to be placed here </div>
<div class="nav"><ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5 </li>
</ul></div></div>
</body>

DDD
January 15th, 2007, 02:39 PM
Set the UL margin and padding to "0"

fasterthanlight™
January 15th, 2007, 02:45 PM
... you should set alllllllll margins and paddings to "0" initially and add padding/margin where needed. ***shakes fist at various browsers' default padding and margin values***

MrMJS
January 15th, 2007, 02:53 PM
Set the UL margin and padding to "0"

that fixed it.. thanks

Abus
January 16th, 2007, 07:35 AM
I have seen some developers use


* {margin:0;padding:0}

at the very first line of their CSS. What do you think about it? Do u use it? Has it some crossbrowser issues?

fasterthanlight™
January 16th, 2007, 11:15 AM
I use it, however you have to use it from the very first day of coding your site, if you implement it half way through the coding process it will reset a bunch of default padding and margin values and mess up your page, and it will take you a while to track down what has changed, and how