HTML Span Attribute - W3Schools
Có thể bạn quan tâm
HTML span Attribute ❮ Previous All HTML Attributes Next ❯
❮ Previous All HTML Attributes Next ❯ ★ +1 Sign in to track progress
Definition and Usage
The span attribute defines the number of columns a <col> or <colgroup> element should span.
Applies to
The span attribute can be used on the following elements:
| Elements | Attribute |
|---|---|
| <col> | span |
| <colgroup> | span |
Examples
Col Example
Here, the first two columns should have a background color of red:
<table> <colgroup> <col span="2" style="background-color:red"> <col style="background-color:yellow"> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> </table> Try it Yourself »Colgroup Example
Set the background color of the first two columns using the <colgroup> span attribute:
<table> <colgroup span="2" style="background:red"></colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td>$49</td> </tr> </table> Try it Yourself »Browser Support
The span attribute has the following browser support for each element:
| Element | |||||
|---|---|---|---|---|---|
| col | Yes | Yes | Yes | Yes | Yes |
| colgroup | Yes | Yes | Yes | Yes | Yes |
Từ khóa » Thẻ Span Trong Html W3schools
-
HTML Span Tag - W3Schools
-
HTML Div Tag - W3Schools
-
CSS Column-span Property - W3Schools
-
HTML Li Tag - W3Schools
-
HTML Pre Tag - W3Schools
-
HTML Em Tag - W3Schools
-
HTML Br Tag - W3Schools
-
HTML Ul Tag - W3Schools
-
HTML B Tag - W3Schools
-
HTML Nav Tag - W3Schools
-
HTML A Tag - W3Schools
-
HTML Option Tag - W3Schools
-
HTML Strong Tag - W3Schools
-
HTML Label Tag - W3Schools