Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:32:57+00:00 2026-06-04T23:32:57+00:00

Here is my page structure; I have images inside all li below. I am

  • 0

Here is my page structure;

enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:32:57+00:00Added an answer on June 4, 2026 at 11:32 pm

    If they’re inline-block, simply use text-align: center on the parent li elements.

    If they’re display: block, then you can use margin: 0 auto 0 auto (top,right,bottom left).

    It’s also worth pointing out that the only valid children of a ul or ol are li elements. Any other content must be wrapped in an li, 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:

    <ul>
        <li class="inlineBlock"><img src="http://lorempixel.com/100/100/sports" /></li>
        <li class="block"><img src="http://lorempixel.com/100/100/nature" /></li>
    </ul>​
    

    With the following CSS:

    li.inlineBlock {
        text-align: center;
    }
    li.inlineBlock img {
        display: inline-block;
    }
    
    li.block img {
        display: block;
        margin: 0 auto 0 auto;
    }​
    

    JS Fiddle demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this page here: http://www.eminentmedia.com/development/powercity/ As you can see when you mouse
I have a page going here that uses jQuery: http://treethink.com/services What I am trying
I have a page with the below structure (HTML content shortened for readability), where
The php.net page here http://www.php.net/manual/en/mysqlinfo.library.choosing.php says this Configure commands for using mysqlnd // Recommended,
If you look on this page here in Firefox (I'm on 3.5.2 on a
Hi i am trying to redirecting visualforce page to google.com page here is my
Here is a page I am trying to make print friendly, so it will
I'm not entirely sure what's breaking here on this page: http://grandoaks.org/floor.html but it seems
Here is the web structure of my page: 01.<?php // rnlogout.php 02.include_once 'rnheader.php'; 03.echo
I have a structure called /pdf/ where generated PDFs are stored. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.