嘿,所以首先我对 HTML 很不满意。Div 把我搞糊涂了。现在我要做的是,我希望这两个框位于页面中间,它们之间大约 20px。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="FirstCSS.css">
<title>Services and Rates</title>
</head>
<body style="background-color:pink;">
<div id="top" align="center">
<header>
<h1 style="color:purple">Services and Rates</h1>
<nav>
<hr color="purple" width="80%">
<table style="color:purple">
<tr>
<td style="padding-right: 50px"><a href="mqhomepage.html">Home</a></td>
<td style="padding-right: 50px"><a href="mqaboutme.html">About Me</a></td>
<td style="padding-right: 50px"><a href="mqphotogallery.html">Photo Gallery</a></td>
<td><a href="mqservicesandrates.html">Services and Rates</td>
</tr>
</table>
<hr color="purple" width="80%">
</nav>
</div>
<div id="embroideryrates" class="centeredlistleft" >
<h3 style="color:purple" align="center"> Embroidery </h3>
<ul>
<li>Colored Towel (Non White)
<ul>
<li>$12</li>
</ul>
</li>
<li>White Towel
<ul>
<li>$8</li>
</ul>
</li>
</ul>
</div>
<div id="quiltingrates" class="centeredlistright">
<h3 style="color:purple" align="center"> Quilting </h3>
<ul>
<li>Custom Made Quilt
<ul>
<li>$400</li>
</ul>
</li>
<li>Batting
<ul>
<li>$75</li>
</ul>
</li>
<li> Lessons
<ul>
<li> $50/hour</li>
</ul>
</li>
</ul>
</div>
现在刺绣和绗缝的两个盒子在最左边和最右边。我似乎无法让他们居中。这是我的 CSS。
@charset "utf-8";
/* CSS Document */
.centeredlistleft {
width:300px;
margin:0 auto;
text-align:left;
border:2px solid;
float:left;
}
.centeredlistright {
width:300px;
margin:0 auto;
text-align:left;
border:2px solid;
float:right;
}
.body{
margin: 0;
padding:0;
text-align: center;
color: purple;;
}
我很确定我离这里很远,而且把事情复杂化了,但是 Div 标签对我来说从来没有意义,我似乎无法处理它。