如何上述&lt使2号线; TD&GT; [英] How make 2 lines in <TD>
问题描述
我要显示TD两行
<td bgcolor="White" >
First Name
(on external website)
</td>
和它显示,彼此相邻。我想成为像下面。第一行大胆和二号线将是小字母。
And it is showing, next to each other. I want to be like below. 1st line bold and 2nd line will be small letters.
推荐答案
您可以添加一个&LT; BR /&GT;
来强制换行,并定义一些CSS类对于字体样式:
You could add a <br/>
to force a line break and define some CSS classes for the font-styling:
<style>
.name { font-weight: bold; }
.subtext { font-size: smaller; }
</style>
<td bgcolor="White" >
<span class="name">First Name</span> <br/>
<span class="subtext">(on external website)</span>
</td>
更新:
为了完整起见,我还包括其他人所说的:而是采用了&LT; BR /&GT;
元素,控制通过CSS的换行符。这样做的好处,您可以通过编辑CSS改变行为(删除换行符):
Update:
For completeness, I'm also including what others have suggested: instead of using a <br/>
element, control the line-break via CSS. This has the advantage, that you can change the behavior (remove the line-break) by simply editing the CSS:
<style>
.name { font-weight: bold; display:block; }
.subtext { font-size: smaller; }
</style>
<td bgcolor="White" >
<span class="name">First Name</span>
<span class="subtext">(on external website)</span>
</td>
而不是使用跨度
元素,你也可以使用 DIV
s,这在默认情况下的换行(但它可以通过设置显示被禁用:内联
中的CSS)。
Instead of using span
elements, you could also use div
s, which have the line-break by default (but it can be disabled by setting display:inline
in the CSS).
这篇关于如何上述&lt使2号线; TD&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!