CSS3 :root 选择器 设置HTML文档的背景色:

 /* :Root root element of the document

html element
general styles
css variables
*/

INDEX.HTML:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS Tutorial</title>    
    <link rel="stylesheet" href="styles.css">

   
</head>
<body >
    <h1>i'm heading</h1>
    <p class="absolute">
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Ullam,
        tempore? Nobis nemo pariatur, harum veniam accusamus similique voluptatibus
rem alias.

    </p>
    <p class="responsive">
        Lorem ipsum dolor, sit amet consectetur adipisicing elit. Aliquid,
        velit, voluptates architecto autem facere optio animi in quis doloribus
        id provident enim blanditiis omnis ipsam eos sed nisi praesentium repellendus.        
    </p>
</body>
</html>

CSS:

/* :Root root element of the document
html element
general styles
css variables
*/
:root {
    background: yellowgreen;
    font-size: 110%;
}
h1 {
    font-size: 3rem;
}
.absolute {
    font-size: 20px;
}
.responsive {
    font-size: 1.5rem;
}

评论

此博客中的热门博文

又一款美国免费主机,无限流量动态X10hosting

Nginx【Docker系列】一个反向代理神器——Nginx Proxy Manager

这个网盘不限速,而且支持临时分享