Menu bar

Showing posts with label Create. Show all posts
Showing posts with label Create. Show all posts

Monday, 16 June 2014

How to style table using CSS?

No explanation needed for you buddy :)
This is as simple as you see here..


Table 1

Html code for Table 1

<table id="gradient-style" summary="Meeting Results">
<thead>
<tr>
<th scope="col">Employee</th>
<th scope="col">Division</th>
<th scope="col">Suggestions</th>
<th scope="col">Rating</th></tr>
</thead>

<tfoot>

<tr><td colspan="4">Give background color to the table cells to achieve seamless transition</td></tr>
</tfoot>

<tbody>

<tr><td>Stephen C. Cox</td><td>Marketing</td><td>Make discount offers</td><td>3/10</td></tr>
<tr><td>Josephin Tan</td><td>Advertising</td><td>Give bonuses</td><td>5/10</td></tr>
<tr><td>Joyce Ming</td><td>Marketing</td><td>New designs</td><td>8/10</td></tr>
<tr><td>James A. Pentel</td><td>Marketing</td><td>Better Packaging</td><td>8/10</td></tr>
</tbody>
</table>


CSS code for Table 1

<style>
#gradient-style{
font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size:12px;
width:480px;
text-align:left;
border-collapse:collapse;
margin:20px;
}
#gradient-style th{
font-size:13px;font-weight:normal;
background:#9C9 url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/gradhead.png") repeat-x;
border-top:2px solid #d3ddff;
border-bottom:1px solid #fff;
color:#039;padding:8px;
}
#gradient-style td{
border-bottom:1px solid #fff;
color:#669;
border-top:1px solid #fff;
background:#9c9 url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/gradback.png") repeat-x;
padding:8px;
}
#gradient-style tfoot tr td{
background:#e8edff;
font-size:12px;
color:#99c;
}
#gradient-style tbody tr:hover td{
background:#9c9 url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/gradhover.png") repeat-x;
color:#339;
}
</style>


Table 2

Html code for Table 2


<table id="pattern-style-a" summary="Meeting Results">
<thead>
<tr>
<th scope="col">Employee</th>
<th scope="col">Salary</th>
<th scope="col">Bonus</th>
<th scope="col">Supervisor</th></tr>
</thead>
<tbody>
<tr><td>Stephen C. Cox</td><td>$300</td><td>$50</td><td>Bob</td></tr>
<tr><td>Josephin Tan</td><td>$150</td><td>-</td><td>Annie</td></tr>
<tr><td>Joyce Ming</td><td>$200</td><td>$35</td><td>Andy</td></tr>
<tr><td>James A. Pentel</td><td>$175</td><td>$25</td><td>Annie</td></tr>
</tbody>
</table>


CSS code for Table 2

<style>
#pattern-style-a{
font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size:12px;
width:480px;
text-align:left;
border-collapse:collapse;
background:url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/pattern.png");
margin:20px;
}
#pattern-style-a thead tr{
background:url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/pattern-head.png");
}
#pattern-style-a th{
font-size:13px;
font-weight:normal;
border-bottom:1px solid #fff;
color:#039;
padding:8px;
}
#pattern-style-a td{
border-bottom:1px solid #fff;
color:#669;
border-top:1px solid transparent;
padding:8px;
}
#pattern-style-a tbody tr:hover td{
color:#339;
background:#fff;

}
</style>

Table 3

Html code for Table 3

<table id="pattern-style-b" summary="Meeting Results">
<thead>
<tr>
<th scope="col">Nation</th>
<th scope="col">Capital</th>
<th scope="col">Language</th>
<th scope="col">Unique</th>
</tr>
</thead>
<tbody>
<tr><td>Japan</td><td>Tokyo</td><td>Japanese</td><td>Karate</td></tr>
<tr><td>South Korea</td><td>Seoul</td><td>Korean</td><td>Ginseng</td></tr>
<tr><td>China</td><td>Beijing</td><td>Mandarin</td><td>Kung-Fu</td></tr>
<tr><td>Indonesia</td><td>Jakarta</td><td>Indonesian</td><td>Batik</td></tr>
</tbody>
</table>


CSS code for Table 3

<style>
#pattern-style-b{
font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size:12px;
width:480px;
text-align:left;
border-collapse:collapse;
background:url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/patternb.png");
margin:20px;
}
#pattern-style-b thead tr{
background:url("http://www.smashingmagazine.com/images/express-css-table-design/table-images/patternb-head.png");
}
#pattern-style-b th{
font-size:13px;
font-weight:normal;
border-bottom:1px solid #fff;
color:#039;
padding:8px;
}
#pattern-style-b td{
border-bottom:1px solid #fff;
color:#669;
border-top:1px solid transparent;
padding:8px;
}
#pattern-style-b tbody tr:hover td{
color:#339;
background:#cdcdee;
}
</style>