页面垂直滚动条(IE/FF兼容)
html { overflow-x:auto; overflow-y:scroll; }
清除样式
ul,li,ol,dl,dt,dd { list-style:none; }
img { border:0; }
i { font-style:normal; }
s { text-decoration:none; }
CSS important
.dialog{margin:4px !important;margin:1px;} /* IE以最后出现的为准, Firefox|Opera|Safari以!important为准 */
CSS DIV半透明
filter: alpha(opacity=50); /*IE支持(范围0-100)*/
opacity: 0.50; /*非IE支持(范围0-1)*/
visibility: visible; /*是否可见[visible|hidden](IE/Firefox都支持)*/
CSS 手形鼠标
cursor:pointer;
设定图形上下左右留空
<img src="图形文件名" vspace="上下留空点数" hspace="左右留空点数">
input的图像标签
<input type="image" src="image.gif" alt="Submit">
accesskey和tabindex属性
网站要兼顾更多情况下的使用,比如没有光标设备(如鼠标)的情况下,要让使用键盘操作也可以完成form的填写,这时候点击对于它们来说,已经没有任何意义。我们这个时候选用label的accesskey(快捷键,IE下为alt+accesskey属性值,FF下为alt+shift+accesskey属性值)和tabindex属性(Tab键,tabindex属性值为顺序)添加到表单标签上,如label,input等。
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" value="" accesskey="f" tabindex="1">
或:<label for="name">姓名(<u>N</u>):</label><input type="text" id="name" accesskey="n">
<input type="radio" id="man" name="gender" value="1"><label for="man" accesskey="m">男(<u>M</u>)</label>
<input type="radio" id="woman" name="gender" value="2"><label for="woman" accesskey="w">女(<u>W</u>)</label>
button标签
按钮:在button元素内你可以放置内容, 像文本(text)或者图片(images). 这是这个元素和input元素按钮的区别.
button相对于input提供了更多的功能与更丰富的内容. button将按钮文字单独出来, 并且可以在button内添加图片, 赋予文字和图片更多选择的样式, 使生硬的按钮变得更生动.
并且使用button标签将比input按钮来得更有语义化, 简单的从字面意思也可以理解.
<button>
<img src="images/click.gif"/>Click Me!
</button>
输入框禁输中文(并禁止粘贴)
<input type="text" name="textfield" οnpaste="return false;" style="ime-mode:disabled">
DIV滚动条
<div style="width:300;height:200;overflow-x:hidden;overflow-y:scroll">
<div style="width:300;height:200;overflow:auto;">
CSS属性列表
字体属性(Font)
font-family 使用什么字体 所有的字体
font-style 字体是否斜体 Normal,italic,oblique
font-variant 是否用小体大写 Normal,small-caps
font-weight 字体的粗细 Normal,bold,bolder,lithter等
font-size 字体的大小 Absolute-size,relative-size,length,percentage等
颜色和背景属性
Color 定义前景色 颜色
Background-color 定义背景色 颜色
Background-image 定义背景图案 路径
Background-repeat 重复方式 Repeat-x,repeat-y,no-repeat
Background-attachment 设置滚动 Scroll,Fixed
Background-position 初始位置 Percentage,length,top,left,right,bottom等
文本属性
Word-spacing 单词之间的间距 Normal <length>
Letter-spacing 字母之间的间距 同上
Text-decoration 文字的装饰样式 None|underline|overline|line-through|blink
Vertical-align 垂直方向的位置 Baseline|sub|super|top|text-top|middle|bottom|text-bottom|
Text-transform 文本转换 Capitalize|uppercase|lowercase|none
Text-align 对齐方式 Left|right|center|justify
Text-indent 首行的缩进方式 <length>|<percentage>
Line-height 文本的行高 Normal|<number>|<length>|<percentage>
边距属性
Margin-top|Margin-right|Margin-bottom|Margin-left -> Length|percentage|auto
填充距属性
Padding-top|Padding-right|Padding-bottom|Padding-left -> Length|percentage
边框属性
Border-top-width|Border-right-width|Border-bottom-width|Border-left-width -> Thin|medium|thick|length
Border-width -> Thin|medium|thick|length
Border-color -> Color
Border-style -> None|dotted|dash|solid等
Border-top|Border-right|Border-bottom|Border-left -> Border-top-width|color等
Width -> Length|percentage|auto
Height -> Length|auto
Float 文字环绕 Left|right|none
Clear 哪一边环绕 Left|right|none|both
分级属性
Display 定义是否显示 Block,inline,list-item,none
White-space 怎样处理空白 Normal,pre,nowrap
List-style-type 加项目编号 Disc,circle,square等
List-style-image 加图案 <url>|none
List-style-position 第二行起始位置 Inside,outside
List-style 一次定义列表 <keyword>|<position>|<url>
鼠标属性
Cursor -> Auto|Crosshair|Default|Hand|Move|e-resize|Ne-resize|Nw-resize|n-resize|Se-resize|Sw-resize|s-resize|w-resize|Text|Wait|Help