css.css 文件:
body,td,th {
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.viptd {
float: left;
height: 196px;
191px;
border-top: 1px solid #E2E2E2;
border-right: 1px solid #E5EAF3;
background-color: #00ff00;
}
Html 文件:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>为表格中的某一单元格加背景色</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="882" height="333" border="1">
<tr>
<td> </td>
</tr>
<tr>
<td class="viptd">这个单元格背景色就是绿色的</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
------------------------------------------------
如果要为整个网页加一个背景图片,则只需象以下改动就可以:
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image : url(../backgroudimg/00.jpg);
}
--------------------------------------------------
如果要为某一个 td 单元格加一个背景图,则 CSS 要加一个这样的 class :
.left_ad2 {
background-image: url(../backgroudimg/1114674280475.jpg);
}
然后:
<tr>
<td class="left_ad2">这个单元格就有了一个背景图</td>
</tr>
------------------------------------------------------
为 table 加一个特殊的样式:
table.CUEditor_Body
{
background-color:#9EBEF5;
border:1px solid #808080;
}
table.CUEditor_MessageBody
{
background-color:#D1C2E9;
border:1px solid #808080;
}
然后:
<table class="CUEditor_Body" width="773" height="158">
<table class="CUEditor_MessageBody" width="773" height="158">
如果 css 这样写的话:
table
{
background-color:#9EBEF5;
border:1px solid #808080;
}
那网页里的所有 table 则全部自动套用 此样式。
----------------------------------------------------------------------
让超链接有立体感:
.CUEditor_OutColor{
border:1 double;border-color:#7E7D9D #7E7D9D #7E7D9D #7E7D9D;cursor:hand;background:#9EBEF5
}
.CUEditor_OverColor{
border:1 double;border-color:#ffffff #999999 #999999 #ffffff;cursor:hand;background:#81A9E2
cursor:hand;
}
.CUEditor_ClickColor{
border:1 double;border-color:#999999 #ffffff #ffffff #999999;cursor:hand;background:#81A9E2
}
<td align="center"><img src="images/mainlink.gif" border="0" class="CUEditor_OutColor" onmouseover="this.className='CUEditor_OverColor';" onmouseout="this.className='CUEditor_OutColor';" onclick="this.className='CUEditor_ClickColor';CUEditor_help();" unselectable="on" hspace="2" vspace="0" title="回到主界面"/></td>
--------------------------------
常用的 css :
A:link{
COLOR: #000000;
text-decoration: none;
font-size: 9pt;
}
A:visited {
COLOR: #ffffff;
text-decoration: none;
font-size: 9pt;
}
A:active {
COLOR: #EA00000;
font-size: 9pt;
}
A:hover {
COLOR: #00DB00;
text-decoration: underline;
font-size: 9pt;
}
A.indexlink:link{
COLOR: #F9F900;
text-decoration: none;
font-size: 9pt;
}
A.indexlink:visited {
COLOR: #009100;
text-decoration: none;
font-size: 9pt;
}
A.indexlink:active {
COLOR: #28FF28;
font-size: 9pt;
}
A.indexlink:hover {
COLOR: #5B00AE;
text-decoration: underline;
font-size: 9pt;
}
.jl-c {
line-height: 20px;
color: #8600FF;
font-size: 14px;
}
.list {
font-size: 9pt;
color: #FC6103;
text-decoration: none;
font-weight: bold;
}
.line3 {
border-right- 1px;
border-left- 1px;
border-right-style: solid;
border-left-style: solid;
border-right-color: D9D9D9;
border-left-color: D9D9D9;
}
.input {
font-size: 9pt;
color: #000000;
background-color: #FFFFFF;
border: 1px solid #7A7A7A;
}
.cuefont {
font-size: 12px;
}
.p3 {font-size: 12px;line-height: 150%;}