0

I'm creating my portfolio. While doing that I just come across with an error in the top menu. It's aligned to left. I tried my level best to solve that problem. I need that to be central aligned. Can anyone please help me? Url is http://jilsonthomas.com

Also footer is not extending to the stream sides. ( both left and right) please help....

Cheers...

1 Answer 1

2

You can center the menu by making the list an inline element with display: inline-block; and by specifying text-align:center; on it's parent div#menu.

#menu{
    ...
    text-align:center;
}

#menu ul{
    ...
    display:inline-block;
    margin:0;
    padding:0;
}

Another option would be to set a width on the list and keep it a block element and specify margins left/right auto, but that would be kinda hackish.

To solve the footer issue just remove the margin and padding on the body. It's the margin in this case, but it's good to remove them both. I'm not sure, but it may vary from browser to browser.

body{
    margin:0;
    padding:0;
}

Also you may want to use a CSS reset to avoid all sorts of problems like this one.

Hope this helps you,
Alin

Sign up to request clarification or add additional context in comments.

9 Comments

Is that like this ??? #menu{text-align:center;} #menu ul li{list-style-type:none;float:left;color:#bdbdbd;padding:0 10px; text-shadow:#FFF 1px 1px 1px; display: inline-block; } #menu ul li a{font-size:16px;color:#bdbdbd;font-weight:bold; opacity: 1; -webkit-transition: opacity 0.5s;} #menu ul li a:hover{color:#6e6d6d; opacity: 0.5; -webkit-transition: opacity 0.7s;}
+1, also make sure you get rid of the 40px left padding on your <ul> element to make it properly centered.
@DarthJDG Good advice. I added it to the answer. Thanks!
Also.. What about the footer portion ???? Did you noticed there is some black portion missing in both the left and right sides.. :(
@Jilson Forgot about the footer. I'll edit in a second. It's easy ;)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.