CSS-note
margin: 2em 0 2em 0;
/* top right bottom left; */
margin: 2em 0;
/* top&bottom left&right */
margin: 2em 0 2em;
/* top right&left bottom */
我要怎樣在滑鼠游標移動到表格中某列時,改變背景色。
for Mozilla
.datatable tr:hover{
background-color: #DFE7F2;
cololr: #000000;
}
for IE (:hover在Internet Explorer上,仍無法作用於連結之外的元素)
.datatable tr:hover, .datatable tr.hilite{
background-color: #DFE7F2;
color: #000000;
}
<script type="text/javascript">
var rows = document.getElementByTagName("tr");
for(var i=0; i<rows.length; i++){
rows[i].onmouseover = function(){
this.className += ' hilite';
}
rows[i].onmouseout = function(){
this.className = this.className.repalce('hilite', ' ');
}
}
</scrit>
!important Declaration
The following example includes the !important declaration in the style rule. Normally the color of the text would be green, because inline styles override the rules set in a style tag. By including the !important declaration in the style rule, you set the content of the paragraph to red.
<STYLE>
P { color:red!important }
</STYLE>
<P STYLE="color:green">This text will be red.</P>
沒有留言:
張貼留言