
本文为大家展示了几款美观的表格样式,希望大家可以喜欢。
1、单像素边框CSS表格

table.gridtable {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse: collapse;}table.gridtable th {border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;}table.gridtable td {border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;} | Info Header 1 | Info Header 2 | Info Header 3 |
|---|---|---|
| Text 1A | Text 1B | Text 1C |
| Text 2A | Text 2B | Text 2C |
(视频教程推荐:css视频教程)
2、带背景图的CSS样式表格
立即学习“前端免费学习笔记(深入)”;

table.imagetable {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #999999;border-collapse: collapse;}table.imagetable th {background:#b5cfd2 url('cell-blue.jpg');border-width: 1px;padding: 8px;border-style: solid;border-color: #999999;}table.imagetable td {background:#dcddc0 url('cell-grey.jpg');border-width: 1px;padding: 8px;border-style: solid;border-color: #999999;} | Info Header 1 | Info Header 2 | Info Header 3 |
|---|---|---|
| Text 1A | Text 1B | Text 1C |
| Text 2A | Text 2B | Text 2C |
3、自动换整行颜色的CSS样式表格(需要用到JS)

function altRows(id){if(document.getElementsByTagName){ var table = document.getElementById(id); var rows = table.getElementsByTagName("tr"); for(i = 0; i < rows.length; i++){ if(i % 2 == 0){rows[i].className = "evenrowcolor";}else{rows[i].className = "oddrowcolor";} }}} window.οnlοad=function(){altRows('alternatecolor');} table.altrowstable {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #a9c6c9;border-collapse: collapse;}table.altrowstable th {border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;}table.altrowstable td {border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;}.oddrowcolor{background-color:#d4e3e5;}.evenrowcolor{background-color:#c3dde0;} | Info Header 1 | Info Header 2 | Info Header 3 |
|---|---|---|
| Text 1A | Text 1B | Text 1C |
| Text 2A | Text 2B | Text 2C |
| Text 3A | Text 3B | Text 3C |
| Text 4A | Text 4B | Text 4C |
| Text 5A | Text 5B | Text 5C |
4、鼠标悬停高亮的CSS样式表格 (需要JS)

table.hovertable {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #999999;border-collapse: collapse;}table.hovertable th {background-color:#c3dde0;border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;}table.hovertable tr {background-color:#d4e3e5;}table.hovertable td {border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;} | Info Header 1 | Info Header 2 | Info Header 3 |
|---|---|---|
| Item 1A | Item 1B | Item 1C |
| Item 2A | Item 2B | Item 2C |
| Item 3A | Item 3B | Item 3C |
| Item 4A | Item 4B | Item 4C |
| Item 5A | Item 5B | Item 5C |
推荐教程:css快速入门
以上就是利用css实现的表格样式展示的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1615243.html
微信扫一扫
支付宝扫一扫