gpt4 book ai didi

html - 将菜单项对齐到 div 的底部而不是顶部

转载 作者:太空宇宙 更新时间:2023-11-03 20:17:22 25 4
gpt4 key购买 nike

我正在为网站开发菜单。当我们在选定的页面上时(比如说主页),我对选定的元素菜单(主页)有一个不同的类,以便能够以不同的方式设置它的样式。我需要增加当前所选页面的高度,但是,当我这样做时,所有菜单项都与 div 的顶部对齐。我想将它们对齐到 div 的底部。

了解一下,Here is a link to an EXAMPLE

CSS:

    .main-navigation {
position: absolute;
bottom: 0;
z-index: 11;
left: 16px;
background-color: #ff0;
}

article, aside, footer, header, hgroup, main, nav, section {
display: block;
}

#page_wrapper, #footer {
text-align: left;
}

body {
text-align: center;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
color: #000;
}

.main-navigation ul {
list-style: none;
margin: 0 0 0 10px;
padding: 0;
}

ul, menu, dir {
display: block;
list-style-type: disc;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
-webkit-padding-start: 40px;
}

.main-navigation li.current-menu-item {
background-color: #DDDBD8;
height: 41px;
}

.main-navigation li {
margin-top: 14px;
width: 110px;
background: white;
margin: 0 0px 0 3px;
float: left;
height: 27px;
text-transform: uppercase;
text-align: center;
font-size: 13px;
padding: 12px 5px 0 5px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
background: #eeeeee;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJod…EiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc));
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 );
}

.main-navigation ul {
list-style: none;
}

.main-navigation li.current-menu-item a {
text-decoration: none;
font-size: 12px;
font-family: 'FuturaRegular';
color: #af8283;
}

.main-navigation li a {
text-decoration: none;
font-size: 12px;
font-family: 'FuturaRegular';
color: #5A4A42;
}

.site-header {
height: 200px;
position: relative;
}

HTML:

    <header id="header" class="site-header" role="banner">  
<nav id="site-navigation" class="main-navigation" role="navigation">
<div class="menu-header-navigation-container"><ul id="menu-header-navigation" class="header-nav"><li id="menu-item-4" class="home menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-4"><a href="/">Home</a></li>
<li id="menu-item-5" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5"><a href="/news">News</a></li>
<li id="menu-item-8" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8"><a href="/shop">Shop</a></li>
<li id="menu-item-10" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-10"><a href="/about-the-show">About The Show</a></li>
<li id="menu-item-11" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-11"><a href="/contact-us">Contact Us</a></li>
</ul></div> </nav></header>

最佳答案

.main-navigation li.current-menu-item.menu-item{
margin-top:0px;
}

.main-navigation li.menu-item{
margin-top:14px;
}

jsfiddle

关于html - 将菜单项对齐到 div 的底部而不是顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18207551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com