h5-3

实体符(以&开头,以;结尾)

  <  &lt; 

  >  &gt;

  版权©  &copy;

  空格  &nbsp;

1 <em>倾斜</em>
2     <strong>加粗</strong>
3     <del>删除线</del>

不常用

 1     <div>
 2         <!-- 容器 -->
 3         这是头部
 4     </div>
 5     <div>
 6         这是主体
 7     </div>
 8     <div>
 9         这是<span>尾部</span><!--局部-->
10     </div>
1     <style>
2         span{
3             font-size: 26px;
4         }
5     </style>

css  (cascading stylesheet 负责页面的样式)

1、行内样式

  

1 <!-- 行内样式 -->
2     <p style="font-size:20px; color:red;">书山有路勤为径</p>

 2、内嵌式

1     <div>
2         我是一个div
3     </div>
1     <style type="text/css">
2         div{
3             width: 100px;
4             height: 100px;
5             background-color: orange;
6         }
7         /*嵌入式  内嵌式 */
8     </style>

 3、外接式(link写在head内)

1  <link rel="stylesheet" href="index.css">
2     <!-- rel表示外部文件和样式表的关系 -->

 index.css令创一个css文件,通过link链接

作用与1和2相同.

css语法

  选择器 {

    K:V;

    K:V;

    K:V;  

  }

  *1  选择器  选中元素(标签)

  *2  各种属性

选择器

  1、基本选择器

      标签选择器

        div {

        }

        h2 {

        }

      类选择器 (推荐经常使用)

 1 <p class="p1">第一段</p>
 2     <div>
 3         <div>
 4             <div>
 5                 <div>
 6                     <p>我隐藏的比较深</p>
 7                 </div>
 8             </div>
 9         </div>
10     </div>
11     <h2 class="p1 h2">二级标题</h2>
12     <p class="h2">文字居中</p>
1 .p1{
2             background-color: red;
3         }
4         .h2{
5             text-align: center; 
6             /* 让文字水平居中 */
7         }

      id选择器

   

1     <p>这是段落</p>
2     <p id="p2">这是段落</p>
3     <p>这是段落</p>
4     <div id="box">这是一个容器标签 可以放其他元素</div>
1     <style>
2         #p2{
3             background-color: red;
4         }
5         #box{
6             font-size: 30px;
7         }
8     </style>

原文地址:https://www.cnblogs.com/qianfur/p/12260860.html