2022.1.19 Javaweb CSS

CSS
2022.1.19 Javaweb CSS
CSS导入方式
2022.1.19 Javaweb CSS
1.2代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type>
        span{
               color:red;
               }
    </style>
</head>
<body>
    <div style="color:red">hello css</div>
    <span>hello css</span>
</body>
</html>

2022.1.19 Javaweb CSS
3.新建CSS 文件夹
创建demo.css

p{
    color:red;
}

2022.1.19 Javaweb CSS
<link>标签引入

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type>
        span{
               color:red;
               }
    </style>
    <link href="../CSS/demo.css"  rel="stylesheet"> 
</head>
<body>
    <div style="color:red">hello css</div>
    <span>hello css</span>
    <p> hello css </p>
</body>
</html>

CSS选择器
2022.1.19 Javaweb CSS
测试代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{color:red;}
        #name {
                color:blue;
                }
        .cls{
                color:yellow;
             }
    </style>
</head>
<body>
    <div>div1</div>
    <div id ="name">div2</div>
    <div class="cls">div3</div>
    <span class="cls">span</span>
</body>
</html>

效果
2022.1.19 Javaweb CSS

上一篇:剑指Offer 19.正则表达式匹配


下一篇:2022-1-19 C++STL—— 仿函数 functor