Here is my page structure;

I have images inside all “li” below. I am trying to align these images inside the li elements. I am trying to do this with setting right and left margin to auto but it is not working.
Here is the css;
#navcontainer ul li
{
display: inline-block;
width:80px;
}
#navcontainer ul li img
{
margin-right:auto;
margin-left:auto;
}
I am sure it is not about accessing the element from css, bcs when I set the width or height or any other thing in the css it is working. But I didnt manage to align it to the center.
If they’re
inline-block, simply usetext-align: centeron the parentlielements.If they’re
display: block, then you can usemargin: 0 auto 0 auto(top,right,bottomleft).It’s also worth pointing out that the only valid children of a
ulorolarelielements. Any other content must be wrapped in anli, otherwise the mark-up is invalid, and then the user-agent tries to correct the mark-up when preparing the DOM. And not consistently across the various user-agents.Using the following mark-up as a demonstration:
With the following CSS:
JS Fiddle demo.