html - 创建全宽下拉菜单

标签 html css wordpress

我打算用这种结构制作一个全宽下拉菜单(我以前从未做过)http://jsfiddle.net/cstEv/

使用我目前拥有的 css,我无法将子导航 ul 居中,因为 ul 定位原点是父级 li 的原点。 有谁知道如何让 ul .children#menu div 下居中?

最佳答案

我做了以下更改:

来自:

.children {
            display: none;
            width: 560px;
            min-height: 30px;
            position: absolute;
            left: -244px;
            top: 48px;
            text-align: left;
            background-color: #c7c7c7;
        }
.children  li {
            position: relative;
            float: left;
            margin-left: 20px;
        }

收件人:

.children{
            display: none;
            min-height: 30px;
            position: relative;
            text-align: left;
            top: 10px;
        }
        li:nth-child(3) .children{
            right: 252px;
        }
        li:last-child .children{
            right: 502px;
        }
        li:nth-child(3) .children  li {
            position: relative;
            float: left;
            width: 628px !important;
        }

        li:last-child .children li{
            position: relative;
            float: left;
            width: 628px !important;
        }

查看updated fiddle

关于html - 创建全宽下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15072332/

相关文章:

C# 使用 HTML Agility Pack 解析隐藏字段

插件更改页面后 HTML 布局和 CSS 不合适

javascript - 带有 Angular js 的 Jquery slider 无法正常工作

php - 浏览器滚动条无处可寻?

jquery - box-shadow 仅显示在图像的左侧

javascript - 使用 new Image() 在 JavaScript 中旋转图像

javascript - Polymer 2.0 纸张输入文件自定义样式

php - 解析MySQL准备语句

php - 具有完整性和跨源的 Wordpress 脚本

wordpress - 使用 wp_oembed_remove_provider() 删除 YouTube 嵌入