<!DOCTYPE html>
    <html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
    <head>
<title>Thẻ HTML</title>
<meta name="description" content="Thẻ HTML - Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;www.nguoicodonvn2008.info&#x002F;vi&#x002F;news&#x002F;savefile&#x002F;kien-thuc-may-tinh&#x002F;the-html-8406.html">
<meta name="author" content=".: Nguoicodonvn2008.info - Cõi lòng người cô đơn :.">
<meta name="copyright" content=".: Nguoicodonvn2008.info - Cõi lòng người cô đơn :. [admin@nguoicodonvn2008.info]">
<meta name="robots" content="index, archive, follow, noodp">
<meta name="googlebot" content="index,archive,follow,noodp">
<meta name="msnbot" content="all,index,follow">
<meta name="generator" content="NukeViet v4.5">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="Thẻ HTML">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;www.nguoicodonvn2008.info&#x002F;vi&#x002F;news&#x002F;savefile&#x002F;kien-thuc-may-tinh&#x002F;the-html-8406.html">
<meta property="og:site_name" content=".&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.">
<meta property="og:url" content="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/the-html-8406.html">
<link rel="shortcut icon" href="https://www.nguoicodonvn2008.info/favicon.ico">
<link rel="canonical" href="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/the-html-8406.html">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/" title="Tin Tức" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/karaoke-dual/" title="Tin Tức - Karaoke Dual" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/nhac-tre/" title="Tin Tức - Nhạc trẻ" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tru-tinh/" title="Tin Tức - Trữ tình" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/nuoc-ngoai/" title="Tin Tức - Nước ngoài" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/remix/" title="Tin Tức - Remix" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tam-su-tinh-yeu/" title="Tin Tức - Tâm sự tình yêu" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tho-suu-tam/" title="Tin Tức - Thơ sưu tầm" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/cuoc-song/" title="Tin Tức - Cuộc sống" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/phan-mem/" title="Tin Tức - Phần mềm" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/kien-thuc-may-tinh/" title="Tin Tức - Kiến thức máy tính" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/hoc-tap/" title="Tin Tức - Học tập" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/tai-lieu/" title="Tin Tức - Tài liệu" type="application/rss+xml">
<link rel="alternate" href="https://www.nguoicodonvn2008.info/vi/news/rss/de-thi/" title="Tin Tức - Đề thi" type="application/rss+xml">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/assets/css/font-awesome.min.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/bootstrap.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/style.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/style.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/news.css" type="text/css">
<link rel="preload" as="style" href="https://www.nguoicodonvn2008.info/themes/default/css/custom.css" type="text/css">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/jquery/jquery.min.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/language/vi.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/DOMPurify/purify3.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/global.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/assets/js/site.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/news.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/main.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/custom.js" type="text/javascript">
<link rel="preload" as="script" href="https://www.nguoicodonvn2008.info/themes/default/js/bootstrap.min.js" type="text/javascript">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/bootstrap.non-responsive.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/style.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://www.nguoicodonvn2008.info/themes/default/css/news.css">
<link rel="stylesheet" href="https://www.nguoicodonvn2008.info/themes/default/css/custom.css">
<style type="text/css">
	body{background: #fff;}
</style>
    </head>
    <body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">.&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.</h2>
		<p class="pull-right"><a title=".&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;." href="https://www.nguoicodonvn2008.info/">https://www.nguoicodonvn2008.info</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>Thẻ HTML</h1>
		<ul class="list-inline">
			<li>Chủ nhật - 26/05/2024 21:53</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
		</div>
				<div class="imghome">
			<img alt="Thẻ HTML" src="https://st.quantrimang.com/photos/image/2018/06/29/html-input-attribute-size-80x80-znd.jpg" width="460" class="img-thumbnail" />
		</div>
		<div class="clear"></div>
		<div id="bodytext" class="clearfix">
			<h2>Định nghĩa và cách sử dụng thẻ &lt;th&gt;</h2>

<p>Thẻ &lt;th&gt; xác định ô tiêu đề trong bảng HTML. Ví dụ về một bảng HTML đơn giản có 3 hàng, 2 ô tiêu đề và 4 ô dữ liệu:</p>

<pre id="pre0">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Month&lt;/th&gt;
    &lt;th&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;February&lt;/td&gt;
    &lt;td&gt;$80&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</pre>

<p>Một bảng HTML có hai loại ô:</p>

<ul>
	<li>Ô tiêu đề - chứa thông tin tiêu đề (được tạo bằng phần tử&nbsp;<code>&lt;th&gt;</code>)</li>
	<li>Ô dữ liệu - chứa dữ liệu (được tạo bằng&nbsp;<a href="https://quantrimang.com/hoc/the-html-td-202197" title="Thẻ HTML &lt;td&gt;">phần tử &lt;td&gt;</a>)</li>
</ul>

<p>Theo mặc định, văn bản trong phần tử&nbsp;<code>&lt;th&gt;</code>&nbsp;được in đậm và căn giữa, văn bản trong phần tử&nbsp;<code>&lt;td&gt;</code>&nbsp;là văn bản thông thường và được căn trái.</p>

<h2>Hỗ trợ trình duyệt</h2>

<table border="1">
	<tbody>
		<tr>
			<th rowspan="2">Phần tử<br />
			&lt;th&gt;</th>
			<th title="Chrome">Google Chrome</th>
			<th title="Internet Explorer / Edge">MS Edge</th>
			<th title="Firefox">Firefox</th>
			<th title="Safari">Safari</th>
			<th title="Opera">Opera</th>
		</tr>
		<tr>
			<td>Có</td>
			<td>Có</td>
			<td>Có</td>
			<td>Có</td>
			<td>Có</td>
		</tr>
	</tbody>
</table>

<h2>Thuộc tính</h2>

<table border="1">
	<tbody>
		<tr>
			<th>Thuộc tính</th>
			<th>Giá trị</th>
			<th>Mô tả</th>
		</tr>
		<tr>
			<td>abbr</td>
			<td><em>text</em></td>
			<td>Chỉ định phiên bản rút gọn của nội dung trong ô tiêu đề</td>
		</tr>
		<tr>
			<td>colspan</td>
			<td><em>number</em></td>
			<td>Chỉ định số cột mà ô tiêu đề sẽ trải dài</td>
		</tr>
		<tr>
			<td>headers</td>
			<td><em>header_id</em></td>
			<td>Chỉ định một hoặc nhiều ô tiêu đề mà ô có liên quan đến</td>
		</tr>
		<tr>
			<td>rowspan</td>
			<td><em>number</em></td>
			<td>Chỉ định số lượng hàng mà ô tiêu đề sẽ trải dài</td>
		</tr>
		<tr>
			<td>scope</td>
			<td>col<br />
			colgroup<br />
			row<br />
			rowgroup</td>
			<td>Chỉ định xem ô tiêu đề là tiêu đề cho cột, hàng hay nhóm cột hoặc hàng</td>
		</tr>
	</tbody>
</table>

<h2>Thuộc tính Global</h2>

<p>Thẻ&nbsp;<code>&lt;th&gt;</code>&nbsp;cũng hỗ trợ&nbsp;<a href="https://quantrimang.com/hoc/thuoc-tinh-global-trong-html-190132" title="Thuộc tính Global trong HTML">thuộc tính Global trong HTML</a>.</p>

<h2>Thuộc tính sự kiện</h2>

<p>Thẻ&nbsp;<code>&lt;th&gt;</code>&nbsp;cũng hỗ trợ&nbsp;<a href="https://quantrimang.com/hoc/thuoc-tinh-su-kien-html-189761" title="Thuộc tính sự kiện HTML">thuộc tính sự kiện trong HTML</a>.</p>

<h2>Các ví dụ khác</h2>

<p>Cách căn chỉnh nội dung bên trong&nbsp;<code>&lt;th&gt;</code>&nbsp;(bằng&nbsp;<a data-type="internal" href="https://quantrimang.com/hoc/gioi-thieu-ve-css-152825" title="CSS là gì? Giới thiệu về CSS">CSS</a>):</p>

<pre id="pre1">
&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;
    &lt;th style=&quot;text-align:left&quot;&gt;Month&lt;/th&gt;
    &lt;th style=&quot;text-align:left&quot;&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;February&lt;/td&gt;
    &lt;td&gt;$80&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>
<iframe allow="autoplay" allowtransparency="true" aria-label="Advertisement" data-google-container-id="a!2" data-google-query-id="CNiUus3crIYDFSuH6QUdm14JSQ" data-load-complete="true" frameborder="0" height="0" hspace="0" id="aswift_1" marginheight="0" marginwidth="0" name="aswift_1" sandbox="allow-scripts allow-same-origin allow-forms allow-presentation" scrolling="no" tabindex="0" title="Advertisement" vspace="0" width="694"></iframe>

<p>Cách thêm màu nền vào ô tiêu đề bảng (bằng CSS):</p>

<pre id="pre2">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th style=&quot;background-color:#FF0000&quot;&gt;Month&lt;/th&gt;
    &lt;th style=&quot;background-color:#00FF00&quot;&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
 &lt;/table&gt;</pre>

<p>Cách đặt chiều cao của ô tiêu đề bảng (bằng CSS):</p>

<pre id="pre3">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th style=&quot;height:100px&quot;&gt;Month&lt;/th&gt;
    &lt;th style=&quot;height:100px&quot;&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách chỉ định không ngắt dòng trong ô tiêu đề bảng (bằng CSS):</p>

<pre id="pre4">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Month&lt;/th&gt;
    &lt;th style=&quot;white-space:nowrap&quot;&gt;My Savings for a new car&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách căn chỉnh dọc nội dung bên trong&nbsp;<code>&lt;th&gt;</code>&nbsp;(bằng CSS):</p>

<pre id="pre5">
&lt;table style=&quot;width:50%;&quot;&gt;
  &lt;tr style=&quot;height:100px&quot;&gt;
    &lt;th style=&quot;vertical-align:bottom&quot;&gt;Month&lt;/th&gt;
    &lt;th style=&quot;vertical-align:bottom&quot;&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách đặt độ rộng của ô tiêu đề bảng (bằng CSS):</p>

<pre id="pre6">
&lt;table style=&quot;width:100%&quot;&gt;
  &lt;tr&gt;
    &lt;th style=&quot;width:70%&quot;&gt;Month&lt;/th&gt;
    &lt;th style=&quot;width:30%&quot;&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách tạo tiêu đề bảng:</p>

<pre id="pre7">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Name&lt;/th&gt;
    &lt;th&gt;Email&lt;/th&gt;
    &lt;th&gt;Phone&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;John Doe&lt;/td&gt;
    &lt;td&gt;john.doe@example.com&lt;/td&gt;
    &lt;td&gt;123-45-678&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách tạo bảng có chú thích:</p>
<iframe allow="autoplay" allowtransparency="true" aria-label="Advertisement" data-google-container-id="a!3" data-google-query-id="CKewttDcrIYDFaqZ6QUdW2EFew" data-load-complete="true" frameborder="0" height="0" hspace="0" id="aswift_2" marginheight="0" marginwidth="0" name="aswift_2" sandbox="allow-scripts allow-same-origin allow-forms allow-presentation" scrolling="no" tabindex="0" title="Advertisement" vspace="0" width="694"></iframe>

<pre id="pre8">
&lt;table&gt;
  &lt;caption&gt;Monthly savings&lt;/caption&gt;
  &lt;tr&gt;
    &lt;th&gt;Month&lt;/th&gt;
    &lt;th&gt;Savings&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;January&lt;/td&gt;
    &lt;td&gt;$100&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;February&lt;/td&gt;
    &lt;td&gt;$80&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<p>Cách xác định các ô trong bảng trải rộng trên nhiều hàng hoặc một cột:</p>

<pre id="pre9">
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Name&lt;/th&gt;
    &lt;th&gt;Email&lt;/th&gt;
    &lt;th colspan=&quot;2&quot;&gt;Phone&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;John Doe&lt;/td&gt;
    &lt;td&gt;john.doe@example.com&lt;/td&gt;
    &lt;td&gt;123-45-678&lt;/td&gt;
    &lt;td&gt;212-00-546&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;</pre>

<h2>Cài đặt CSS mặc định</h2>

<p>Hầu hết mọi trình duyệt sẽ hiển thị phần tử&nbsp;<code>&lt;th&gt;</code>&nbsp;với các giá trị mặc định sau:</p>

<pre id="pre10">
th {
  display: table-cell;
  vertical-align: inherit;
  font-weight: bold;
  text-align: center;
}</pre>
		</div>
				<div id="author">
						<p>
				<strong>Nguồn tin:</strong>
				Quantrimang.com:
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/the-html-8406.html" title="Thẻ HTML">https://www.nguoicodonvn2008.info/vi/news/savefile/kien-thuc-may-tinh/the-html-8406.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; .&#x3A; Nguoicodonvn2008.info - Cõi lòng người cô đơn &#x3A;.
		</div>
		<div id="contact">
			<a href="mailto:admin@nguoicodonvn2008.info">admin@nguoicodonvn2008.info</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://www.nguoicodonvn2008.info/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
		</script>
		<div class="car-top">
  <span><img src="https://www.nguoicodonvn2008.info/themes/default/images/car.png" alt=""></span>
</div>
<script src="https://www.nguoicodonvn2008.info/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=-4,nv_my_abbr="EDT",nv_cookie_prefix="nv4c_e856T",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_recaptcha_ver=2,nv_recaptcha_sitekey="",nv_recaptcha_type="image",XSSsanitize=1;</script>
<script src="https://www.nguoicodonvn2008.info/assets/js/language/vi.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/DOMPurify/purify3.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/global.js"></script>
<script src="https://www.nguoicodonvn2008.info/assets/js/site.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/news.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/main.js"></script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/custom.js"></script>
<script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "Organization",
            "url": "https://www.nguoicodonvn2008.info",
            "logo": "https://www.nguoicodonvn2008.info/uploads/angel.gif"
        }
        </script>
<script src="https://www.nguoicodonvn2008.info/themes/default/js/bootstrap.min.js"></script>
<script type="text/javascript">
var $scrolltop = $('.car-top');
$scrolltop.on('click', function () {
    $('html,body').animate({
        scrollTop: 0
    }, 800);
    $(this).addClass("car-run");
    setTimeout(function(){ $scrolltop.removeClass('car-run');}, 1000);
    return false;
});
$(window).on('scroll', function ()
{ 
    if($(window).scrollTop() >= 200)
    {
        $scrolltop.addClass("show");
        $scrolltop.addClass("car-down");
    }
    else
    {
       $scrolltop.removeClass("show");
       setTimeout(function(){ $scrolltop.removeClass('car-down');}, 300);
    }
});
</script>
</body>
</html>