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

i have a ? regarding positioning ul li .

okay so my main problem is that i have ul li i managed this code so far

 ul li  {
  text-align: center;
  display: inline-block;
  }

so they are on an inline block but the problem is that when i display it that way they dont move to the center it stays on the left and when i remove the display they move to the center but not inline can someone help me fix this thank you .

2 Answers

Normal I just do like this:

ul {
  text-align: center;
}

ul li {
  display: inline-block;
}

This will place the li's inline and in the center of the ul, just like you want :-)

:D thank you!!!!

Hello Jihad,

You want to center the ul not the li (see below):

ul {
    text-align: center;
}

hey alex ya that works lets say i have

main about contact they are stacked on top of each other

when i write

 ul {
    text-align: center;
}

it goes to the center but when i do this

ul {
display: inline-block;
}

they go back to the left i would like the result to look like this

                                             main about contact         

in the center