学习css中的摘录
链接方法:
外部链接样表:<head><link rel="stylesheet" type="text/css" href="*.css"></head>
内部的:1:<head><style type="text/css"> example css </style></head>
2:<p style="color: sienna; margin-left: 20px">
使用方法:
类选择器:.center {text-align: center}
<h1 class="center">
This heading will be center-aligned
</h1>
id选择器:#center {text-align: center}
<h1 id="center">
This heading will be center-aligned
</h1>
派生:
基于大类的使用,只要更大的元素内部的表格单元: .fancy td
类名为 fancy 的表格单元: td.fancy <td class="fancy">
background-position 的默认值是 0% 0%,在功能上相当于 top left。
background-attachment:fixed:图像固定不动
body
{
background-image:url(/i/eg_bg_02.gif);
background-repeat:no-repeat;
background-attachment:fixed
}
background
简写属性,作用是将背景属性设置在一个声明中。
background-attachment
背景图像是否固定或者随着页面的其余部分滚动。
background-c
相关文档:
/*不管是什么方法,书写的顺序都是firefox的写在前面,IE7的写在中间,IE6的写在后面。*/
.JS_CenterAD_marquee_Right
{
margin-left:17px !important; /firefox*/
*margin-left:17px !important; / ......
在制作一个浮动图片用于网站显示时,出现图片固定不浮动,最终检查发现 DIV浮动与
http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd冲突
去掉这段可暂时实现浮动。
但此代码不可随意去掉,去掉后又会导致DIV某些属性混乱。幸好此次暂时不使用某些功能
临时解决办法,期待更好的解决办法 ......
1.在页面HEAD中引入一个特殊的CSS
<link rel="stylesheet" type="text/css" href="${contextPath}/styles/print.css" media="print" />
2.在print.css中通过将页面中显示的区域DISPLAY设置为NONE,打印区域设定DISPLAY为BLOCK
另外可以加入一个特殊的CSS来控制分页效果
. ......
1.div的垂直居中问题
vertical-align:middle; 将行距增加到和整个DIV一样高 line-height:200px; 然
后插入文字,就垂直居中了。缺点是要控制内容不要换行
2. margin加倍的问题
设置为float的div在ie下设置的margin会加倍。这是一个ie6都存在的bug。解决方
案是在这个div里面加上display:inline;
例如:
<#div ......
注释用/**/。
不要在属性值与单位之间留有空格。假如你使用 “margin-left:20 px” 而不是 “margin-left:20px” (20和px之间有空格),它仅在 IE 6 中有效,但是在 Mozilla/Firefox 或 Netscape 中却无法正常工作。
外部样式表引用方式:<link rel="stylesheet" type="text/css" href="mystyle.cs ......