Home > Web Front-end > HTML Tutorial > How much do you know about HTML table attributes? Come and find out more?

How much do you know about HTML table attributes? Come and find out more?

寻∝梦
Release: 2018-08-14 16:22:53
Original
4103 people have browsed it

How much do you know about HTML table attributes? Come and find out more? Table tags are widely used in HTML and are easy for beginners to start with. However, there are also some attributes that can greatly improve the functionality of tables. Applied properly, you'll find that it makes your pages clear and beautiful. Let's learn about the HTML table attribute.

What is a table & the role of a table

What is a table: It consists of some rectangular boxes called cells from left to right and top to bottom. The function of the

table arranged together in order: to display information in a certain structure.

How to use table

Define table:

Create table row:< /tr>

Create columns (cells):

Note: By default, the number of columns in each row is uniform.

Features of table:

1. Exclusive row

2. Adaptive width (determined by content)

table table attributes:

Attributes

  • width: Set the table width

  • height: Set the height of the table

  • ##align: Set the horizontal alignment of the table in its parent element, values: left,center,right

  • border: Border, border width, value in px, px can be omitted

  • cellpadding: cell inner margin

  •                  The distance between the cell border and the content

  • cellspacing: Cell margin

  • ## The distance between
  • bgcolor: Background color
Attribute

    1 .align: The horizontal alignment of the content of this line
  • 2.valign: The vertical alignment of the content of this line, values: top, middle, bottom
  • 3.bgcolor The text color of this line

Function: Define the title for the table

Position: Displayed in the center directly above the table

                              <table>
                 <caption>标题</caption>
                 <tr>
                    <td></td>
                     <td></td>
                 </tr>
               </table>
Copy after login

2. Row title or column title

Column title: Each column in the first row, bold, horizontal centering effect display

Row title: The first column in each row, bold, Horizontally centered effect display

Row (column) title:

The function is the same as
Attribute

    width
  • height
  • align
  • valign
  • bgcolor
  • colspan sets cells across columns
  • rowspan sets cells across rows
  • 3. Other tags in the table

1.

Exactly the same

table border merge:

Attribute: border-collapse

Value:

1.separate default value , separate border mode

2.collapse border merge mode

table border margin:

1.Function: Set the border between adjacent cells The distance between cells (similar to cellspacing)

2. Attribute: border-spacing

Value:

1. Take 1 value: indicating equal horizontal and vertical spacing

2. Take 2 values: the horizontal spacing represented by the first value

    and the vertical spacing represented by the second value                 Separated by a space between the two values ​​​​

3. Requirements

border-collapse must be separate

It must be valid in separated border mode

Hidden display effect:

Attribute: visibility:collap:se Used on table elements to delete a row or column without affecting the entire layout of the table

[Related recommendations]

Basic elements of html, allowing you to learn HTML from scratch

What is an HTML file? A preliminary understanding of HTML files


The above is the detailed content of How much do you know about HTML table attributes? Come and find out more?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template