Chapter 4 CSS table and list-original of water

Source: Internet
Author: User
Chapter 4 CSS tables and lists-original learning points of water:

1. Table Style

2. List Style

3. Other functions

Lecturer: Li Yanhui

This chapter mainly discusses CSS tables and lists in HTML5. The style settings of tables and lists allow more diversified display of tables and lists.

I. Table Style

The table has five unique styles. The style sheets are as follows:

1. border-collapse

table {    border-collapse: collapse;} 

Explanation: adjacent borders of cells are merged.

2. border-spacing

Value

Description

CSS version

Length Value

0 indicates the spacing, and other CSS length values are used.

2

table {    border-spacing: 10px;}

Explanation: it is valid only when border-collapse: separate; is used. The spacing cannot be merged because it is set.

3. caption-side

Value

Description

CSS version

Top

Default value. The title is above

2

Bottom

The title is below

2

table {    table-layout: fixed;}

Explanation: After the content is too long, the entire cell is not stretched.

4. empty-cells

Value

Description

CSS version

Show

Default Value: display the border

2

Hide

Do not show borders

2

table {    empty-cells: hide;}

Explanation: if the cell content is empty, the border is hidden.

5. table-layout

Value

Description

CSS version

Auto

Default value. When the content is too long, the entire cell is stretched.

2

Fixed

When the content is too long, the entire cell is not stretched.

2

table {  table-layout: fixed;}

Explanation: After the content is too long, the entire cell is not stretched.

Ii. List Style

The list has four unique styles. The style sheet is as follows:

1. list-style-type

ul {    list-style-type: square;}

Explanation: The tag type of the List prefix, which is in CSS1. The CSS2 version also contains prefixes such as Japanese, Armenia numbers, and Greek. If you are interested, refer to the CSS manual.

2. list-type-position

Value

Description

CSS version

Outside

Default Value, marked outside the content box

1

Inside

Mark Inside the content box

1

ul {    width: 120px;    list-style-position: inside;}

Description: The tag is located inside the content box.

3. list-type-image

Value

Description

CSS version

None

Do not use images

1

Url

Use images through URLs

1

ul {    list-style-image: url(bullet.png);}

Note: use an image as a prefix.

4. list-style

ul {    list-style: lower-alpha inside url(bullet.png);}

Explanation: abbreviated form.

Iii. Other functions

In

Medium
Cell, we can use the text-align attribute horizontal alignment, but vertical alignment won't work. CSS provides the vertical-align attribute for vertical alignment.

Value

Description

CSS version

Baseline

Align content objects with baselines

1

Top

Align content objects with the top

1

Middle

Align content objects with the center

1

Bottom

Align content objects with the bottom

1

table tr td {    vertical-align: bottom;}

Explanation: vertically alignment the content objects in cells.

Value

Description

CSS version

Sub

Vertical align text subscript

1

Super

Vertical Alignment

1

b {    vertical-align: super;}

Description: Set up the text upper and lower mark.

Value

Description

CSS version

Length Value

Set the upper and lower offset, which can be a negative value.

1

Percentage

Same as above

1

p span {    vertical-align: -200px;}

Explanation: Negative values go down and positive values go up. If the default baseline is above, a negative number is used. If the default baseline is below, a positive value is used.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.