Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Layout Techniques Display Modes Block vs. Inline Elements

Glen Thompson
Glen Thompson
2,077 Points

li style not working

I am tried in Chrome and IE 11

Glen Thompson
Glen Thompson
2,077 Points

Note if I use it directly on the ul element in the html it works, i.e. <ul style="...">...</ul> but in css file it does not work. Also the padding and margin does not work either.

2 Answers

Keith Kelly
Keith Kelly
21,326 Points

Glen, can you post your css and html code so we can diagnose?

Glen Thompson
Glen Thompson
2,077 Points

It is exactly as in the video, I downloaded normal.css and added ol, ul { list-style: none; margin: 0; padding: 0; }

Keith Kelly
Keith Kelly
21,326 Points

That is the proper way to style your list elements. They are applied to the parent ordered or unordered list.

If you want to add a padding or margin to the list item try:

ul li {
     padding: 10px;  // Whatever value you want
     margin: 10px;  // Whatever value you want
}