CSS基本知识介绍

 CSS (Cascading Style Sheet)叠层样式表。用于控制网页样式并允许将样式信息与网页内容分离的一种标记性语言。

 样式的几种控制方法:

 1、行内样式         <div style="color:red ......"></div>

 2、内嵌式            <head><style>div{color:red;}</style><></head>

 3、链入式(推荐)<link herf=".css" type="text/css">

 4、导入样式        

<style>

 @import url(1.css)

</style>

 

  CSS基本语法:

         CSS选择器

               1、 标记选择器              div{属性设置;}

               2、 类别选择器               .classname{属性设置;}

               3、 ID选择器                 #id{属性设置;}

               4、 集体声明                  div a p ul li......{属性设置;}

               5、 优先级

                     ID>类>标记

    CSS继承

        子标记会继承父标记的所有样式,并可以自己修改,但不会影响父标记

    属性设置(字体)

     font-family:"微软雅黑";

     font-size:16;

     color:red;

     font-weight:"16 ";

     text-decoration: none/underline /overline/ine-through;

     对齐方式:

     padding:0px auto;  横向居中

     line-height:height值;竖直居中

   

posted @ 2015-09-21 12:56  马尔凯蒂  阅读(135)  评论(0编辑  收藏  举报