H2不会低于H1。
我正在为一个客户建立一个网站,并希望导航栏具有以下对齐方式:左侧的图标,左侧的图标H1,右侧的H2。我已经完成了前两个部分,但是我的H2不会在H1以下移动。谁能帮我解决这个问题?
#header-nav {
width: 100%;
background-color: #3985BA;
border-radius: 0;
border: 0;
}
#logo {
background: url('../images/piano.png') no-repeat;
width: 200px;
height: 200px;
}
.navbar-brand {
padding-top: 25px;
text-align: center;
}
.navbar-brand h1 {
text-transform: uppercase;
font-family: bebas-neue, sans-serif;
text-shadow: 1px 1px 1px #222;
line-height: .75;
}
.navbar-brand span {
text-transform: uppercase;
color: #A7D8DC;
margin-top: 15px;
font-weight: 600;
}
.navbar-brand a:hover,.navbar-brand a:focus {
color: #04292C;
text-decoration: none;
}
#header1 {
color: #04292C;
}
<header>
<nav id='header-nav' class='navbar navbar-default'>
<div class='container'>
<div class='navbar-header'>
<a href="index.html" class='float-left'>
<div class='d-none d-sm-none d-md-none d-lg-block d-xl-block' id='logo' alt='piano logo'></div>
</a>
<div class='navbar-brand'>
<a href='index.html' class='float-left' id='header1'><h1>Sandra's Studio</h1></a>
<p>
<span id='header2'>Cumming, GA</span>
</p>
</div>
</div>
</div>
</nav>
</header>
答案 0 :(得分:0)
这是您想要的吗?
我用connect.sid
包裹了a
标签,然后添加了h1
类以清除浮点数。
clearfix
<h1 class="clearfix">
<a href='index.html' class='float-left' id='header1'>
Sandra's Studio </a>
</h1>
#header-nav {
width: 100%;
background-color: #3985BA;
border-radius: 0;
border: 0;
}
#logo {
background: url('../images/piano.png') no-repeat;
width: 200px;
height: 200px;
}
.navbar-brand {
padding-top: 25px;
text-align: center;
}
.navbar-brand h1 {
text-transform: uppercase;
font-family: bebas-neue, sans-serif;
text-shadow: 1px 1px 1px #222;
line-height: .75;
}
.navbar-brand span {
text-transform: uppercase;
color: #A7D8DC;
margin-top: 15px;
font-weight: 600;
}
.navbar-brand a:hover,
.navbar-brand a:focus {
color: #04292C;
text-decoration: none;
}
#header1 {
color: #04292C;
}