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 属
相关文档:
<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 ......
一、CSS文件及样式命名
1、CSS文件命名规范
全局样式:global.css;
框架布局:layout.css;
字体样式:font.css;
链接样式:link.css;
打印样式:print.css;
2、CSS样式命名规范
本人建议:用字母、_号工、-号、数字组成,必须以字母开头,不能为纯数字。为了开发后样式名管理方便,大家请用有意义的单 ......
这篇文章是在如下地址看到的:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_23302976.html
首先是HTML部分:
<
body>
<
div id="loading">
<div><img src="../images/loading.gif" /><span>Please Wait</span></div> ......
彻底弄懂CSS盒子模式(DIV+CSS)
非常好的DIV布局原理与实例教程,对WEB标准布局有兴趣的朋友可以看看以下内容:
Web标准,彻底弄懂CSS盒子模式一:DIV布局快速入门
Web标准,彻底弄懂CSS盒子模式二:导航栏实例详解
Web标准,彻底弄懂CSS盒子模式三:浮动的表演和清除的自述[1]
Web标准,彻底弄懂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来控制分页效果
. ......