|
发表于 2020-2-21 17:25:26
|
显示全部楼层
- <!DOCTYPE html>
- <html lang="zh">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>基础美化</title>
- <style type="text/css"> /*指定CSS的样式定义*/
- html,body{
- height: 100%;
- width: 100%;
- color: pink;
- font-family: sans-serif; /*系统默认最佳显示字体*/
- }
- body {
- background: url("../img/ilovefishc.jpg") center center; /*设置背景图水平和垂直位置为居中 */
- background-size: cover; /*背景图像扩展完全覆盖背景区域*/
- margin: 0; /*初始化外边距*/
- padding: 0; /*初始化内边距,提高自主控制*/
- position: relative; /*相对定位*/
- }
- #container {
- width: 100%; /*横向扩充满屏*/
- text-align: center; /*文字水平居中*/
- position: absolute; /*绝对定位*/
- top: 50%; /*距离顶端50%*/
- transform: translateY(-50%); /*自身沿Y轴整体上移一半*/
- }
- h1 {
- font-size: 66px; /*字体大小*/
- margin-bottom: 22px; /*控制h1标题与下面p之间的距离*/
- }
- p {
- font-size: 33px;
- margin-bottom: 22px;
- }
- a {
- font-size: 55px;
- background: #3ff; /*背景颜色*/
- color: #fff; /*字体颜色*/
- border: 1px solid #3ff; /*1px的实心边框*/
- border-radius: 10px; /*圆角边框*/
- padding: 10px 66px; /*上下两侧10px,左右两侧,66px*/
- text-decoration: none; /*none就是去掉链接下划线*/
- }
- </style>
- </head>
- <body>
- <div id="container">
- <h1>我爱鱼C</h1>
- <p>WWW.FishC.com - 让编程改变世界</p>
- <a href="http://www.ilovefishc.com">传送门</a>
- </div>
- </body>
- </html>
复制代码 |
|