Maison  >  Article  >  interface Web  >  Css+Div布局小结、_html/css_WEB-ITnose

Css+Div布局小结、_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 12:33:231201parcourir

1,群选择器.
  说明:当几个元素样式属性一样时,可以调用同一个申明,元素之间用逗号分隔、

p,td,li {
   font-size : 12px ;
}

2,派生选择器.
     说明:可以使用派生选择器给一个元素里的子元素定义样式,例如这样:

li strong {
    font-style : italic ;
    font-weight : normal ;
}

就是为li的子元素strong定义一个斜体不加粗的模式.
3.ID选择器.
     说明:用css布局主要用层div来实现,而div得样式通过'id选择器'来定义.
     例如我们首先定义一个层.

div >

     然后在样式表里这样定义、

#menubar {
    margin : 0px ;
    background : #FFFFF ;
}

      其中menubar是自己定义的div的名字,注意前面要加'#'号。
      id选择器同样也支持派生,例如:

#menubar p {
    text-aglin : right ;
    margin-top : 10px ;
}

      这个方法主要用来定义层,和那些比较复杂,有多个派生的子元素、
4.类别选择器。
      说明:css里面用一个点来表示类别选择器的定义,例如:

.12px{
   text-aglin:center;
   font-family:宋体;
   font-size:12px;
}

      在页面中,用class="类别名"的方法调用:

12px大小的字体

       这个方法比较灵活,可以随时新建和删除、
5.定义链接的样式(伪类样式)、
       说明:css中用4个伪类来定义链接样式,分别是:a:link,a:visited,a:hover,a:active。例如:

a:link { font-weight  :  bold  ; text-decoration  :  none  ; color  :  #c30  }
a:visited { font-weight  :  bold  ; text-decoration  :  none  ; color  :  #c60  }
a:hover { font-weight  :  bold  ; text-decoration  :  none  ; color  :  #FFFFF }
a:active { font-weight  :  bold  ; text-decoration  :  none  ; color  :  #EEE }

       以上语句分别定义了"链接,以访问过的链接,鼠标停在上方时,点下鼠标时"的样式.
       注意,以上4个样式可以"缺",但不可以打乱顺序,否则样式会跟你预想的不一样.他们的原则是:爱恨原则。
 即love hate原则,顺序是love中的"l"是link,"v"是visited,hate中的"h"是hover,"a"是active。

6.组合使用选择器创造精致的设计效果。
        用漂亮的图案代替普通无序列表沉闷的黑点,先用css规则告诉类别属性inventory的无序列表。

ul.inventory {
          list-style : disc url(/images/common/lister2.gig) inside ;
}

他的调用标记:

Code


  • Angelfish(67 items)

  • Angels/Frogfish(35 items)

  • Angelfish(5526 items)

  • Angelfish(15 items)

    • 7.缩写是按照顺时针的顺序.

      margin:25px 0 25px 0;

      8.行高.
               说明:正常行高的150%.

      line-height:150%;

               好了,最近几天在做项目Login和Main页面的布局与Css,又不是职业美工,边做边学,把有用的东西记录下来与大家分享。搁笔、

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn