HTML 超鏈接 文本修飾 背景屬性


1 鏈接偽類

a:link{屬性:值;}  a{屬性:值}效果是一樣的。

a:link{屬性:值;}       鏈接默認狀態

a:visited{屬性:值;}     鏈接訪問之后的狀態

a:hover{屬性:值;}      鼠標放到鏈接上顯示的狀態      a:active{屬性:值;}      鏈接激活的狀態

a:focus{屬性:值;}     獲取焦點

 

 

 

 

 

   文本修飾

text-decoration: none  |   underline   |     line-through

         a{
             color:red;
             text-decoration: none;        //設置無下划線
         }
            a:focus{
                color:orange;
            }
            a:hover{
                color:yellow;
                text-decoration: underline;       //設置加入下划線
            }

 

 

 

案 例:

        <style type="text/css">
        .nav{
        height:40px;
         background-color=#aaa;
         text-align:center;
        }
         a{
             display: inline-block;
             width:80px;
             height:40px;
             text-decoration: none;
             color:#000;
             font-weight:700;
         }
         a:hover{
           background-color:#eee;
           text-decoration: underline;

         }
          a.public{

               font-weight:700;
               color:#f14400;
          }

        </style>
    </head>
    <body>
    <div class="nav">
     <a href="#" class="public">天貓</a>
     <a href="#" class="public">聚划算</a>
     <a href="#"  class="public">超市</a>
     <a href="#"  class="public">頭條</a>
     <a href="#">阿里旅行</a>
     <a href="#">電器城</a>
     <a href="#">淘搶購</a>
     <a href="#">蘇寧</a>
     <a href="#">智能生活</a>

 

 

 

 

==================================================

 背景屬性

1.1   background-color     背景顏色

1.2   background-image    背景圖片

1.3   Background-repeat    repeat(默認)  |  no-repeat |   repeat-x   |  repeat-y     背景平鋪

1.4   Background-position  left  |  right  |  center  |  top  | bottom  背景定位

 

    <style type="text/css">
      .box{
          height:500px;
          background-color:#999;
          background-image:url("2.png");
          background-repeat:repeat-y;
      }

    </style>
</head>
<body>
    <div class="box"></div>

★方位值只寫一個的時候,另外一個值默認居中。

 

★寫2個方位值的時候,順序沒有要求。

 

 

 ★寫2個具體值的時候,第一個值代表水平方向,第二個值代表垂直方向。

 

 

 Background-attachment   背景是否滾動   scroll  |  fixed

 

   背景屬性連寫

★:連寫的時候沒有順序要求,url為必寫項。

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM