您的位置:首页 > Web前端 > CSS

网页中几个常用到的 CSS 样式

2012-11-24 09:06 531 查看
· 1.中文字两端对齐:text-align:justify; text-justify:inter-ideograph;

· 2.固定宽度汉字截断:overflow:hidden;text-overflow:ellipsis;white-space:nowrap;(不过只能处理文字在一行上的截断,不能处理多行。)(IE5以上)

· 3.固定宽度汉字(词)折行:table-layout:fixed; word-break:break-all;(IE5以上)

· 4.<acronym style="cursor: help" title="输入要提示的文字">文字</acronym> 用鼠标放在前面的文字上看效果。这个效果在国外的很多网站都可以看到,而国内的少又少。

· 5.图片设为半透明:.halfalpha { background-color: #000000; filter: Alpha(Opacity=50)} 在 IE6 及 IE5 测试通过,FF未通过。

· 6.FLASH透明: 选中 swf,打开原代码窗口,在 </object> 前输入 <param name="wmode" value="transparent"> 我们在做网页时常用到把鼠标放在图片上会出现图片变亮的效果,可以用图片替换的技巧,也可以用如下的滤镜,代码如下:

.pictures img { filter: alpha(opacity=45); }

.pictures a:hover img { filter: alpha(opacity=90); }

· 如果文字过长,则将过长的部分变成省略号显示:IE5、FF 无效,但可以隐藏,IE6 有效

<div style="width: 120px; height: 50px; border: 1px solid blue; overflow: hidden; text-overflow:ellipsis">

< NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR>

· title 换行用的符号或在 IE 中可能由于注释带来的文字重复问题时可以把注释改为:<!--[if !IE]>

Put your commentary in here...

< ![endif]-->

· 如何用 CSS 调用外部字体语法:@font-face { font-family : name; src: url ( url ); sRules }取值:

name :  字体名称。任何可能的 font-family 属性的值

url ( url ) :  使用绝对或相对 url 地址指定OpenType字体文件

sRules :  样式表定义

 

 

大小 font-size: x-large;(特大) xx-small;(极小) 一般中文用不到,只要用数值就可以,单位:PX、PD

样式 font-style: oblique;(偏斜体) italic;(斜体) normal;(正常)

行高 line-height: normal;(正常) 单位:PX、PD、EM

粗细 font-weight: bold;(粗体) lighter;(细体) normal;(正常)

色彩background-color: #FFFFFF;

图片background-image: url();

border-style: dotted;(点线) dashed;(虚线) solid;(实线) double;(双线) groove;(凹槽) ridge;(脊状) inset;(边框) outset;(边框)

类型list-style-type: disc;(圆点) circle;(圆圈) square;(方块) decimal;(数字) none(无)

text-align:right; /*文字右对齐*/

text-align:left; /*文字左对齐*/

text-align:center; /*文字居中对齐*/

text-align:justify; /*文字分散对齐*/

vertical-align属性

vertical-align:top; /*垂直向上对齐*/

vertical-align:bottom; /*垂直向下对齐*/

vertical-align:middle; /*垂直居中对齐*/

vertical-align:text-top; /*文字垂直向上对齐*/

vertical-align:text-bottom; /*文字垂直向下对齐*/

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: