HTML Table text size and font style In traditional HTML web design rules, you can set the text size and font style respectively through the size and face in the HTML default font text tag . This writing method was quite common before HTML5 . by the HTML5 start, modify the table text size and fonts must use css to deal with, because HTML5 traditional HTML does not support font 's size and face attributes in css rules, the text size is modified font-size , modify the fonts Font-famliy is used . The following examples use HTML traditional font tags and css attributes to modify table text. Example 1: Use HTML font text tags to modify the table text size and font
<table border="1" cellpadding="5">
<tr>
<td><font size="5">This is the text size of size = 5</font></td>
<td><font face= "DFKai-sb">This is the italics font</font></td>
</tr>
</table>
Present resultsThis is the text size with size = 5 | This is the italics font |
The table in Example 1 has two fields. The field on the left uses HTML ’s font size attribute to mark the text as a size of 5. It looks larger than other text on the webpage. The field on the right uses The face attribute of font marks the text as italics. For the size and face attributes of font , please refer to the detailed explanation of the following article.- HTML font text
- HTML font change setting face
As mentioned in the first paragraph, in order to comply with the latest HTML5 web design standards, the text size and font in the table must be designed with css . Example 2 provides such a design method, except that each can be designed like Example 1. With different text styles in the field, you can also set the text style of the entire table at one time, which is very efficient.Example 2: Use CSS font-size and font-family to modify the table text size and font<table border="1" style="font-size:18px;font-family:serif;" cellpadding="5">
<tr>
<td>This is the default text style for the table</td>
<td>< span style="font-size:13px;">This is the 13px text size</span></td>
<td><span style="font-family:DFKai-sb">This is the standard font type< /span></td>
</tr>
</table>
Present resultsThis is the default text style of the table | This is 13px text size | This is the standard italics font |
In the second example, the grammar "style="font-size:18px;font-family:serif;"" is added at the beginning of the table tag, which means that the size of all text in the entire table is preset to 18px, and the font type use serif, this is the traditional HTML the font tag can not do high-efficiency design approach, then we in the three fields of the table, respectively, using the default text style, modify the size of 13px (font-size: 13px; ) , The font is changed to standard font (font-family:DFKai-sb;), you can clearly see that as long as any column or paragraph of text in the table is wrapped with a span tag, you can specially make a different style for the text Design, these two css introductions to text modification can be read.- CSS font-size text size
- CSS font-family font
What I want to remind here is that the font of "Biao Kai Ti" belongs to the default basic font of Windows. If it is a non-windows operating system, such as Apple's iOS, Google's Android or Linux operating system, it may not be displayed normally. About this The problem is that there is a safer approach in the introduction to css font-famliy font design above .
Post a Comment
0 Comments