|
@@ -0,0 +1,109 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ .box {
|
|
|
+ width: 800px;
|
|
|
+ height: 800px;
|
|
|
+ border: 2px solid #000;
|
|
|
+ }
|
|
|
+ #part1 {
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ color: #f00;
|
|
|
+ font-size: 35px;
|
|
|
+ font-weight: bold;
|
|
|
+ background: #ff0;
|
|
|
+ display: inline-block;
|
|
|
+ /*想让文字 在 已知宽高的盒子 内 居中*/
|
|
|
+ text-align: center;
|
|
|
+ /* 间隔 */
|
|
|
+ line-height: 200px;
|
|
|
+ }
|
|
|
+ #part1:hover {
|
|
|
+ color: #fff;
|
|
|
+ background-color: #000;
|
|
|
+
|
|
|
+ }
|
|
|
+ #part2 {
|
|
|
+ width: 200px;
|
|
|
+ height: 200px;
|
|
|
+ color: #ff0;
|
|
|
+ font-size: 35px;
|
|
|
+ font-weight: bold;
|
|
|
+ background: #00f;
|
|
|
+ display: inline-block;
|
|
|
+ /*想让文字 在 已知宽高的盒子 内 居中*/
|
|
|
+ text-align: center;
|
|
|
+ /* 间隔 */
|
|
|
+ line-height: 200px;
|
|
|
+ }
|
|
|
+ /*
|
|
|
+
|
|
|
+ 将块级元素转成行内元素
|
|
|
+ display:inline
|
|
|
+ 将元素转成行内块元素
|
|
|
+ display:inline-block
|
|
|
+ 将元素转成行块元素
|
|
|
+ display: block;
|
|
|
+ */
|
|
|
+ span {
|
|
|
+ font-size: 22px;
|
|
|
+ }
|
|
|
+ /* 伪类选择器
|
|
|
+ :hover 滑过
|
|
|
+ :first-child 第一个子类
|
|
|
+ :last-child 最后一个子类
|
|
|
+ :nth-child(n) 自定义子类
|
|
|
+ even 偶数 2n
|
|
|
+ odd 奇数 2n+1
|
|
|
+ */
|
|
|
+ ul {
|
|
|
+ /* 取消列表默认样式 */
|
|
|
+ list-style: none;
|
|
|
+ }
|
|
|
+ ul li a {
|
|
|
+ /* 取消a标签的默认样式 */
|
|
|
+ text-decoration: none;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ ul li:first-child a {
|
|
|
+ color: plum;
|
|
|
+ }
|
|
|
+ ul li:last-child a {
|
|
|
+ color: blue;
|
|
|
+ }
|
|
|
+ ul li:nth-child(2n+1) a {
|
|
|
+ color: #0f0;
|
|
|
+ }
|
|
|
+ ul li:nth-child(2n+1):hover a {
|
|
|
+ color: #ff0;
|
|
|
+ }
|
|
|
+ ul li:hover a {
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="box">
|
|
|
+ <div id="part1">
|
|
|
+ 你好
|
|
|
+ </div>
|
|
|
+ <div id="part2">
|
|
|
+ <span>1</span>
|
|
|
+ <span>2</span>
|
|
|
+ </div>
|
|
|
+ <ul>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ <li><a href="">你好</a></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+</body>
|
|
|
+</html>
|