码迷,mamicode.com
首页 > 其他好文 > 详细

样式表

时间:2017-10-11 23:39:16      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:黑龙江   lin   content   精确   pre   href   blog   文件   htm   

 <body>
      <div style="color:#90F">更好发挥的返回结果还
      </div>
    
    </body>

上面代码:内联式,写在body里。控制精确,可重复性差。

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        div{color:#00F}
        </style>
    </head>
    <body>
      <div >十二级商量好看好看</div>   
    </body>
</html>

上面代码:内嵌式, 写在head里是双标记<style></style>。

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        div{color:#00F}
        </style>
        <link href="Untitled-2.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
      <div >输给韩国还是交换空间</div>   
    </body>
</html>

上面代码:外部样式新建一个css文件,用来放样式表。如果要在HTML文件中调用样式表,在HTML文件中右键----CSS样式----附加样式表。一般用link链接<link href="Untitled-2.css" rel="stylesheet" type="text/css" />

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        div{color:#00F}
        p{color:#0F0}
        </style>
    </head>
    <body>
      <div >世纪积极就能进家里可能</div>   
      <p>看我等级分为机破解</p>
      <p>今晚ID据了解第六空间</p>
    </body>

上面代码:标签选择器,用标签做选择

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        .sss{color:#F39}
        </style>
    </head>
    <body>
      <div class="ssss">好聚好散空间和覅了 <!--class样式-->
      </div>   
      <p>理发师飞机</p>
      <p>和龙魂时刻黑龙江</p>
    </body>

上面代码:class选择器是.开头

 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        #www{color:#F39}
        </style>
    </head>
    <body>
      <div >更好发挥的返回结果还   
      </div>   
      <p id="www">豆腐干山豆根很舒服</p>   <!--id样式-->
      <p>身体还是身体</p>
    </body>

上面代码:id选择器以#开头、

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        .sss{color:#F39}
        </style>
    </head>
    <body>
      <div ><p>更好发挥的返回结果还</p>
      </div>   
      <p class="sss">豆腐干山豆根很舒服</p>
      <p>身体还是身体</p>
      <p>防守对方法务</p>
      <p class="sss">委托人</p>
      <p>问题我</p>
      <p class="sss">让他 </p>
    </body>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        .sss{color:#F39}
        </style>
    </head>
    <body>
      <div ><p>更好发挥的返回结果还</p>
      </div>   
      <p class="sss">豆腐干山豆根很舒服</p>
      <p>身体还是身体</p>
      <p>防守对方法务</p>
      <p class="sss">委托人</p>
      <p>问题我</p>
      <p class="sss">让他 </p>
    </body>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <style type="text/css">
        *{color:#F39}
        </style>
    </head>
    <body>
      <div ><p>更好发挥的返回结果还</p>
      </div>   
      <p >豆腐干山豆根很舒服</p>
      <p>身体还是身体</p>
      <p>防守对方法务</p>
      <p >委托人</p>
      <p>问题我</p>
      <p >让他 </p>
    </body>

上面代码;*代表所有

 

 
 

样式表

标签:黑龙江   lin   content   精确   pre   href   blog   文件   htm   

原文地址:http://www.cnblogs.com/xiaohaihuaihuai/p/7653342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!