伪类及选择器

一、 

<!--html-->
 <!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>file</title>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body> 
	<h2>图书名称</h2>
	<p>《Java程序设计》</p>
	<p>《Java编程思想》</p>
	<p>《Java核心技术》</p>	
</body>
</html>
<!--css-->
h2{
	font-weight: bold;
}
p{
	font-weight: bold;
	font-size: 300;
}
p::selection{
	background-color: red;
	color: black;
}

二、

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>file</title>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body> 
	 <p>图书排行榜</p>
	 	<ul>
	 		<li>三体</li>
	 		<li>盗墓笔记</li>
	 		<li>三生三世十里桃花</li>
	 	</ul>
	 <p>游戏排行榜</p>
	 	<ol>
	 		<li>英雄联盟</li>
	 		<li>DOTA</li>
	 		<li>魔兽世界</li>
	 	</ol>	 
</body>
</html>
《!--css----》
p{
	font-weight: bold;
	color: black;
}
ul li{color: green;}
ol li{color: blue;}

三、

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>file</title>
	<link rel="stylesheet" type="text/css" href="index.css">
	<style type="text/css">
	div{
 	background: url(image/1.jpg);
 	background-size:500px 500px;
 	overflow-y:auto;
 	width: 300px;
 	height: 300px;
 	top: 300px;
 	left:50%;
 	position: absolute;
 	overflow:scroll; 
 	border: 2px dashed red;
 	color: white;
 }
	</style>
</head>
<body>
<div>asasa<br>sasa<br>sasasasasa<br>sasasa<br>sasa<br>sasasasasa<br>sasas<br>asas<br>asasasasas<br>asasasas<br>sasasasassasasa<br>sasasasas<br>sasasas<br>asasasasasasas<br>asasasasasa<br><br><br>sasasasasasa<br>sasasa<br>sasasas<br>asasasasasasasasas<br><br>a 
    </div>
</body>
</html>

四、

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>file</title>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>

      <div id="div1">
   		 	<div id="div2"></div> 
  	 </div>
  
</body>
</html>

 
 #div1{
			width: 300px;
            height: 300px;
            background-color: deepskyblue;
            position: relative;
 		}
#div2{
 			width: 100px;
            height: 100px;
            background-color: yellow;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            }
 

五、

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>file</title>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body >
		<div class="father">
      <div id="div1">HTML</div>
  	  <div id="div2">CSS</div> 
  	  <div id="div3">JavaScript</div>			
		</div>

</body>
</html>

.father{
 	background-color: pink;
 	width: 500px;
    height: 500px;
    border: 2px black solid;
 }
 div{
 	color: black;
 }
 #div1{
			width: 300px;
            height: 100px;
            background-color: yellow;
            position: relative;
            margin-top:80px;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
             margin-left:40px;
 		}
#div2{
 			width: 300px;
            height: 100px;
            background-color: yellow;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin-top:220px;
             margin-left:40px;
}

#div3{
 			width: 300px;
            height: 100px;
            background-color: yellow;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
             margin-top:360px;
             margin-left:40px;
}
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值