当前位置:网站首页>About weights exercise

About weights exercise

2022-06-12 08:41:00 Little boy who likes hot pot

1. Weight is high or low , But the weight of inheritance is 0

2. Code :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>CSS Weight exercise </title>
    <style>
        .nav {
            color: red;
        }
        /*  The weight of inheritance is 0 */
        li {
            color: pink;
        }
    
    </style>
</head>
<body>
    
    <ul class="nav">
        <li> Four tragedies of life </li>
        <li> There is no broadband at home </li>
        <li> Not fast enough </li>
        <li> There is no traffic on the mobile phone </li>
        <li> No school wifi</li>
    </ul>
</body>
</html>

3. Running effect :

 4. Take the first one. li Change the color of to blue

Code :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>CSS Weight exercise </title>
    <style>
        .nav li{
            color: red;
        }

        /*  Take the first one. li Color bold  */
       /* blue  The weight is 10   .nav .blue  20 */
        .nav .blue{
            color: blue;
            font-weight: 700;
      }

    </style>
</head>
<body>
    
    <ul class="nav">
        <li class="blue"> Four tragedies of life </li>
        <li> There is no broadband at home </li>
        <li> Not fast enough </li>
        <li> There is no traffic on the mobile phone </li>
        <li> No school wifi</li>
    </ul>
</body>
</html>

Running effect :

 

a key : Higher weight , Give priority to implementation

原网站

版权声明
本文为[Little boy who likes hot pot]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203010547378361.html