Create an affinity table with CSS

Source: Internet
Author: User
Tags comments
CSS translation from: A css styled table original: Http://veerle.duoh.com/comments.php?id=315_0_2_0_C copyright to the original author all this translation of the page copyright, authorized blue ideal. Reprint please indicate the source

In the previous period of time to create a CSS calendar, and then I want to use CSS to create a table model, the model follows the affinity rules, and has a good visual effect.

Figure: Color selection and collocation

The advantage of doing this is that it's best to use tables to load data, and you can be flexible about defining styles for each cell. Here are the specific practices

First in Photoshop to design an effect out, through a variety of colors, small icons and other common sense, made a satisfactory effect of the picture. Next, there are three images in the tribunal as background images of the title, and if you're not very good at color, here are some palette tools for you.

Www.snook.ca/technical/colour_contrast/colour.html

Veerle.duoh.com/comments.php?id=108_0_2_20_c8

Data structure is

<table id= "mytable" cellspacing= "0" summary= "the technical
Specifications of the Apple PowerMac G5 Series ">
<caption>table 1:power Mac G5 Tech Specs </caption>
<tr>
<th scope= "col" abbr= "Configurations" class= "NOBG" >Configurations</th>
<th scope= "col" abbr= "Dual 1.8GHz" >dual 1.8ghz</th>
<th scope= "col" abbr= "Dual 2GHz" >dual 2ghz</th>
<th scope= "col" abbr= "Dual 2.5GHz" >dual 2ghz</th>
</tr>
<tr>
<th scope= "Row" class= "Spec" >Model</th>
<td>M9454LL/A</td>
<td>M9455LL/A</td>
<td>M9457LL/A</td>
</tr>
...

You can see that I used the scope property to make sure that the table shows better results in a visually-free browser, which defines whether the header element contains a row (scope= "col") or a column (scope= "Row"). Below is the CSS content for the above title, use and background to better differentiate them

th {
Font:bold 11px "Trebuchet MS", Verdana, Arial, Helvetica,
Sans-serif;
Color: #6D929B;
border-right:1px solid #C1DAD7;
border-bottom:1px solid #C1DAD7;
border-top:1px solid #C1DAD7;
letter-spacing:2px;
Text-transform:uppercase;
Text-align:left;
padding:6px 6px 6px 12px;
Background: #CAE8EA URL (images/bg_header.jpg) no-repeat;
}

TH.NOBG {
border-top:0;
border-left:0;
border-right:1px solid #C1DAD7;
Background:none;
}

The following defines the heading style on the left

Th.spec {
border-left:1px solid #C1DAD7;
border-top:0;
Background: #fff URL (images/bullet1.gif) no-repeat;
Font:bold 10px "Trebuchet MS", Verdana, Arial, Helvetica,
Sans-serif;
}

Th.specalt {
border-left:1px solid #C1DAD7;
border-top:0;
Background: #f5fafa URL (images/bullet2.gif) no-repeat;
Font:bold 10px "Trebuchet MS", Verdana, Arial, Helvetica,
Sans-serif;
Color: #B4AA9D;
}

The data here comes from the MAC technical specifications of each power Mac g5|http://www.apple.com/powermac/specs.html down to define common and important data content

TD {
border-right:1px solid #C1DAD7;
border-bottom:1px solid #C1DAD7;
Background: #fff;
padding:6px 6px 6px 12px;
Color: #6D929B;
}

Td.alt {
Background: #F5FAFA;
Color: #B4AA9D;
}

So far, the whole production process is over.

  View Table Effects

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "http://www.w3c.org/TR/1999/REC-html401-19991224/ Loose.dtd "><ptml xmlns=" http://www.w3.org/1999/xhtml "><pead><title>css tables</title> <meta http-equiv=content-type content= "text/html; Charset=utf-8 "><link href=" Http://www.webjx.com/upfiles/20060314/20060314125704_styles.css "type=text/css Rel=stylesheet><meta content= "MSHTML 6.00.2900.2802" name=generator></pead><body><p> <a href= "http://www.webjx.com" > Web Teaching Network </a></p><table id=mytable cellspacing=0 "the Technical specifications of the Apple PowerMac G5 series "> <caption>table 1:power Mac G5 Tech Specs </captio n> <TBODY> <TR> <th class=nobg scope=col abbr=configurations>configurations</th> <TH Scope=col abbr= "Dual 1.8" >dual 1.8ghz</th> <th scope=col abbr= "Dual 2" >dual 2ghz</th> <TH S Cope=col abbr= "Dual 2.5 ">dual 2.5ghz</th></tr> <TR> <th class=spec scope=row abbr=model>model</th> &L T td>m9454ll/a</td> <TD>M9455LL/A</TD> <TD>M9457LL/A</TD></TR> <TR> & lt;th class=specalt scope=row abbr= "G5 Processor" >g5 processor</th> <td class=alt>dual 1.8GHz PowerPC G5 </TD> <td class=alt>dual 2GHz PowerPC g5</td> <td class=alt>dual 2.5GHz PowerPC g5</td&gt ;</tr> <TR> <th class=spec scope=row abbr= "Frontside Bus" >frontside bus</th> Hz per processor</td> <td>1ghz/processor</td> <td>1.25ghz per processor</td></t r> <TR> <th class=specalt scope=row abbr= "L2 Cache" >level2 cache</th>, &LT;TD Per processor</td> <td class=alt>512k/processor</td> <td class=alt>512k per PROCESSOR&L T;/td></tr>&lT;/tbody></table><p><a href= "Http://www.webjx.com/upfiles/20060314/20060314125704_styles.css" >→download stylesheet</a></p></body></ptml>

[Ctrl + A ALL SELECT hint: You can modify some of the code, and then run]

View CSS Files

The translator's words: This page has been tested by me through the standard authentication of the Ie,firefox,opera, and compatible with the mainstream browser, for a large number of data, you can use JS to achieve two kinds of background alternating display.



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.