Jump to content

Help aligning <ul> in a <div>


Recommended Posts

I am running up against a bit of a problem on a blog I am helping someone with.

 

The theme is fairly simple, no sidebars, nothing fancy.

There is a header image, and underneath that is the Nav. They are square images with rollover properties, and they are in a <ul>. The problem is, no matter what I try, I cannot get them to be centered in the page, they always line up to the left.

 

They need to remain side-by-side, not stacked, so the <li> items are floated left. Even when I try wrapping the <ul> in a <div> and setting the margin-left and right to auto, I see no effects.

 

How can I get this bugger to be centered? Here is the CSS:

 

div.cssmenu {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    }

ul.cssmenu {
    list-style: none;
    padding: 0px;
    position: inherit;
    }


ul.cssmenu li {
    float: left;
    }

ul.cssmenu li a {
    display: block;
    width: 111px;
    height: 109px;
    }

 

and here is the section that creates the Nav:

 

<div class="cssmenu"><ul class="cssmenu">
    <li class="sidehome"><a href="http://carolinaines.com/blog" title="Home"></a></li>
    <li class="sideabout"><a href="http://carolinaines.com/blog/about" title="Blog"></a></li>
    <li class="sidegallery"><a href="http://flickr.com/carouselambra86" target="_blank" title="Contact"></a></li>
    <li class="sidearchive"><a href="http://carolinaines.com/blog/links" class="selected" title="Home"></a></li>
    <li class="sidearchives"><a href="http://carolinaines.com/blog/archives" title="Blog"></a></li>
    <li class="sidecontact"><a href="http://carolinaines.com/blog/contact" title="Contact"></a></li>
</ul>
</div>

 

 

Any help is greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/214429-help-aligning-in-a/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.