2018-07-12

1.css的樣式設(shè)置

1.背景

1.背景重復(fù)

         background-repeat:no-repeat|repeat-x|repeat-y
         
         background-repeat: no-repeat;

2.背景位置

        background-position-x:橫坐標(biāo)方向的位置
        background-position-y:縱坐標(biāo)方向的位置
        傳參 top,right,bottom,left,center

3.背景初步簡(jiǎn)寫

        background-position: x y;
         
        background-position: center center;

4.背景簡(jiǎn)寫

        background:color image repeat position

5.背景的吸附

       background-attachment:scroll|fixed;

6.背景大小

        background-size:x y;
        x -->width
        y -->height
        cover -->會(huì)覆蓋整個(gè)div  特點(diǎn):只能以大覆小

2.文本

1.文本顏色

    red -->純色
    #ff2d51
    rgb()

2.文本對(duì)齊

    text-align:left|center|right 

3.文本修飾

    text-decoration:none|underline|overline|line-through

4.文本縮進(jìn)

    text-indent 

5.文本轉(zhuǎn)換

     text-transfomr:uppercase|lowercase|capitalize

3.字體

1.最小的字體

   不要小于12px 
    font-size字體大小

2.字體樣式

    font-style:normal|italic

3.字體的權(quán)重

    font-weight:bold|bolder|lighter
    100-900

4.鏈接

    link -->沒有訪問的鏈接
    visited -->已經(jīng)訪問過的鏈接
    hover -->鼠標(biāo)移入到鏈接上的狀態(tài)
    active -->鼠標(biāo)點(diǎn)擊的那一刻

    tip:同時(shí)使用鏈接的這幾種狀態(tài),順序不打亂
1.png

5.列表

1.列表樣式

    list-style:none;

2.列表樣式類型

    list-style-type:disc|circle|square

3.列表樣式圖片

    list-style-image

6.表格

1.表格的簡(jiǎn)單模式和關(guān)鍵樣式

關(guān)鍵樣式:border-collapse: collapse;

     <style>
    table,th,td{
        width:500px;
        border:1px solid #333;
    }
    table{
       
        border-collapse: collapse;
        line-height: 50px;
        text-align: center;
    }
  </style>
    </head>
        <body>
         <table>
      <thead>
        <!-- tr  table row -->
        <tr><th>商城</th><th>手機(jī)</th></tr>
     </thead>
    <tbody>
        <!-- table data -->
        <tr><td>JD</td><td>蘋果</td></tr>
        <tr><td>Tmall</td><td>小米</td></tr>
        <tr><td>蘇寧</td><td>華為</td></tr>
    </tbody>
</table>
  </body>
2.png

2.跨越行row的表格

誰要跨越給誰rowspan

     <style>
    table,td{
        border: 1px solid #333;
    }
    table{
        text-align: center;
        border-collapse: collapse;
        width:500px;
        line-height: 50px;
    }
</style>
     </head>
    <body>
    <table>
    <tr><td rowspan="3">商城</td><td>鞋子</td> <td>衣服</td></tr>
    <tr>     <td>手機(jī)</td><td>錢包</td></tr>
    <tr>     <td>拖鞋</td><td>Tshirt</td></tr>
</table>
 </body>
3.png

3.跨越列的表格

誰跨越列就給誰colspan

      <style>
   
     table{
        width:500px;
        line-height: 50px;
        border-collapse: collapse;
        text-align: center;
    }
    table,td{
        border:1px solid #333;
    }
      </style>
  </head>
     <body>
    <table>
    <tr><td colspan="2">商場(chǎng)</td></tr>
    <tr><td>手機(jī)</td><td>衣服</td></tr>
    <tr><td>鞋子</td><td>pen</td></tr>
    <tr><td>服裝</td><td>瓶子</td></tr>
    </table>
  </body>
4.png

6.輪廓

1.div輪廓

        width:100px;
        height:100px;
        background:#ff2d51;
        outline: 10px solid #44cef6;
5.png

2.input

默認(rèn)情況


6.png

設(shè)置

     input{outline: none;}
7.png

7.設(shè)置元素的透明度

opacity設(shè)置元素的透明度

        div{
        width: 100px;
        height: 100px;
        background: red;
        opacity: 0.5;
        }

8.樣式的繼承

僅僅發(fā)生在塊級(jí)元素之間

1. 子元素不設(shè)置寬度,它會(huì)繼承父元素的寬度

     <style>
    .parent{
        width:200px;
        height:200px;
        background:red;
    }
    .child{
        height:100px;
        background:blue;
    }
    
</style>
</head>
<body>

<div class="parent">
    <div class="child"></div>
</div>
 </body>
8.png

2.父元素不設(shè)置height,它會(huì)獲取子元素的height

  <style>
     .parent{
        width:200px;
        background:red;
    }
    .child{
        width:100px;
        height:100px;
        background:blue;
    }
    </style>
    </head>
   <body>

<div class="parent">
    <div class="child"></div>
 </div>
   </body>
9.png

3.文本和字體相關(guān)屬性都是可以繼承的

     <style>
    body{
        text-align: center;
        color:red;
        text-decoration: underline;

        font-size: 30px;
    }
    ul{
        list-style: none;
    }
    table{
        border-collapse: collapse;
    }
</style>
 </head>
 <body>

<p>hello world</p>
<ul>
    <li>1</li>
    <li>1</li>
    <li>1</li>
</ul>
<div>
    hello
    <p>world</p>
</div>
</body>
10.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 問答題47 /72 常見瀏覽器兼容性問題與解決方案? 參考答案 (1)瀏覽器兼容問題一:不同瀏覽器的標(biāo)簽?zāi)J(rèn)的外補(bǔ)...
    _Yfling閱讀 14,189評(píng)論 1 92
  • HTML 5 HTML5概述 因特網(wǎng)上的信息是以網(wǎng)頁的形式展示給用戶的,因此網(wǎng)頁是網(wǎng)絡(luò)信息傳遞的載體。網(wǎng)頁文件是用...
    阿啊阿吖丁閱讀 4,981評(píng)論 0 0
  • 學(xué)會(huì)使用CSS選擇器熟記CSS樣式和外觀屬性熟練掌握CSS各種選擇器熟練掌握CSS各種選擇器熟練掌握CSS三種顯示...
    七彩小鹿閱讀 6,446評(píng)論 2 66
  • HTML基礎(chǔ)標(biāo)簽 1. ........ 定義段落 標(biāo)簽里面如果有多個(gè)空格,瀏覽器會(huì)默認(rèn)只有一個(gè)空格 瀏覽器顯示...
    環(huán)繞圈子閱讀 463評(píng)論 1 0
  • 學(xué)習(xí)CSS的最佳網(wǎng)站沒有之一 http://www.w3school.com.cn/tags/index.asp ...
    Amyyy_閱讀 1,200評(píng)論 0 1

友情鏈接更多精彩內(nèi)容