html_样式表和常用样式属性

样式表: CSS 层叠样式表  Cascading Style Sheets

 样式表按出现的位置,可以分为三种

  1.行内样式表 出现在某一标签开始标签的style属性中

      <span style=""></span>

  2.内部样式表 出现在页面上部head标签中,写在style标签内

          <style type="text/css">

              span{

              color:#F00;

              font-size:36px;

              font-family:Georgia,"Times New Roman", Times, serif;

             }

       </style>

  3.外部样式表 写在html外部的css文件中,使用link标签引入到html页面中

       <link rel="stylesheet" type="text/css"href="style.css"/>

样式表按选择器分类,可以分为

 1.标签选择器,以标签名作为选择器

 2.类选择器,.name作为选择器,html页面的标签中用class="name"来引用

 3.id选择器,#name作为选择器,html页面的标签中用id="name"来引用

  选择器的优先级,修饰的标签越少,优先级越高

常用样式属性-文本属性

       line-height:50px;    /*行高,常用来调整文字纵向的位置*/

       text-align:center;   /*字体的横向位置*/

       text-decoration:none;   /*下划线等,常用来取笑链接下下划线*/

       font-weight:bold;     /*字体粗细*/

       font-family:宋体;  /*字体样式*/

       color:#00F;     /*字体颜色*/

       font-size:24px;  /*字体大小*/

常用样式属性-背景属性

       background-image:url(images/1.png);   /*背景图片路径*/

       background-repeat:no-repeat;         /*背景图片平铺样式*/

       background-position:-30px-30px;      /*背景位置*/

       background-color:#993;  /*背景颜色*/

常用样式属性-列表属性

       list-style:none;

 

c-盒子属性

  盒子属性,最重要的三样属性

   1.margin      外边距

   2.padding     内边距

   3.border      边框

  div里的widthheight不包括border,内边距和外边距是分开的,如div中有个div1divpadding-top10px,div1margin-top10px,  则divdiv1top上距离20px

常用样式属性-浮动float 可实现div的编排

  未使用float时,div会前后换行

  使用float后,div不前后换行,可以再不同的图层上

框架集frame

 <frameset rows="20%,*" frameborder="1">

       <frame src="头部.html"/>

           <frameset cols="20%,*"frameborder="1">

                  <frame src="左边.html" />

                  <frame src="主体.html" />

           </frameset>

 </frameset><noframes></noframes>

  frame时需要注释掉body

iframe

 <iframe src="http://www.baidu.com"style="width:800px;"></iframe>

  可写在body

伪类样式

       a{

              text-decoration:none;

       }

       a:link{color:#000}     /* 未访问的链接黑色*/

       a:visited{color:#F00}  /* 已访问的链接红色*/

       a:hover{color:#00F}    /* 当有鼠标悬停在链接上蓝色*/

       a:active{color:#0F0}     /* 被选择的链接 绿色*/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值