Blogger Information
Blog 4
fans 0
comment 0
visits 3010
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
图标,布局,元素类型,盒子模型
worldexecuteme
Original
483 people have browsed it

图标使用

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. /*字体代码引入*/
  10. @font-face {
  11. font-family: 'iconfont';
  12. src: url('./icon/iconfont.ttf?t=1625494972187') format('truetype');
  13. }
  14. .iconfont {
  15. font-family: "iconfont" !important;
  16. font-size: 16px;
  17. font-style: normal;
  18. -webkit-font-smoothing: antialiased;
  19. -moz-osx-font-smoothing: grayscale;
  20. }
  21. /********************************************/
  22. li:nth-of-type(n) {
  23. list-style-type: none;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <ul>
  29. <li><span class="iconfont">&#xe685; Rust</span></li>
  30. <li><span class="iconfont">&#xe60f; PHP</span></li>
  31. <li><span class="iconfont">&#xe636; User</li>
  32. </ul>
  33. </body>
  34. </html>

效果

布局与元素属性

html 文档的元素默认在浏览器的文档流中,一般从左向右。
元素可分为两类, 行内元素, 和块内元素。对应的排列方式与页面元素的排列方式是一致 所有页面是一个二维的空间, 只有宽和高二维空间中的元素排列只有二种方式: 水平, 垂直 默认先水平, 排列不下,再换行按垂直方向排列,只要这个元素的类型确定,例如是一个内联元素 display: inline,则这个元素 就水平排列, 一行显示不行就换行显示,如果这个元素的display:block, 就是一个块级元素,块元素二边默认会自动添加换行, 二边不允许存在其它元素,总是独占一行。

盒子模型

盒子模型常用属性有:width height border padding margin

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. .box {
  10. /**
  11. *margin是盒子的外边距,本事不在盒子大小的计算内。简写模式按顺时针。
  12. */
  13. margin: 10px 10px 10px 10px;
  14. /**
  15. *border是盒子的边框,改变他的值会改变真个盒子的大小。
  16. */
  17. border: solid 1px red;
  18. /**
  19. *padding是盒子的内边距,改变他的值会改变真个盒子的大小。简写模式按顺时针。
  20. */
  21. padding: 10px 10px 10px 10px;
  22. /**
  23. *width&height是元素的宽高,改变他的值会改变真个盒子的大小。
  24. */
  25. width: 300px;
  26. height: 300px;
  27. background-color: blueviolet;
  28. }
  29. .box1 {
  30. /*
  31. box-sizing: 会更改width, height 的计算方式
  32. 将值设置为border-box, width的计算讲包括:border, padding
  33. */
  34. box-sizing: border-box;
  35. width: 300px;
  36. height: 300px;
  37. padding: 10px;
  38. border: 10px solid red;
  39. background-color: blueviolet;
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <div class="box"></div>
  45. <div class="box1"></div>
  46. </body>
  47. </html>

box-sizing:border计算结果展示:

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!