好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CSS样式之背景、文本_html/css_WEB-ITnose

一、背景

1、背景颜色用background-color属性,例如:body{background-color:red}

2、用图像做背景用background-image属性,例如body{background-image:ul1(23.jpg)

3、背景由图片重复平铺用backgroud-repeat属性,repeat-x或repeat-y分别表示水平或垂直平铺,

no-repeat表示允许从任何方向上平铺

例如:body

{background-image:url(23.jpg)

background-repeat:repeat-x:) }

4、用background-position属性将背景定位,[位置:top、bottom、left、right、center、还可使用

百分比(50% 50%)、长度值(50px 50px)]

例如:body

{background-image:url(23.jpg)

background-position:center}

5、设置图片关联属性用background-attachment,例如下面的图片背景不会随文字的滚动而滚动

body{ background-image:url(23.jpg);

background-repeat:no-repeat;

background-attachment:fixed;}

二、文本

1、缩进文本用text-indent属性,最常见的是段落首行缩进,缩进值可以还负数

例如:p{text-indent:-5em},但设置负数容易超出浏览器窗口左边界,要特别注意;

缩进值单位可以是百分数%,长度单位px,度量单位em;

text-indent属性可以继承,例如:

div#outer {width:500px;}

div#inter {text-indent:10%}

p{width:200px;}

some text.some text.some text.

this is a pragramph

查看更多关于CSS样式之背景、文本_html/css_WEB-ITnose的详细内容...

  阅读:31次