标签将表格分成一行一行,再用标签把每行分成一格一格。完全手写代码创建table是十分困难和低效的,而在网页制作软件中制作表格就如同Word一样简单,只需要选择行列之类的简单属性即可。但是我们可能会遇到自动做出的表格不符合要求,而需要在代码模式调整的可能,因此我们还是要大概了解XHTML表格标签的具体写法。
表格的边框(border)属性
标签可以有border属性。如果不设置border属性的值,在默认情况下,浏览器将不显示表格的边框。
表格练习
我们来建立一个四行两列的标签,代码如下:
一个格子 |
一个格子 |
一个格子 |
一个格子 |
一个格子 |
一个格子 |
一个格子 |
一个格子 |
in positioning. However, in fact, since using CSS layout often requires a lot of handwritten code work (commonly used web design software such as Dreamweaver does not perfectly support the display of divs), is still used by many websites as homepage layout, such as Google's More products page. table to locate. However, I personally recommend that you start using CSS to position web pages, because this is the direction of the development of the Web. Of course, replacing tables with CSS may cause you to run into a lot of trouble in the early days.
Table tag
In XHTML, the tag to create a table is . When writing code, we must first use the
tag to divide the table into rows and rows, and then use the tag to divide each row into cells. It is very difficult and inefficient to create a table with completely handwritten code. However, creating a table in web page production software is as easy as Word, and you only need to select simple attributes such as rows and columns. However, we may encounter the possibility that the automatically generated table does not meet the requirements and needs to be adjusted in the code mode. Therefore, we still need to have a general understanding of the specific writing method of XHTML table tags.
The border attribute of the table
tags can have border attributes. If you do not set the value of the border attribute, the browser will not display the table border by default.
Table practice
Let’s create a label with four rows and two columns. The code is as follows:
A gridA gridOne gridOne gridOne gridA gridA gridA grid td>
The display result of is as follows: Pay attention to the above code. There are 4 pairs of in total, corresponding to the 4 lines below. And each (row) has two cells. So it becomes a table with 4 rows and 2 columns.
a grid
a grid
a grid
a grid
a grid
a grid
a grid
a grid
Such a table is sufficient for listing information such as data, but tables used for positioning are usually more complex. Again, we do not recommend using tables for positioning, so we only briefly introduce here.
|
|