简体   繁体   中英

CSS DropDown Menu Not Aligned Correctly

I developed http://pizzli.com/millington for a client and used just CSS for the dropdown menus. They came out good, however the are aligned to the right for some reason. Take a look at the picture below. Any assistance would be appreciated.

在此处输入图片说明

hey i thing you want your dropdown navi is started left than you give to your li position relative and sub ul give to left and absolute properties as like this

Some change to your css file

#navigation li {
    float: left;
    list-style: none outside none;
    position: relative;
}

and this

#navigation li:hover ul {
    display: block;
    left: -16px;
    margin: 0;
    padding: 0;
    position: absolute;
}

try making the left: inherit; and then doing margin-left: xyz; to position the elements relative to the parent.
Note you might have to change the left: and margin-left: to right: and margin-right: , but this worked great for me, and I spent quite a long time figuring it out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM