我试图将fofam(h1)
置于页面中心。但由于nav
和logo
,我遇到了麻烦。救命?我一直试图修复它一段时间,但我似乎无法让它工作。我试过内联等等。
<style>
header {
height:300px;
margin:0 auto;
background:#21628c;
font-family:arial;
text-transform:uppercase;
}
div.logo svg{
float:left;
padding:10px 30px;
display:inline-block;
}
nav{
float:right;
color:#000000;
display:inline-block;
padding: 20px 20px;
}
nav a{
margin-left:30px;
color:black;
}
nav a:hover{
color:white;
font-size:20px;
}
h1{
color:white;
font-size:72px;
text-align:center;
display:inline-block;
position:relative;
}
h1 span{
border:10px solid white;
padding: .2em .5em;
}
p.descripton{
text-align:center;
color:white;
}
</style>
<header>
<title>Mikhaila</title>
<div class="logo"><svg...</svg></div>
<nav>
<a href="">Mission</a>
<a href="">Events</a>
<a href="">Contact Us</a>
</nav>
<h1><span>FOFAM</span></h1>
<p class="descripton">Friends of Free Arts Minnesota</p>
</header>
答案 0 :(得分:3)
将h1
宽度设置为100%,如下所示:
h1{
color:white;
font-size:72px;
text-align:center;
display:inline-block;
position:relative;
width:100%; /*Add this*/
}