我正在尝试为我们公司的网站创建一个简单的“关于我们”页面,但我在 CSS 和 HTML 的对齐方面遇到了麻烦。基本思想是这样的:
--Pic-- --Text-
--Text-- --Pic-
--Pic-- --Text-
这是我创建的 HTML 代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="baseStyle.css">
<link rel="stylesheet" type="text/css" href="aboutUsStyles.css">
</head>
<body>
<div id="wrap">
<h1>who are we?</h1>
<ul id="nav">
<li><a href="index.html">Home</a></li>
<li><a href="ourProducts.html">Our Products</a></li>
<li><a href="FAQ.html">FAQs</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
<div id="content">
<div><p id="andypic">
<img src="http://img40.imageshack.us/img40/7106/testjdc.jpg"></p>
<p id="andyPicInfo">This is a test
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
</p>
</div>
<div><p id="evpic">
<img src="http://img40.imageshack.us/img40/7106/testjdc.jpg"></p>
<p id="andyPicInfo">This is a test
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
</p>
</div>
<div><p id="tannerpic">
<img src="http://img40.imageshack.us/img40/7106/testjdc.jpg"></p>
<p id="andyPicInfo">This is a test
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
testgfgfdfgdfgggggggggggggggggggggggggggggggg
</p>
</div>
</div>
</div>
</body>
</html>
这是两个 CSS 文件:
第一个文件:
#nav {
width: 100%;
float: left;
margin: 0 0 3em 0;
padding: 0;
list-style: none;
background-color: #f2f2f2;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc; }
#nav li {
float: left; }
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: #069;
border-right: 1px solid #ccc; }
#nav li a:hover {
color: #c00;
background-color: #fff; }
body {
background-color: #555;
font: small/1.3 Arial, Helvetica, sans-serif; }
#wrap {
width: 750px;
height: 900px;
margin: 0 auto;
background-color: #fff; }
h1 {
text-align: center;
font-size: 1.5em;
padding: 1em 8px;
color: #123;
background-color: #069;
margin: 0; }
#content {
padding: 0 30px 30px; }
#copyright {
text-align: center;
font-size: .75em; }
第二个文件:
#andypic{
float: left;
height: 240px;
width: 320px;
}
#evpic{
float: right;
height: 240px;
width: 320px;
}
#tannerpic{
float: left;
height: 240px;
width: 320px;
}
我现在所拥有的几乎没问题,但是这些行都是错误的,并且文本没有正确匹配。
现在我知道这在 SO 上看起来很奇怪,但现在看起来像这样: