2 replies [Last post]
meucat
meucat's picture
Offline
newbie
Last seen: 7 years 28 weeks ago
Timezone: GMT-3
Joined: 2015-04-21
Posts: 4
Points: 6

Hello People, I am new in this forum, so sorry any mistake I could initially make here.

I copied a tiny yet powerful CSS code to multi-level drop-down menu and adapted it to my pages, but I can´t make it center at top on page. Here the complete running codes http://jsfiddle.net/b06xf0xb

Actually it states at left side , you can check it by zooming executed right window , I tried all possible combinations of commands unsuccessfully, menu always will stand at left.

Thanks in advance for any idea.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 39 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Too much stuff thrown at the wall

nav ul {
    padding:0;
    margin:0;
    list-style: none;
    position: relative;
    text-align: center;
    }
 
/* Positioning the navigation items inline */
nav ul li {
    display:inline-block;
    text-align: left;
    background-color: #a0a0a0;
    white-space: nowrap;
    }

Don't float the li, set its text-align to left and don't use the margins. Set ul to {text-align: center;},

Test your menu at a number of different widths; you may find that drop-downs are user unfriendly where smaller browser widths cause overflow wrapping.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

meucat
meucat's picture
Offline
newbie
Last seen: 7 years 28 weeks ago
Timezone: GMT-3
Joined: 2015-04-21
Posts: 4
Points: 6

thanks very much

Hello Gary, thanks very much, it works !

For me is like magic.

I really don´t understand philosophy behind CSS3, too much directives, too much commands and too much parameters to make too much things. I never know which way should use to reach a goal.

Mig