css三种选择器

时间:2023-01-21 20:22:05

1.派生选择器

<html>
<head>
<link href="a1.css" type="text/css" rel="stylesheet">
</head>

<body>
<h1>ayaya</h1>
</body>
</html>

h1{
color:blue;
}

 

2.id选择器

 

<html>
<head>
<link href="a1.css" type="text/css" rel="stylesheet">
</head>

<body>
<p class="pclasss">ayaya</p>
</body>
</html>

#h1id{
color:blue;
}

 

3.类选择器

<html>

<head>

<link href="a1.css" type="text/css" rel="stylesheet">
</head>

<body>
<h1 id="h1id">This is my page</h1>
This is my JSP page

</body>
</html>

.pclasss
{
color:red;
}