我想要我的頂部
logo
div中的元素居中。我不確定如何做到這一點。帶邊框和CSS對齊的問題我的
navigation
div與logo
div不匹配。即使我已將邊距設置爲0px,div之間仍有空間。由於某種原因,我的佔位符圖形在底部的填充比
logo
div中的其他任何位置都要多。我需要做些什麼來改變它?
<!DOCTYPE html>
<html>
<head>
<title>css example</title>
<style type="text/css">
#logo {
background-color: black;
width: 100%;
color: rgb(255,200,0);
margin: 0px;
}
#logo p {
display: inline;
}
#logo h2 {
display: inline;
}
#logo a {
float: right;
color: rgb(255, 200, 0);
text-decoration: none;
font-size: 1.25em;
padding: 10px;
}
#navigation {
background-color: rgb(255,200,0);
width: 100%;
margin: 0px;
}
body {
margin: 0px;
font-family: Arial, Helvetica, Verdana;
}
</style>
</head>
<body>
<div id="logo">
<p>
<img src="picture.jpg" >
</p>
<h2>SUBSCRIBER PORTAL</h2>
<a href="#">LOG-IN </a>
<a href="#">CONTACT US </a>
</div>
<div id="navigation">
<p>
This is just a navigation test.
</p>
</div>
<div id="contents">
<p>This is just some dummy text. Dummy. </p>
</div>
</body>
</html>
你想讓它看起來像什麼? http://jsfiddle.net/ExplosionPIlls/qTyGn/ – 2013-02-19 01:04:26
我希望圖像在垂直居中後直接在h2的左列。我希望兩個標籤也垂直居中,但是對齊。 – JimRomeFan 2013-02-19 01:38:44
您提供的導航欄(#logo)的屬性爲'width:100%;'。你想要它居中?以什麼爲中心?視口? – 2013-02-19 03:39:51