主菜单显示不正确?

时间:2019-06-25 09:17:17

标签: javascript html css blogger blogs

在我的博客网站上,主菜单的第二行显示不正确。第一行运行正常,第二行也运行正常,但是当我将鼠标指针移到第二行按钮上而不是显示时,但第二行仍然无法正确显示白色。 我的网站链接-Click Here HTML代码-

.social-text .snapchat a:after {
    content: "Snapchat"
}

.social-text .email a:after {
    content: "Email"
}

.social-text .external-link a:after {
    content: "WebSite"
}

#header-wrap {
    position: relative;
    margin: 0
}

.header-header {
    background-color: #fff;
    width: 100%;
    height: 90px;
    position: relative;
    overflow: hidden;
    padding: 30px 0
}

.header-header .container {
    position: relative;
    margin: 0 auto;
    padding: 0
}

.header-logo {
    position: relative;
    float: left;
    width: auto;
    max-width: 120px;
    max-height: 100px;
    margin: 0;
    padding: 0px 0
}

.header-logo .header-image-wrapper {
    display: block
}

.header-logo img {
    max-width: 120%;
    max-height: 150px;
    margin: 0;
    margin-left: 70px
}

.header-logo h1 {
    color: $(title.color);
    font-size: 36px;
    line-height: 60px;
    margin: 0
}

.header-logo p {
    font-size: 12px;
    margin: 5px 0 0
}

.header-ads {
    position: relative;
    float: right
}

.header-ads .widget>.widget-title {
    display: none
}

.header-ads .widget {
    max-width: 100%
}

.header-ads .widget .widget-content {
    width: 728px;
    max-width: 100%;
    max-height: 90px;
    line-height: 1
}

.header-menu {
    position: relative;
    width: 100%;
    height: 46px;
    z-index: 10;
    font-size: 13px;
    margin: 0;
    background-color: $(main.dark.color);
    border-top: 2px solid $(main.color)
}

.header-menu .container {
    position: relative;
    margin: 0 auto;
    padding: 0
}

#main-menu .widget,
#main-menu .widget>.widget-title {
    display: none
}

#main-menu .show-menu {
    display: block
}

#main-menu {
    position: relative;
    height: 46px;
    z-index: 15
}

#main-menu ul>li {
    float: left;
    position: relative;
    margin: 0;
    padding: 0;
    transition: background .17s
}

#main-menu #main-menu-nav>li:hover,
#main-menu #main-menu-nav>li.li-home {
    background-color: $(main.color)
}

#main-menu ul>li>a {
    position: relative;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 46px;
    display: inline-block;
    margin: 0;
    padding: 0 15px;
    transition: color .17s ease
}

#main-menu #main-menu-nav>li>a {
    text-transform: uppercase;
    font-weight: 700
}

#main-menu ul>li:hover>a {
    color: #fff
}

#main-menu ul>li>ul {
    position: absolute;
    float: left;
    left: 0;
    top: 46px;
    width: 180px;
    background-color: $(main.dark.color);
    z-index: 99999;
    margin-top: 0;
    padding: 0;
    border-top: 2px solid $(main.color);
    visibility: hidden;
    opacity: 0
}

#main-menu ul>li>ul>li>ul {
    position: absolute;
    float: left;
    top: 0;
    left: 100%;
    margin: -2px 0 0
}

#main-menu ul>li>ul>li {
    display: block;
    float: none;
    position: relative
}

#main-menu ul>li>ul>li:hover {
    background-color: $(main.color)
}

#main-menu ul>li>ul>li a {
    display: block;
    height: 36px;
    font-size: 13px;
    color: #fff;
    line-height: 36px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 15px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all .17s ease
}

#main-menu ul>li>ul>li:hover>a {
    color: #fff
}

#main-menu ul>li.has-sub>a:after {
    content: '\f107';
    float: right;
    font-family: FontAwesome;
    font-size: 12px;
    font-weight: 400;
    margin: 0 0 0 5px
}

#main-menu ul>li>ul>li.has-sub>a:after {
    content: '\f105';
    float: right;
    margin: 0
}

#main-menu .mega-menu {
    position: static!important
}

#main-menu .mega-menu>ul {
    width: 100%;
    box-sizing: border-box;
    padding: 20px 10px
}

#main-menu .mega-menu>ul.mega-menu-inner {
    overflow: hidden
}

#main-menu ul>li:hover>ul,
#main-menu ul>li>ul>li:hover>ul {
    visibility: visible;
    opacity: 1
}

#main-menu ul ul {
    transition: all .25s ease
}

.mega-menu-inner .mega-item {
    float: left;
    width: 20%;
    box-sizing: border-box;
    padding: 0 10px
}

.mega-menu-inner .mega-content {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0
}

.mega-content .post-image-wrap {
    width: 100%;
    height: 120px
}

.mega-content .post-image-link {
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
    position: relative;
    overflow: hidden;
    padding: 0
}

.mega-content .post-title {
    position: relative;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5em;
    margin: 7px 0 5px;
    padding: 0
}

.mega-content .post-title a {
    display: block;
    color: #fff;
    transition: color .17s
}

.mega-content .post-title a:hover {
    color: $(title.hover)
}

.mega-content .post-meta {
    font-size: 11px
}

.no-posts {
    float: left;
    width: 100%;
    height: 100px;
    line-height: 100px;
    text-align: center
}

.mega-menu .no-posts {
    line-height: 60px;
    color: $(title.color)
}

.show-search,
.hide-search {
    position: absolute;
    right: 0;
    top: 0;
    display: block;
    width: 46px;
    height: 46px;
    background-color: $(main.color);
    line-height: 46px;
    z-index: 20;
    color: #fff;
    font-size: 15px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background .17s ease
}

.show-search:before {
    content: "\f002";
    font-family: FontAwesome;
    font-weight: 400
}

.hide-search:before {
    content: "\f00d";
    font-family: FontAwesome;
    font-weight: 400
}

#nav-search {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 46px;
    z-index: 99;
    background-color: $(main.dark.color);
    box-sizing: border-box;
    padding: 0
}

#nav-search .search-form {
    width: 100%;
    height: 46px;
    background-color: rgba(0, 0, 0, 0);
    line-height: 46px;
    overflow: hidden;
    padding: 0
}

#nav-search .search-input {
    width: 100%;
    height: 46px;
    font-family: inherit;
    color: #fff;
}

2 个答案:

答案 0 :(得分:0)

1,您还有更多菜单项,因此必须减小字体大小,并从(#main-menu ul> li> a)中填充。

2,否则,您可以进行内部滚动。

答案 1 :(得分:0)

  .header-menu {
   position: relative;
   width: 100%;
   /* height: 46px; */
   z-index: 10;
   font-size: 13px;
   margin: 0;
   background-color: #384a5f;
   border-top: 2px solid #ffd012;
    }

   #main-menu {
   position: relative;
   /* height: 46px; */
   z-index: 15;
    }

   #main-menu ul{
   display:flex;
   flex-wrap:wrap;
   }

在您的CSS中将此代码替换为每个元素!我只是删除了标题和主菜单的高度,以便div可以随着孩子的身高而扩展!为ul添加了display:flex,以便根据孩子的身高进行调整