無序列表、有序列表、定義列表多樣選擇設置屬性值


  1 <!DOCTYPE html>
  2 
  3     <html lang="en">
  4     
  5     <head>
  6         <meta charset="UTF-8">
  7         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8         <meta http-equiv="X-UA-Compatible" content="ie=edge">
  9         <title>Document</title>
 10         <!-- /*內聯樣式*/ -->
 11         <style>
 12                     ul{
 13                 width: 300px;
 14                 height: 500px;
 15                 margin: auto;
 16             }
 17             ul>li{
 18                 width: 100%;
 19                 height:50px; 
 20                 outline: 1px solid black;
 21             }
 22              /* //去掉前面的符號 */
 23                /* //給列表前面添加羅馬數字 */
 24             ul>li {
 25                
 26                 list-style: none;
 27               
 28                 /* list-style: lower-roman; */
 29     
 30             }
 31     
 32             /* //選擇列表中的第四項 */
 33     
 34             /*  ul>li:nth-child(4) {
 35                 background-color: red;
 36             } */
 37     
 38             /* //選擇列表中的最后一項 */
 39     
 40             /*  ul>li:last-child {
 41                 background-color: red;
 42             } */
 43     
 44             /* //選擇列表的奇數 */
 45     
 46             /*  ul>li:nth-child(odd) {
 47                 background-color: red;
 48             } */
 49     
 50             /* //選擇列表中的雙數 */
 51     
 52             /*  ul>li:nth-child(even) {
 53                 background-color: orange;
 54             } */
 55     
 56             /* //選擇中間間隔兩個列表 */
 57     
 58             /*  ul>li:nth-child(3n+1) {
 59                 background-color: red;
 60             } */
 61     
 62             /* //除了最后一個其他的全部選擇 */
 63     
 64              ul>li:not(:last-child) {
 65                 background-color: red;
 66             }
 67     
 68             /* //選擇列表的前三個列表 */
 69     
 70             /*  ul>li:nth-child(-n+3) {
 71                 background-color: red;
 72             } */
 73     
 74             /* //選擇列表的第三個 */
 75     
 76             /* ul>li:nth-child(3) {
 77                 background: #ff0000;
 78             } */
 79         </style>
 80     
 81     </head>
 82     
 83     <body>
 84         <!-- 無序列表: -->
 85         <ul>
 86             <li></li>
 87             <li></li>
 88             <li></li>
 89             <li></li>
 90             <li></li>
 91             <li></li>
 92             <li></li>
 93             <li></li>
 94             <li></li>
 95             <li></li>
 96         </ul>
 97         <!-- 有序列表: -->
 98         <!-- <ol>
 99             <li></li>
100             <li></li>
101         </ol> -->
102         <!-- 定義列表: -->
103         <!-- <dl>
104             <dt>
105                 <dd></dd>
106                 <dd></dd>
107             </dt>
108         </dl> -->
109     </body>
110     
111     </html>
 
        

 


免責聲明!

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



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