CSS元素选择器

时间:2017-05-20 20:19:58   收藏:0   阅读:331

http://www.w3school.com.cn/css/css_selector_type.asp

最常见的 CSS 选择器是元素选择器。换句话说,文档的元素就是最基本的选择器。

如果设置 HTML 的样式,选择器通常将是某个 HTML 元素,比如 p、h1、em、a,甚至可以是 html 本身:

html {color:black;}
h1 {color:blue;}
h2 {color:silver;}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>CSS Test Website</title>
    <style type="text/css">
        html {
            color: black;
        }

        h1 {
            color: blue;
        }

        h2 {
            color: silver;
        }
    </style>
</head>
<body>
    <h1>This heading 1</h1>
    <h2>This heading 2</h2>
    <p>This is a normal paragraph.</p>
</body>
</html>

技术分享

尝试将html设置为red之后:html仅仅针对文本,无法对title起作用

技术分享

 

原文:http://www.cnblogs.com/chucklu/p/6882972.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!