How to set a table border on table and TD background

Source: Internet
Author: User
A lot of friends are very distressed table style how to set, today will give you a detailed explanation of CSS table style how to set, before said three methods, only the table set the border, the TD set the border, To table and TD tricks to set the table border now gives you how to set the table and TD background to implement the form border, I hope you read after the harvest.

First set the table CSS background to red

Then set the spacing between table cells to 1
Using the DW software assistance to set the table cell spacing of 1, specific DW software visualization procedures, a brief description, first (view mode) when the table is selected, the corresponding DW software editing window at the bottom of the "Properties" panel will appear the corresponding Table table property settings, we fill the "Interval" as "1". At this point we will see the Table tab with the cellspacing value "1" (cellspacing= "1").

Use the DW software to set the spacing between table cells or

Directly to the <table> tag within the cellspacing= "1" can Be, get:

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

Set table TD Background to White

CSS code:

<style>. table-d table{background: #F00}. table-d table td{Background: #FFF}///CSS Comment: Set table background is red, TD background is white */</ Style>

Corresponding HTML source code:

<div class= "table-d" > <table width= "" "border=" 0 "cellspacing=" 1 "cellpadding=" 0 "> <tr> <td Width= "" > Station name </td> <td width= "181" > URL </td> <td width= "A" > Description </td> </tr> <tr> <td>DIVCSS5</td> <td>www.divcss5.com</td> <td>css Learning </td> </tr > <tr> <td>CSS5</td> <td>www.css5.com.cn</td> <td>css </td> </tr > </table> </div>

We've summed up four ways to implement table table border styles, and we recommend using the third and fourth methods to resolve table border styles. I hope our methods are helpful and able to master, and use them flexibly when needed.

Related reading:

How to Set table borders on table and TD tricks


How to use CSS to set the TD border


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.