css样式

来源:互联网 发布:依祈怎么淘宝不能买了 编辑:程序博客网 时间:2024/05/18 02:36

1.集体声明

如:多个标记设置同一样式,

h1,p,a{color:red}

多种选择武器可以混合使用

如 p#p1{color:red}

   <div>

      <p id=“p1”>这是一个段落</p>

   </div>

2,派生选择器

  <p>派生<span>选择器</span></p>

  写法:p sapn{color:blue;}

  先写父元素,后写子元素

3.属性选择器

通过属性来添加样式或者属性值

如:[name]{color:green;}

 <input type="text" name="username" />

4.文字样式

color:文本颜色

font-size:字体大小

font-family:字体 

font-weight:加粗 取值:bold 取消加粗 normal

font-style:italic ;  斜体

text-align:文本对齐方式  取值  left center right 

text-indent  首行缩进  取值   120%  或者   数值em(2em)

line-height:  行高     取值   120%  或者   数值em(2em)

letter-spacing: 字间距离  取值同上

word-spacing:主要针对于单

 text-transform:

               取值:    uppercase 大写 

                              lowercase 小写  

                             capitalize 首字母大写

  text-decoration: 

              取值:   underline; 下划线
                            overline   上划线
                            line-through  贯穿线(删除线)

background -color:背景颜色

background-image:  背景图  写法background-image:url("路径")

background-repeat  :平铺方式   取值  no-repeat(不平铺)

                                                               repeate-x(水平方向平铺)

                                                               repeat-y(垂直方向平铺)

background-position:定位

















0 0