1. box-sizing属性解决了什么问题

答案;通过box- sizing属性来指定内容区的边界在哪里


伪类选择器的参数 an+b的经典应用场景,实例演示

  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>伪类选择器的参数</title>
  8. </head>
  9. <body>
  10. <ul class="list">
  11. <li>item1</li>
  12. <li>item2</li>
  13. <li>item3</li>
  14. <li>item4</li>
  15. <li>item5</li>
  16. <li>item6</li>
  17. <li>item7</li>
  18. <li>item8</li>
  19. </ul>
  20. <style>
  21. /*:nth-0f-type(参数)*/
  22. /*大参数=an+ba,n,b=[0,1,2,3,4,..]*/
  23. /*a:系数, n:计算器乘, b:偏移量*/
  24. /*元素的有效编号: 必须从1开始,n是从0开始,b也是从0开始*/
  25. /* nth-of-type(3) h-of-type(on+3)*/
  26. .list > :nth-of-type(0n + 3) {
  27. /* background-color: darkkhaki; */
  28. }
  29. /* 1n+b: */
  30. .list > :nth-of-type(1n + 3) {
  31. /* background-color: red; */
  32. }
  33. /*k10+3=3*/
  34. /*1*1+3=4*/
  35. /*1*2+3=5*/
  36. /*大因为1乘任何数都不变,所以1可以不写*/
  37. .list > :nth-of-type(n + 3) {
  38. /* background-color: rebeccapurple;*/
  39. }
  40. /*匹配所有的偶数元素*/
  41. /*.list > :nth-of-type(2n) {
  42. background-color: rebeccapurple;
  43. }*/
  44. /* even表示偶数
  45. .list > :nth-of-type(even) {
  46. background-color: rebeccapurple;
  47. }*/
  48. /* 2 * 1 = 2 2*2 = 4 */
  49. /*奇数
  50. .list > :nth-of-type(2n + 1) {
  51. background-color: rebeccapurple;
  52. }*/
  53. /*.list > :nth-of-type(odd) {
  54. background-color: rebeccapurple;
  55. }*/
  56. /*前三个*/
  57. .list > :nth-of-type(-n + 3) {
  58. background-color: rebeccapurple;
  59. }
  60. /*-1*0+3=3
  61. 1*1+3=2
  62. 1*2+3=1
  63. 1*3+3=0(非法索引,匹配就结束了)*/
  64. /*后三个*/
  65. .list > :nth-last-of-type(-n + 3) {
  66. background-color: rebeccapurple;
  67. }
  68. /*大总结一下
  69. 1.获取指定的某一个:(
  70. 2,获取前几个,(n-b)
  71. 3.获取指定位置后的全部元素,(n+b)
  72. 4.获取全部偶数(2n/even)或奇数(2n+1/0dd)元素*/
  73. html {
  74. background-color: royalblue;
  75. }
  76. /*:root = html */
  77. :root {
  78. background-color: saddlebrown;
  79. }
  80. </style>
  81. <input type="text" />
  82. <input type="text" disabled />
  83. <style>
  84. input:disabled {
  85. background-color: red;
  86. }
  87. input:enabled {
  88. background-color: royalblue;
  89. }
  90. </style>
  91. </body>
  92. </html>

. 媒体查询移动优先与PC优先的区别与联系,实例演示

  1. /* 我只要动态的改变rem的大小,就可以动态的调整每个按钮的大小 */
  2. /* 移动优先,从最小的屏幕开始进行媒体查询 */
  3. /* @media (min-width:480px) {
  4. html {
  5. font-size: 12px;
  6. }
  7. }
  8. @media (min-width:640px) {
  9. html {
  10. font-size: 14px;
  11. }
  12. }
  13. @media (min-width:720px) {
  14. html {
  15. font-size: 16px;
  16. }
  17. }*/
  18. /* 桌面优先/pc优先 由大屏到小屏幕 */
  19. @media (max-width720px) {
  20. html {
  21. font-size: 16px;
  22. }
  23. }
  24. @media (min-width640px) {
  25. html {
  26. font-size: 14px;
  27. }
  28. }
  29. @media (min-width480px) {
  30. html {
  31. font-size: 12px;
  32. }
  33. }
  34. @media (min-width720px) {
  35. html {
  36. font-size: 16px;
  37. }
  38. }

更多相关文章

  1. box-sizing的作用+伪类选择器的参数 an+b 的应用+媒体查询:@media
  2. 你知道 JavaScript 中的 Arguments 对象都有哪些用途吗?
  3. 如何对接口参数的描述进行集中管理
  4. 一分钟学会使用ApiPost中的全局参数和目录参数
  5. 安装ApiPost-接口工具 发送HTTP请求
  6. 接口文档生成工具 一键生成文档 ApiPost
  7. 关于PHP的回调函数
  8. 给定一个数组筛选其偶数成员组成新的数组返回
  9. 0805作业 找出数组偶数 和 计算器

随机推荐

  1. HTML语言中img标签的alt属性和title属性
  2. 使用 html5 svg 绘制图形
  3. XSL:包括根本不工作
  4. 在不可见的webbrowser对象中模拟按键C#
  5. jquery将html转换为字符串和html
  6. img在div中不按百分比调整大小
  7. 为什么代码放到DW里运行,和用记事保存为H
  8. cordova HTML5第一次尝试
  9. jQuery SerialScroll:将类添加到活动项
  10. HTml中面试题 ---&&的作用以及||特点