HTML样式表,选择器

样式表

<style type="text/css">
<!--p
{
    <!--改变所有p标签 -->
    font-size:36px;
    color:#900;
    background-color:#6FF} -->
</style>
<link href="Untitled-3.css" rel="stylesheet" type="text/css" />引用
</head>
内联样式表
<div class="qq">div层标签<p>,默认占用一行</p></div>
<span style="background-color:#3F0">span层标签,默认使用多少占用多少
<p class="qq">今天天气不错</p><p id="qq">12345</p>
<a href="http://www.360.com">360官网</a>
<body>
</body>
</html>
View Code

内嵌样式表<p></p>

外部样式表Css类

@charset "utf-8";
/* CSS Document */

<style>
*{针对所有标签起作用,
    margin:0px;
    padding:0px;}
.qq 
{
    color:#CF0;
    background-color:#600;}
    .qq p
{
    color:#999;
    background-color:#600;}
    #qq{
        color:#CF0;
        background-color:#90C;
        text-decoration:none;
        font-size:36px}
a:link
{
    color:#000;
    text-decoration:none;}
a:visited{
    color:#000;
    text-decoration:none;}
a:hover{
    color:#F00;
    text-decoration:underline;}
a:active{
    color:#FF0;
    text-decoration:underline;}
</style>
View Code
 

选择器

1、标签选择器。<p></p>。

2、class选择器。.开头

3、ID选择器。#开头

  <div id="样式名"><>

原文地址:https://www.cnblogs.com/1ming/p/5307020.html