Learn CSS Web page making technology: UL to create TABLE style

Source: Internet
Author: User
Tags modify
css| Web page

The form is not unfamiliar, and the thin form is widely used.
There are a number of ways to do a thin form, such as:
1. The simplest method of thin-Line table, using the table property directly
<table style= "Border-collapse:collapse" border= "1" bordercolor= "#CC3333" >
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
</table>

2. Use the table background color and Spacing properties to construct the table, it should be noted that TD must also use the background color to show the line
<table cellpadding= "0" cellspacing= "1" bgcolor= "#0066CC" >
<tr>
<TD bgcolor= "#FFFFFF" >test</td>
<TD bgcolor= "#FFFFFF" >test</td>
<TD bgcolor= "#FFFFFF" >test</td>
<TD bgcolor= "#FFFFFF" >test</td>
</tr>
</table>

Of course the above methods are very useful, but we are not talking about these today, but using another method--<ul>

Before you start, talk about specific ideas, such as the figure:

Each of these Li is responsible only for the right and bottom lines , with Float:left, to complete the horizontal arrangement,
The outermost div defines only the top and left lines to display the complete line of the table.
The advantage of this approach is more flexible, you can be defined by the UL in advance of any two class to control the color of the line,
The overall semantics is also more clear, visible CSS is how flexible:p

In the implementation of the program, as in the cycle <tr>, we can directly loop <ul>,
You know, a clear structure is a great help to the efficiency of programmer development programs.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><ptml xmlns=" http://www.w3.org/1999/xhtml "><pead><meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/><title>tableframe_simple</title><style type=" Text/css ">body{width:auto; height:auto;padding:0;margin:20px 0;font-size:12px;font-family:verdana, Arial, Helvetica, Sans-serif; Ul{clear:both;padding:0;margin:0;list-style:none;} #tableFrame {width:875px/* need to modify */height:auto;border-top: #000 1px solid;border-left: #000 1px solid;padding:0;margin : 0 auto;font-size:12px;} #tableFrame: After {content: "."; display:block;height:0; clear:both; visibility:hidden;} li{float:left;display:block;width:120px/* Need to modify */height:auto;padding:2px;margin:0;border-right: #000 1px solid; Border-bottom: #000 1px solid;line-height:16px;color:000;} /* Table title * * #tableFrameTitle ul{} #tableFrameTitle ul Li{background:gray; Text-align:center;color: #fff;}/* table content/#tableCase ul{} #tableCase ul li{}/* a single table-specific style */.tablecasethree{color: #329A02; Tablecasefive{color: #f00; Tablecaseseven{color: #f00;} </style> </pead><body><div id= "TableFrame" > <div id= "tableframetitle" > <ul> <li>ID</li> <li> Day ranking </li> <li> ranking change trend </li> <li> Weekly Average ranking </li> <li> ranking change trend </li> <li> January average </li> <l I> ranking Trend </li> </ul> </div> <div id= "Tablecase" > <!--start cycling here--> ;ul> <li class= "Tablecaseone" >0001</li> <li class= "Tablecasetwo" >1234</li&gt ; <li class= "Tablecasethree" >↑200</li> <li class= "Tablecasefour" >1856</li> &L T;li class= "tablecasefive" >↓56</li> <li class= "Tablecasesix" >1650</li><li class= "Tablecaseseven" >↓156</li> </ul> <!--to this cycle end--> <ul> < Li class= "tablecaseone" >0002</li> <li class= "Tablecasetwo" >1234</li> <li CLA ss= "Tablecasethree" >↑200</li> <li class= "Tablecasefour" >1856</li> <li class = "Tablecasefive" >↓56</li> <li class= "Tablecasesix" >1650</li> <li class= "tab Lecaseseven ">↓156</li> </ul> <ul> <li class=" Tablecaseone ">0003</l i> <li class= "Tablecasetwo" >1234</li> <li class= "Tablecasethree" &GT;↑200&LT;/LI&G T <li class= "Tablecasefour" >1856</li> <li class= "tablecasefive" >↓56</li> < Li class= "tablecasesix" >1650</li> <li class= "Tablecaseseven" >↓156</li> </ul> <ul> <li class= "Tablecaseone" >0004</li> <li class= "Tablecasetwo" &GT;1234&LT;/LI&G T <li class= "Tablecasethree" >↑200</li> <li class= "Tablecasefour" >1856</li> &L T;li class= "tablecasefive" >↓56</li> <li class= "Tablecasesix" >1650</li> <li class= "Tablecaseseven" >↓156</li> </ul> <ul> <li class= "Tablecaseone" > 0005</li> <li class= "Tablecasetwo" >1234</li> <li class= "Tablecasethree" >↑20 0</li> <li class= "Tablecasefour" >1856</li> <li class= "Tablecasefive" >↓56&lt ;/li> <li class= "Tablecasesix" >1650</li> <li class= "Tablecaseseven" >↓156</l I> </ul> </div></div></body></ptml>

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



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.