我已将 div 标签添加到同一行的文本,因为我想添加鼠标悬停功能,但现在所有文本都在不同的行上。如何使所有文本都在同一行?
HTML:
<div style="margin-top:30px;" />
<center>
<table height="50" width="400" cellpadding="0" cellspacing="0">
<tr>
<td>
<center>
<hr size="1" color="#585858" width="82%"></hr>
</center>
<center>
<div class="about">
<font face="helvetica" size="2" color="#585858">About Us</div>
<div class="about">Accessibility</div>
<div class="about">Contact Us</div> </font></div>
<font face="helvetica" size="2" color="#585858">©2011 - Privacy
</font></center>
</center>
</td>
</tr>
</table>
</center>
CSS:
.about:hover {
font: 13px helvetica;
text-decoration: underline;
}
谢谢!
詹姆斯
最佳答案
div 会生成一个框,因此会生成一个新行,请尝试改用 span。
此外,您正在使用旧的、过时的 HTML 标记,例如字体或属性(例如高度/宽度)。 尝试找到一些关于 css 的好教程,并尽可能使用 css 而不是 html。
关于css - 添加div标签时如何使文本全部在同一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7740075/