我正在尝试为我的小型启动制作一个网站。现在的问题是我想制作一个背景颜色为白色的中心区域和一个背景颜色为浅灰色的区域。我制作了一张桌子,背景颜色为白色并在中间对齐,但它只显示在页面底部。怎么了?
<html>
<head>
<title>Memocups</title>
</head>
<body bgcolor="#d9d9d9">
<table align="center" width="50%" bgcolor="#ffffff">
<tr>
<p><h1>Memocups</h1><p>
<p><h3>What is a memocup?<h3><p>
<img src="images/img_1_cuponstump.jpg" width="540px" height="360px">
<p>
A memocups is a coffe mug wich has a customizable picture!<br> What makes memocups unique from all other mugs with pictures is <br>that you upload the picture you want to our website and we<br> will put it on the mug! So what are you waiting for the<br>perfect gift is only a few clicks away!</p>
</tr>
</table>
</body>
</html>
答案 0 :(得分:0)
以下是表格的格式:
<table width="50%" style="background-color:#fff;margin:0 auto;">
<tr>
<td>
<h1>Memocups</h1>
<h3>What is a memocup?</h3>
<img src="images/img_1_cuponstump.jpg" width="540px" height="360px">
<p>A memocups is a coffe mug wich has a customizable picture!<br> What makes memocups unique from all other mugs with pictures is <br>that you upload the picture you want to our website and we<br> will put it on the mug! So what are you waiting for the<br>perfect gift is only a few clicks away!</p>
</td>
</tr>
</table>
&#13;
我删除了标题周围的p
标记,因为它们不是必需的。另请注意,bgcolor
和align
已弃用,您应该使用background-color
和margin
/ float
CSS。还更正了未关闭的h3
标记,并添加了td
(表格单元格)。
也就是说,表格不是用于此数据的正确元素。你应该使用div。
答案 1 :(得分:0)
包含三列和两行的简单表。
<table border=1>
<tr>
<td>cell 1<td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
<tr>
<td>cell 4<td>
<td>cell 5</td>
<td>cell 6</td>
</tr>
</table>