How do I make an HTML table border? HTML table table making and examples

Source: Internet
Author: User
This article is mainly about the HTML Table Table label of the border usage, generally we are to set the border line as one way to demonstrate the border. Let's take a look at this article about the border usage of HTML table labels.

Let's start by looking at how the table is defined:

The table is defined by the <table> tag. Each table has several rows (defined by the <tr> tag) and each row is split into several cells (defined by the <td> tag). The letter TD refers to the table data, which is the contents of the data cell. Data cells can contain text, pictures, lists, paragraphs, forms, horizontal lines, tables, and so on.

OK, let's start with a simple form:

<!doctype html>

This is a simple three-row, three-column table,

For many beginners of HTML, table <table> is the most commonly used label, but for the control of the table border, many beginners are not very good solution.

Generally we use the table when always give it a border attribute, such as: <table border= "1", the effect such as:

Can find the table border seems to be very wide, of course, the "very wide" here is definitely not the width of the table border, we see the width should be between the gap between <td>. So you just need to modify the CellSpacing property of the table, namely:

<table border= "1px" cellspacing= "0px" width= "300px" height= "><tr><td><td><td>" </td></td></td></tr><tr><td><td><td></td></td>< /td></tr><tr><td><td><td></td></td></td></tr></ Table>

The effect is as follows:

We initially added a border=1 to the table because we added a default black line style to table, which is what we said above, TD and Table have default black edges, so if you need to solve this problem completely, so that the border can display properly, And then add a color to the table,

<table border= "1px" bordercolor= "#FF0000" cellspacing= "0px" width= "300px" height= "><tr><td>" <td><td></td></td></td></tr><tr><td><td><td></ Td></td></td></tr><tr><td><td><td></td></td></td ></tr></table>

Black doesn't look obvious, we change to red.

Summary: Is the black border turned red, we can add content in the inside and adjust the size, etc., inside can also adjust the text, in short, the use of table tables is quite large. In this article we introduce the borders of table tables, and of course we rarely have borders when we actually apply them, except in some special cases. Generally we are the border line set to 0, so there is no border line, but we are basically in the teaching of the border is equal to one, convenient to see also convenient adjustment.

Related Article

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.