|
发表于 2019-10-26 08:16:04
|
显示全部楼层
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>让编程改变世界</title>
<style text="text/css">
html,body {
color: pink;
height: 100%;
font-family: sans-serif;
}
h1 {
font-size: 66px;
margin-bottom: 22px;
}
body {
background-size: cover;
background: url(003.jpg) center center;
margin: 0;
padding: 0;
position: relative;
}
#container {
position: absolute;
text-align: center;
width: 100%;
top: 50%;
<!-- container 这个div移到页面50% 下方,
想要真正实现内容也居中,则需要Y轴偏移-50%即可; -->
transform: translateY(-50%);
}
p {
font-size: 33px;
margin-bottom: 22px;
}
a {
font-size: 55px;
}
</style>
</head>
<body>
<div id="container">
<h1>我爱鱼C</h1>
<p>WWW.fishC.com -- 让编程改变世界</p>
<a href="http://bbs.fishc.com/forum-337-1.html">传送门</a>
</div>
</body>
</html>
不知为何竟然没居中~ |
|