gpt4 book ai didi

html - Bootstrap 如何从标题中删除填充?

转载 作者:太空宇宙 更新时间:2023-11-04 10:00:49 25 4
gpt4 key购买 nike

我想为我的标题菜单创建一个事件类我尝试删除标题中所有元素的顶部和底部填充,但没有任何效果。

这是我的代码:

<header>
<nav class="navbar navbar-default">
<div class="container-fluid header-custom">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img alt="Climatherm" src="img/home.png"></a>
</div>
<p class="navbar-text pull-right hidden-xs hidden-sm">09 99 99 99 99</p>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><span><a href="#">Plomberie Sanitaires</a></span></li>
<li class="active"><span><a href="#">Chauffage Climatisation</a></span></li>
<li class="active"><span><a href="#">nouvelles énergies</a></span></li>
<li class="active"><span><a href="#">dépannage maintenance</a></span></li>
<li class="active"><span><a href="#">Partenaires</a></span></li>
<li class="active"><span><a href="#">nous Contacter</a></span></li>
</ul>
</div>
</div>
</nav>
</header>

我的CSS代码

body{
font-family: 'Roboto', sans-serif;
max-width: 1200px;
margin-left:auto;
margin-right:auto;
}

.navbar-default {
background-color: #ed1c24;
border:none;
border-radius:0px;
}

.header-custom{
max-width:1000px;
padding-top:0px;
padding-bottom:0px;
}


.navbar-text{
font-size: 18px;
font-weight: 700;
color:#fff!important;
background-color:#d80109;
border-radius:18px;
padding:8px 20px 8px 30px;
margin-top:8px;
margin-bottom:auto;
}

.navbar-text::before{
content: url(../img/contact.png);
display:inline-block;
opacity: 1;
transform:translate(-13px, 4px);
}

.navbar-default .navbar-nav>li>span>a {
color: #fff;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
}

.navbar-nav{
padding: 0;
text-transform: uppercase;
}

.navbar-nav li {
display: inline-block;
list-style: none;
margin-left: 10px;
}
.navbar-nav li {
max-width: 110px;
line-height: 40px;
height: 40px;
background-color: #000;
}
.navbar-nav li span {
display: -moz-inline-box; /* FF2 or lower */
display: inline-block; /* FF3, Opera, Safari */
line-height: normal;
vertical-align: middle;
text-align: center;
}
.navbar-nav li span {
*display : inline; /* haslayout for IE6/7 */
}

结果是:

results of my code

我想做成这样:

Result expected

我尝试在不同的论坛和此处搜索解决方案,但没有任何效果。

最佳答案

这个方案可行吗? fiddle example

我将按钮的高度设置为与容器相同(50 像素而不是 40 像素)。

.navbar-nav li {
max-width: 110px;
line-height: 50px;
height: 50px;
background-color: #000;
}

关于html - Bootstrap 如何从标题中删除填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38349512/

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