在这个html中,表格出现在跨度的旁边 - 我如何强制跨度显示在表格的水平之下
<div>
<table align="right">
<tr>
<td>smthg</td>
</tr>
<tr>
<td>smthg</td>
</tr>
<tr>
<td>smthg</td>
</tr>
</table>
</div>
<div>
<div>
<span>smthg</span>
-
<span>smthg</span>
-
<span>smthg</span>
<hr />
</div>
</div>
答案 0 :(得分:2)
表格不再具有align
属性。移除align="right"
,跨度将显示在表格下方。
如果您想要右侧的表格,请使用css和float: right
并将clear: right
(清除浮动)添加到以下div中,使其位于表格下方。
<!DOCTYPE html>
<html>
<head>
<title>Some Title</title>
<style type="text/css">
table {
float: right;
}
#following {
clear: right;
}
</style>
</head>
<body>
<div>
<table>
<tr>
<td>smthg</td>
</tr>
<tr>
<td>smthg</td>
</tr>
<tr>
<td>smthg</td>
</tr>
</table>
</div>
<div id="following">
<div>
<span>smthg</span>
-
<span>smthg</span>
-
<span>smthg</span>
<hr />
</div>
</div>
</body>
</html>
答案 1 :(得分:0)
这是你要找的东西吗?
<body>
<div>
<div>
<span>smthg</span>
-
<span>smthg</span>
-
<span>smthg</span>
<hr />
</div>
</div>
<div>
<table align="right">
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
</table>
</div>
</body>