Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

A nice CSS3 to format an html table. I found it at Red Team Design website. Let me share it.

 Here your will find: an example, the css "bordered" and the html used to create the table. Of course the link of the website where I found the css code.

 

 

EXAMPLE

# TITLE NOTES
# title notes
1 BLA BLA Just some notes to test the table
2 WOW This is a wow notes
3 KEEN This is a keen CSS
4 KOOL This ia  COOL CSS
5 SAMPLE Just an example

 

CSS 

 

/* *********************************************************************************
 TABLE "BORDERED"
       css found on www.red-team-design.com 
	   http://www.red-team-design.com/practical-css3-tables-with-rounded-corners
	   
	   CHANGES
		byman2013 - 2-11-2013 - added tfoot>tr>td
	   
********************************************************************************* */
 
table {
    *border-collapse: collapse; /* IE7 and lower */
    border-spacing: 0;
    width: 100%;   
}
.bordered {
    border: solid #ccc 1px;
    border-collapse:separate;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    -webkit-box-shadow: 0 1px 1px #ccc;
    -moz-box-shadow: 0 1px 1px #ccc;
    box-shadow: 0 1px 1px #ccc;        
}
 
.bordered tr:hover {
    background: #fbf8e9;
    -o-transition: all 0.1s ease-in-out;
    -webkit-transition: all 0.1s ease-in-out;
    -moz-transition: all 0.1s ease-in-out;
    -ms-transition: all 0.1s ease-in-out;
    transition: all 0.1s ease-in-out;    
}   
     
.bordered td, .bordered th {
    border-left: 1px solid #ccc;
    border-top: 1px solid #ccc;
    padding: 10px;
    text-align: left;   
}
 
.bordered th,
.bordered tfoot>tr>td
 {
    background-color: #dce9f9;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
    background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:    -moz-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:     -ms-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:      -o-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:         linear-gradient(top, #ebf3fc, #dce9f9);
    -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
    -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset; 
    box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;       
    border-top: none;
    text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
 .bordered tfoot>tr>td{
 border-top: 1px solid #ccc;
 }
.bordered td:first-child, .bordered th:first-child {
    border-left: none;
}
 
.bordered th:first-child {
    -moz-border-radius: 6px 0 0 0;
    -webkit-border-radius: 6px 0 0 0;
    border-radius: 6px 0 0 0;
}
 
.bordered th:last-child {
    -moz-border-radius: 0 6px 0 0;
    -webkit-border-radius: 0 6px 0 0;
    border-radius: 0 6px 0 0;
}
 
.bordered th:only-child{
    -moz-border-radius: 6px 6px 0 0;
    -webkit-border-radius: 6px 6px 0 0;
    border-radius: 6px 6px 0 0;
}
 
.bordered tr:last-child td:first-child {
    -moz-border-radius: 0 0 0 6px;
    -webkit-border-radius: 0 0 0 6px;
    border-radius: 0 0 0 6px;
}
 
.bordered tr:last-child td:last-child {
    -moz-border-radius: 0 0 6px 0;
    -webkit-border-radius: 0 0 6px 0;
    border-radius: 0 0 6px 0;
}
/* *******************************************
TABLE BORDERED - END		
******************************************* */

 

 

 

 HTML

<!-- Table with class "bordered" -->
<table class="bordered">
    <!-- head -->
	<thead>
        <tr>
            <th>#</th>
            <th>TITLE</th>
            <th>NOTES</th>
        </tr>
    </thead>
	<!-- footer -->
    <tfoot>
        <tr>
            <td>#</td>
            <td>title</td>
            <td>notes</td>
        </tr>
    </tfoot>
	<!-- body -->
    <tbody>
		<!-- line 1 -->
        <tr>
            <td>1</td>
            <td>BLA BLA</td>
            <td>Just some notes to test the table</td>
        </tr>
		<!-- line 2 -->
        <tr>
            <td>2</td>
			<td>WOW</td>
            <td>This is a wow notes</td>
        </tr>
		<!-- line 3 -->
        <tr>
            <td>3</td>
            <td>KEEN</td>
            <td>This is a keen CSS</td>
        </tr>
		<!-- line 4 -->
        <tr>
            <td>4</td>
            <td>KOOL</td>
            <td>This ia  COOL CSS</td>
        </tr>
		<!-- line 5 -->
        <tr>
            <td>5</td>
            <td>SAMPLE</td>
            <td>Just an example</td>
        </tr>
    </tbody>
</table>

 

 

REFERENCES

DISQUS - Leave your comments here