我试图让我的段落(#home)移动到灰色框的中间,但无论如何它都不会移动。我已经尝试将边距更改为填充,并使边距上下,甚至使其高得离谱,如1000.请帮助。这是我的代码:
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="BrokenRecordNew.css" />
<title>Broken Record</title>
</head>
<body>
<div id="tabsattop">
<p id="home">Home</p>
<a href="BrokenRecordNew.html"><img id="logo" src="http://www.freevector.com/site_media/preview_images/FreeVector-Antique-Record-Player.jpg"><a>
</div>
</body>
</html>
CSS:
html {
background: url("http://theband.hiof.no/band_pictures/band_mfbp_back.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#tabsattop{
background-color: black;
opacity: .8;
margin-top:-7px;
margin-right: -5px;
margin-left: -5px;
width: 1274px;
height: 75px;
}
#logo{
height: 75px;
margin-left:550px;
display:inline-block;
}
#home{
margin-left: 10px;
display:inline;
color:white;
font-size:25px;
font-family: sans-serif;
}
答案 0 :(得分:3)
使用display:inline
,您已删除了向其应用margin
或padding
的功能。移除display:inline
(或使用display:inline-block
代替),你应该好好去。