首页 > Web开发 > 详细

CSS-简单的入门

时间:2019-06-16 23:36:43      阅读:158      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 6     <meta http-equiv="X-UA-Compatible" content="ie=edge">
 7     <title>CSS Crush Course</title>
 8     <link rel="stylesheet" href="CSS/style.css">
 9 </head>
10 <body>
11     <div class="container">
12         <div class="box1">
13             <h1>Hello World</h1>
14             <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis quod dignissimos deleniti vero quasi 
15                 aliquid cum molestiae voluptatibus inventore sunt reprehenderit, ab, neque provident magnam ducimus, offi
16                 ciis asperiores iure quis excepturi. Cumque nulla quaerat non inventore culpa laboriosam illum, nemo tempor
17                 ibus ea qui velit ab laborum delectus esse expedita rem, est dolore ad reiciendis quasi ipsa ex commodi! Exp
18                 edita corrupti tempore unde nihil quos culpa, provident, excepturi labore magnam beatae quae optio officia h
19                 ic pariatur neque repellat dolorum harum voluptatem repudiandae nam, ducimus est voluptatum necessitatibus. Tempore
20                 ducimus laboriosam maxime ipsum accusantium totam est temporibus, doloremque, nesciunt esse atque ab.</p>            
21         </div>
22         <div class="box2">
23             <h1>Nice to meet you</h1>
24             <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia reprehenderit voluptates ratione, ipsam 
25                 asperiores dicta atque, in nesciunt facere commodi repellendus pariatur consequatur, inventore aliquid aspernatur
26                  molestiae sequi. Neque, eveniet blanditiis debitis quisquam officia optio minima praesentium repellat! Aut sint 
27                  maiores, voluptatibus earum neque facilis asperiores quasi perspiciatis delectus dolores debitis accusamus eveniet 
28                  harum. Similique sit corporis, labore possimus voluptate ut odit nobis! Adipisci, hic. Doloribus, ullam totam? Ad 
29                  repudiandae ratione fugit repellat inventore maiores, doloremque culpa officiis sint at?</p>
30                  <button type = "submit">提交</button>
31         </div>
32         <div class="list">
33             <ul>
34                 <li><a href = "#">List 1</a></li>
35                 <li><a href = "#">List 2</a></li>
36                 <li><a href = "#">List 3</a></li>
37                 <li><a href = "#">List 4</a></li>
38                 <li><a href = "#">List 5</a></li>
39                 <li><a href = "#">List 6</a></li>
40             </ul>
41         </div>
42         <div class="block" id="block1">
43             <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Atque nisi impedit temporibus doloribus amet nam molestias ab
44              consequatur odit perferendis eligendi totam laudantium voluptas obcaecati, facere ratione quisquam, dicta iure.</p>
45         </div>
46         <div class="block" id="block2">
47             <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Atque nisi impedit temporibus doloribus amet nam molestias ab
48                 consequatur odit perferendis eligendi totam laudantium voluptas obcaecati, facere ratione quisquam, dicta iure.</p>
49         </div>
50         <div class="clearfix"></div>
51         <div class="position-box">
52             <h1>heading1</h1>
53             <h2>heading2</h2>
54         </div>
55     </div>
56     <div style = "margin-bottom: 1000px"></div>
57     <button id="fixed">提交</button>
58 </body>
59 </html>
  1 body {
  2     background-color: #f4f4f4;
  3     font-family: "times new roman",serif;
  4     font-size: 20px;
  5 }
  6 
  7 .clearfix {
  8     clear: both;
  9 }
 10 
 11 .box1 {
 12     background-color: antiquewhite;
 13     color: chocolate;
 14 
 15     border:5px chocolate solid;
 16     border-radius: 30px;
 17 
 18     padding-top: 10px;
 19     padding-bottom: 10px;
 20     padding-left: 18px;
 21     padding-right: 18px;
 22 
 23     margin-top: 30px;
 24 }
 25 
 26 .box1 h1 {
 27     font-family: Arial, Helvetica, serif;
 28     /*下面一句代码是加下划线*/
 29     /*text-decoration: underline;*/
 30     letter-spacing: 6px;
 31     word-spacing: 36px;
 32     text-align: center;
 33     margin-top: 10px;
 34     margin-bottom: 0px;
 35     font-size: 36px;
 36 }
 37 
 38 .box1 p {
 39     margin-top: 6px;
 40     margin-bottom: 6px;
 41     margin-left: 5px;
 42     margin-right: 5px;
 43 }
 44 
 45 .box2 {
 46     background-color: purple;
 47     color: #fff;
 48 
 49     border: dodgerblue solid 6px;
 50     border-radius: 18px;
 51 
 52     padding-left:12px;
 53     padding-right:12px;
 54 
 55     margin-top: 30px;
 56 }
 57 
 58 .box2 h1 {
 59     color: aquamarine;
 60 
 61     font-size: 36px;
 62 
 63     text-align: center;
 64 
 65     padding-top: 5px;
 66     padding-bottom: 5px;
 67 
 68     margin-top: 5px;
 69     margin-bottom: 5px;
 70 }
 71 
 72 .box2 p {
 73     margin-top: 5px;
 74     margin-bottom: 5px;
 75 }
 76 
 77 .box2 button {
 78     background-color: black;
 79     color: #fff;
 80 
 81     margin-top: 5px;
 82     margin-bottom: 10px;
 83 
 84     padding:5px 20px;
 85 }
 86 
 87 .box2 button:hover {
 88     background-color: blue;
 89 }
 90 
 91 .box2 button:active {
 92     background-color: red;
 93 }
 94 
 95 .container {
 96     width: 80%;
 97     margin: auto;
 98 }
 99 
100 .list {
101     margin: 20px 0px;
102 }
103 
104 .list li {
105     /*list-style square 是将项目符号改为方块*/
106     list-style: square;
107     list-style-image: url(‘../image/icon.jpg‘);
108 }
109 
110 a {
111     text-decoration: none;
112     color: #e48614;
113 }
114 
115 a:hover {
116     color: cyan;
117 }
118 
119 /* a:visited 表示超链接被访问过的事件 */
120 /* a:visited {
121     color: blue;
122 } */
123 
124 .block {
125     background: blanchedalmond;
126     float:left;
127     width: 50%;
128     border: 1px solid chocolate;
129     box-sizing: border-box; 
130 }
131 
132 .block p {
133     margin : 5px 2px;
134 }
135 
136 /* 使两个vid边框之间的重叠部分消除 */
137 #block1 {
138     margin: -1px -1px;
139 }
140 
141 #block2 {
142     margin: -1px -1px;
143 }
144 
145 .position-box {
146     width: 500px;
147     height: 500px;
148     border: 1px solid chocolate;
149     position: relative;
150 }
151 
152 .position-box h1 {
153     position: absolute;
154     right: 0;
155 }
156 
157 .position-box h2 {
158     position: absolute;
159     bottom: 0;
160 }
161 
162 #fixed {
163     padding: 5px 15px;
164     background: cyan; 
165     position: fixed;
166     right: 0;
167     bottom: 0;
168 }

技术分享图片

CSS-简单的入门

原文:https://www.cnblogs.com/sucker/p/11036762.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!