Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How make 2 lines in <td>

Tags:

html

css

asp.net

I want to show two lines in <td>. And it is showing, next to each other.

 <td bgcolor="White">
   First Name
   (on external website)
 </td>

I want to be like below. 1st line bold and 2nd line will be small letters.

alt text

like image 965
James123 Avatar asked Dec 08 '22 01:12

James123


2 Answers

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>

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>

Instead of using span elements, you could also use divs, which have the line-break by default (but it can be disabled by setting display:inline in the CSS).

like image 93
M4N Avatar answered Dec 24 '22 20:12

M4N


<td bgcolor="White" >
    <span style="font-weight:bold;">First Name</span>  <br/>
    <span style="font-size:6px;">(on external website)</span>
</td>

like that I suppose

like image 24
bevacqua Avatar answered Dec 24 '22 21:12

bevacqua