CSS常用操作
注释用/**/。
不要在属性值与单位之间留有空格。假如你使用 “margin-left:20 px” 而不是 “margin-left:20px” (20和px之间有空格),它仅在 IE 6 中有效,但是在 Mozilla/Firefox 或 Netscape 中却无法正常工作。
外部样式表引用方式:<link rel="stylesheet" type="text/css" href="mystyle.css" mce_href="mystyle.css" />
内部样式表:
<head>
<mce:style type="text/css"><!--
hr {color: sienna;}
p {margin-left: 20px;}
body {background-image: url("images/back40.gif");}
h1,h2,h2,h3,h5,h6 {color: green;}
--></mce:style><style type="text/css" mce_bogus="1"> hr {color: sienna;}
p {margin-left: 20px;}
body {background-image: url("images/back40.gif");}
h1,h2,h2,h3,h5,h6 {color: green;}</style>
</head>
内联样式:<p style="color: sienna; margin-left: 20px" mce_style="color: sienna; margin-left: 20px">This is a paragraph</p>
---------------------------------------------
样式可以被继承:
例如,外部样式表拥有针对 h3 选择器的三个属性:
h3 {
color: red;
text-align: left;
font-size: 8pt;
}
而内部样式表拥有针对 h3 选择器的两个属性:
h3 {
text-align: right;
font-size: 20pt;
}
假如拥有内部样式表的这个页面同时与外部样式表链接,那么 h3 得到的样式是:
color: red;
text-align: right;
font-size: 20pt;
---------------------------------------------
提示:如果值为若干单词,则要给值加引号:p {font-family: "sans serif";}。只有当一个字体名中有一个或多个空格(比如 New York),或者如果字体名包括 # 或 $ 之类的符号,才需要在 font-family 声明中加引号。
派生选择器:
strong {
color: red;
}
h2 {
color: red;
}
h2 strong {
color: blue;
}
<h2>The strongly emphasized word in this subhead is<strong>blue</strong>.</h2>
---------------------------------------------
id 选择器:
id 选择器可以为标有特定 id 的 HTML 元素指定特定的样式。id 选择器以 "#" 来定义。
#red {color:red;}
#green {color:green;}
下面的 HTML 代码中,id 属
相关文档:
三种引用2010-03-14 17:45:36
内联定义>外链引用>内联块定义
1.内联定义
<a stype="XXX">
2 ......
<div style="FILTER:alpha(opacity=30 finishopacity=0 style=1) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=1); VERTICAL-ALIGN: middle; BORDER-LEFT: #f3f3f3 1px solid; WIDTH: 300px; PADDIN ......
转载自:div+css优点
http://blog.sina.com.cn/s/blog_4fe1e5e90100bdtk.html
最近面试了多家公司...有个关于div+css布局好处的问题,问了好多次..我回答了一些,但是不太全面..
今天从网上系统的搜索到了一些,参考
DIV本身就是容器性质的,你不但可以内嵌table还可以内嵌文本和其它的HTML代码;CSS是CascADIng style Sh ......
在许多网站上我们可以看到很个性的鼠标指针(cursor),在网页设计中用CSS可以方便的实现这样个性鼠标指针的效果,该CSS属性就是"cursor"属性。
首先我们介绍一下系统自带的15个鼠标效果:
一般而言,鼠标以斜向上的箭头显示,移到文本上时变为有头的竖线,移到超级链接上变为手型。但用css可控制鼠标的显示效果,如可使鼠标 ......
1.在页面HEAD中引入一个特殊的CSS
<link rel="stylesheet" type="text/css" href="${contextPath}/styles/print.css" media="print" />
2.在print.css中通过将页面中显示的区域DISPLAY设置为NONE,打印区域设定DISPLAY为BLOCK
另外可以加入一个特殊的CSS来控制分页效果
. ......