一、
<!--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;
}