How do I add a border style to a CSS table? CSS table Border Style summary (with full instance)

Source: Internet
Author: User
This article is mainly about CSS table to add border style, here is a summary of CSS table border style, as well as a complete example of CSS table border. Let's take a look at this article next.

First, let's look at how CSS can be used to add a border to a table:

Remember when we were learning HTML tables, we also learned to use the border property to add borders to a table, and now we're going to look at how border is used in CSS styles:

Let's look at the properties of the Add border: Border-style property. Now let's look at a complete example:

<!doctype html><html><head><meta charset= "Utf-8" ><title>topic.alibabacloud.com< /title><style>table,td{border-style:dotted}</style></head><body><table><tr ><td>11</td><td>22</td></tr><tr><td>22</td><td>44< /td></tr></table><table><tr><td>11</td><td>22</td></tr ><tr><td>22</td><td>44</td></tr></table></body></html >

Do you know the effect of this code above? Let's look at the results together:

Look at everyone should understand, here is still to explain the use of code:

Border-style: Defines the table and border (table table border, if you use table{} This will not have so many lines, will only appear the border line, the middle of those lines will not appear, so here I added TD tag, let it also show in the inside of the line)

    • The dotted:dotted attribute defines a point border, so there are so many points. (Of course, there are other properties, but also the display border, we look together)

    • Solid:solid property defines a solid border

    • Double:double property defines a double-line border

    • Dashed:dashed property defines a dashed border

After reading these people should be able to understand, I only introduced a kind of dot border, as well as a double-line border and dotted border, and so on, we can also try a one, see out is also very obvious.

Now we continue to talk about the border style, of course, there are several styles, otherwise how can be called Summary:

    • Border-spacing property sets the distance between the borders of adjacent cells

    • Caption-side property sets the position of the table caption

Today we introduce two kinds of attributes, plus the above Border-style attribute is just three kinds. (Recommended TOPIC.ALIBABACLOUD.COMCSS Study Manual section to learn more CSS style knowledge)

First look at the Border-spacing property:

Border-spacing property sets the distance between the borders of adjacent cells (length horizontal interval/length vertical interval)

<style>table,td{border-spacing:length}</style></head><body><table><tr>< Td>11</td><td>22</td></tr><tr><td>22</td><td>44</td> </tr></table><table><tr><td>11</td><td>22</td></tr>< Tr><td>22</td><td>44</td></tr></table></body>

And the same, but this setting is the vertical interval, so we see may not be the same, so there is no show, we can practice, and finally there is a Caption-side property, which is set the table header location, can be set on the above can also be set below. That's all you can do.

So with these kinds of properties is very convenient, good, the knowledge behind us to do the introduction later.

Today's article on the CSS table to add a border style summary of the articles to the end of this (want to learn more CSS style knowledge, to the TOPIC.ALIBABACLOUD.COMCSS Study Manual column study), the problem of students can leave a message in the following questions

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.

Tags Index: