Brief introduction and usage of Table and div

Brief introduction and usage of Table and div

Web front end 1

Student ID

Name

gender

age

01

Zhang San

male

20

02

Li Si

female

twenty one

Total number of people

60

Components of the form:

Title Header Body Footer

Table defines a table

<table border="1" cellspacing="0" cellpadding="0" align="center">
</table>

Caption defines the title of the table

<caption>web front end/caption>end 1<

Thead defines the header part

<thead>
				<tr>
					<th>Student Number</th>
					<th>Name</th>
					<th>Gender</th>
					<th>Age</th>
				</tr>
			</thead>

Tbody defines the body of the table

<tbody>
				<tr>
					<td>01</td>
					<td>Zhang San</td>
					<td>Male</td>
					<td>20</td>
				</tr>
				<tr>
					<td>02</td>
					<td>Li Si</td>
					<td>Female</td>
					<td>21</td>
				</tr>
				<tfoot>
					<tr>
						<td colspan="3">Total number of people:</td>
						<td>60</td>
					</tr>
				</tfoot>
			</tbody>

Tfoot defines the table footer, generally used to display summary information

<tfoot>
					<tr>
						<td colspan="3">Total number of people:</td>
						<td>60</td>
					</tr>
				</tfoot>

Tr defines a line

<tr>
					<th>Student Number</th>
					<th>Name</th>
					<th>Gender</th>
					<th>Age</th>
				</tr>

Th td defines data items (cells) th is generally used for table headers and has a bold style

Td is generally used for the main body, without bold style

<tr>
					<td>01</td>
					<td>Zhang San</td>
					<td>Male</td>
					<td>20</td>
				</tr>

Td rowspan and colspan define the number of rows and columns that a cell spans, respectively.

<td colspan="3">Total number of people:</td>

Cellspacing defines the spacing between tables

Cellpadding defines the margins of the table

<table border="1" cellspacing="0" cellpadding="10">

Div defines a division

<div style="width: 200px;height: 200px;background-color:skyblue";>

Features: Display block-level tags in a new line

The difference between block-level tags and inline tags:

Block-level tags take up the entire line. Inline tags are arranged in order from left to right.

Block-level tags: h1-h6 p ul ol li div table dl form

Inline tags: span a br label I em

Characteristics of block-level elements: display:block

  • Each block starts on a new line, and the following elements will start on a new line
  • The width, height, line height, inner and outer margins of the element are all configurable
  • If you don't set the width of an element, it is 100% of its parent container, unless you set the height

Characteristics of inline elements: display: inline

  • And other elements are on one line
  • You cannot set the width, height, line height, inner and outer margins of an element
  • The width of an element is the width of the text or image it contains and cannot be changed.

Characteristics of inline block elements: display: inline-block

  • And other elements are on one line
  • Width, height, line height, inner and outer margins can all be set

Summarize

This is the end of this article about the introduction and usage of Table and div. For more information about the introduction and usage of Table and div, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  Detailed explanation of the solution to the problem that the font in HTML cannot be vertically centered even with line-height

>>:  Solution to the problem of adaptive height and width of css display table

Recommend

A brief discussion on the correct posture of Tomcat memory configuration

1. Background Although I have read many blogs or ...

XHTML introductory tutorial: Application of table tags

<br />Table is an awkward tag in XHTML, so y...

Detailed explanation of the use of CSS3 rgb and rgba (transparent color)

I believe everyone is very sensitive to colors. C...

Beginners learn some HTML tags (1)

Beginners can learn HTML by understanding some HT...

Nginx implements dynamic and static separation example explanation

In order to speed up the parsing of the website, ...

Solution to using html2canvas to process Dom elements with Baidu map into images

Problem 1: Baidu Map uses tiled images (the map i...

Mini Program to Implement Text Circular Scrolling Animation

This article shares the specific code of the appl...

Detailed explanation of CSS BEM writing standards

BEM is a component-based approach to web developm...

Vue uses monaco to achieve code highlighting

Using the Vue language and element components, we...

Solution to the ineffectiveness of flex layout width in css3

Two-column layout is often used in projects. Ther...

Let's talk about the performance of MySQL's COUNT(*)

Preface Basically, programmers in the workplace u...