gpt4 book ai didi

css - 更改字体大小并对齐导航栏品牌

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

我有一个工作正常的导航栏,但我希望导航栏品牌具有不同样式的字体和大小并垂直居中但是当我在不同的浏览器和媒体类型上查看它时它似乎改变了它的位置并且永远不会在中间,即在 iphone 和平板电脑上。

CSS代码是:

 a[href^=tel] { color: inherit; text-decoration: none; }
.navbar-default {
padding-left:0px;
padding-right:0px;
border: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
background-color: #00a3fe;
font-size: 14pt;font-weight: 400;}

a:hover {
text-decoration:none;
}


.nav.navbar-nav.navbar-right li a {
color: #ffffff;
}

.nav.navbar-nav.navbar-nav li a {
color: #ffffff;
}

.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
background-color: #49bdfe;
color: #FFFFFF;
}

.navbar-toggle, .icon-bar {
border:1px solid white;
background-color:white;
}

.navbar-toggle {
color: : white;
border: none;
background: transparent !important;
}
.navbar-toggle:hover {
background: transparent !important;
}

.navbar-toggle {
border: none;
background: transparent !important;
}
.navbar-toggle:hover {
background: transparent !important;
}
.navbar-toggle .icon-bar {
width: 22px;
transition: all 0.2s;
}
.navbar-toggle .top-bar {
transform: rotate(45deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
transform: rotate(-45deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
transform: rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
transform: rotate(0);
}

.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
padding: 10px 16px;
transition: all 0.4s ease 0s;
}

.btn-lg {
font-size: 18px;
line-height: 1.33;
border-radius: 6px;
}

.btn-primary {
color: #fff;
background-color: #49bdfe;
border-color: #357ebd;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.open .dropdown-toggle.btn-primary {
color: #fff;
background-color: #3276b1;
border-color: #285e8e;
}

html 是:

<nav class='navbar navbar-default'>
<div class='container'>
<div class='navbar-header'>
<button type='button' class = 'navbar-toggle collapsed' data-toggle = 'collapse' data-target = '#example-navbar-collapse'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar top-bar'></span>
<span class='icon-bar middle-bar'></span>
<span class='icon-bar bottom-bar'></span></button>
<span class='navbar-brand'>My Site</span>
</div>
<div class='collapse navbar-collapse' id = 'example-navbar-collapse'>
<ul class='nav navbar-nav'>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>About</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Get bids</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Register company</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Contact</a></li>
</ul>
<ul class='nav navbar-nav navbar-right'>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'><span class='glyphicon glyphicon-user'></span> Login</a></li>
</ul>
</div>
</div>
</nav>

最佳答案

你可以使用display: flex; align-items: center 保持垂直对齐。

a[href^=tel] { color: inherit; text-decoration: none; }
.navbar-default {
padding-left:0px;
padding-right:0px;
border: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
background-color: #00a3fe;
font-size: 14pt;font-weight: 400;}

a:hover {
text-decoration:none;
}


.nav.navbar-nav.navbar-right li a {
color: #ffffff;
}

.nav.navbar-nav.navbar-nav li a {
color: #ffffff;
}

.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
background-color: #49bdfe;
color: #FFFFFF;
}

.navbar-toggle, .icon-bar {
border:1px solid white;
background-color:white;
}

.navbar-toggle {
color: : white;
border: none;
background: transparent !important;
}
.navbar-toggle:hover {
background: transparent !important;
}

.navbar-toggle {
border: none;
background: transparent !important;
}
.navbar-toggle:hover {
background: transparent !important;
}
.navbar-toggle .icon-bar {
width: 22px;
transition: all 0.2s;
}
.navbar-toggle .top-bar {
transform: rotate(45deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
transform: rotate(-45deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
transform: rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
transform: rotate(0);
}

.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
padding: 10px 16px;
transition: all 0.4s ease 0s;
}

.btn-lg {
font-size: 18px;
line-height: 1.33;
border-radius: 6px;
}

.btn-primary {
color: #fff;
background-color: #49bdfe;
border-color: #357ebd;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.open .dropdown-toggle.btn-primary {
color: #fff;
background-color: #3276b1;
border-color: #285e8e;
}

.navbar-brand {
font: 24px cursive!important;
display: flex;
align-items: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class='navbar navbar-default'>
<div class='container'>
<div class='navbar-header'>
<button type='button' class = 'navbar-toggle collapsed' data-toggle = 'collapse' data-target = '#example-navbar-collapse'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar top-bar'></span>
<span class='icon-bar middle-bar'></span>
<span class='icon-bar bottom-bar'></span></button>
<span class='navbar-brand'>My Site</span>
</div>
<div class='collapse navbar-collapse' id = 'example-navbar-collapse'>
<ul class='nav navbar-nav'>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>About</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Get bids</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Register company</a></li>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'>Contact</a></li>
</ul>
<ul class='nav navbar-nav navbar-right'>
<li><a href='about.php' class='btn btn-primary btn-lg sharp' role='button'><span class='glyphicon glyphicon-user'></span> Login</a></li>
</ul>
</div>
</div>
</nav>

关于css - 更改字体大小并对齐导航栏品牌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43380407/

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