bootstrap4 常用类

- 日理万妓 2022-05-31 03:10 459阅读 0赞

字体类

  1. .lead { font-size: 1.25rem; font-weight: 300; }
  2. .display-1 { font-size: 6rem; font-weight: 300; line-height: 1.2; }
  3. .display-2 { font-size: 5.5rem; font-weight: 300; line-height: 1.2; }
  4. .display-3 { font-size: 4.5rem; font-weight: 300; line-height: 1.2; }
  5. .display-4 { font-size: 3.5rem; font-weight: 300; line-height: 1.2; }
  6. small,
  7. .small { font-size: 80%; font-weight: 400; }
  8. .initialism { font-size: 90%; text-transform: uppercase; }
  9. .align-baseline { vertical-align: baseline !important; }
  10. .align-top { vertical-align: top !important; }
  11. .align-middle { vertical-align: middle !important; }
  12. .align-bottom { vertical-align: bottom !important; }
  13. .align-text-bottom { vertical-align: text-bottom !important; }
  14. .align-text-top { vertical-align: text-top !important; }

列表类

  1. .list-unstyled { padding-left: 0; list-style: none; }
  2. .list-inline { padding-left: 0; list-style: none; }
  3. .list-inline-item { display: inline-block; }
  4. .list-inline-item:not(:last-child) { margin-right: 0.5rem; }

图片类

  1. .img-fluid { //以前是.img-responsive
  2. max-width: 100%;
  3. height: auto;
  4. }
  5. .img-thumbnail { //不是说移除了吗,怎么还有.之前是.thumbnail
  6. padding: 0.25rem;
  7. background-color: #fff;
  8. border: 1px solid #dee2e6;
  9. border-radius: 0.25rem;
  10. max-width: 100%;
  11. height: auto;
  12. }
  13. .figure {
  14. display: inline-block;
  15. }

容器类

  1. .container {
  2. width: 100%;
  3. padding-right: 15px;
  4. padding-left: 15px;
  5. margin-right: auto;
  6. margin-left: auto;
  7. }
  8. @media (min-width: 576px) {
  9. .container {
  10. max-width: 540px;
  11. }
  12. }
  13. @media (min-width: 768px) {
  14. .container {
  15. max-width: 720px;
  16. }
  17. }
  18. @media (min-width: 992px) {
  19. .container {
  20. max-width: 960px;
  21. }
  22. }
  23. @media (min-width: 1200px) {
  24. .container {
  25. max-width: 1140px;
  26. }
  27. }
  28. .container-fluid {
  29. width: 100%;
  30. padding-right: 15px;
  31. padding-left: 15px;
  32. margin-right: auto;
  33. margin-left: auto;
  34. }
  35. .order-12 { //flex 方式order属性用于更改在主轴方向上排列顺序。
  36. //order数值越小,排列越靠前,默认为0,可以为负数
  37. -webkit-box-ordinal-group: 13;
  38. -ms-flex-order: 12;
  39. order: 12;
  40. }
  41. .offset-1 { //margin方式
  42. margin-left: 8.333333%;
  43. }

table类

  1. //表格可以写入的类 *-active *-default *-primary secondary success danger warning
  2. //info light dark
  3. //响应式表格.table-responsive,使 Viewport 符合任何表格。或者 .table 中加 .table-responsive{-sm|-md|-lg|-xl}
  4. .table-responsive {
  5. display: block;
  6. width: 100%;
  7. overflow-x: auto;
  8. -webkit-overflow-scrolling: touch;
  9. -ms-overflow-style: -ms-autohiding-scrollbar;
  10. }
  11. .table-responsive > .table-bordered {
  12. border: 0;
  13. }

border类

  1. .border { border: 1px solid #dee2e6 !important; }
  2. .border-top { border-top: 1px solid #dee2e6 !important; }
  3. .border-right { border-right: 1px solid #dee2e6 !important; }
  4. .border-bottom { border-bottom: 1px solid #dee2e6 !important; }
  5. .border-left { border-left: 1px solid #dee2e6 !important; }
  6. .border-0 { border: 0 !important; }
  7. .border-top-0 { border-top: 0 !important; }
  8. .border-right-0 { border-right: 0 !important; }
  9. .border-bottom-0 { border-bottom: 0 !important; }
  10. .border-left-0 { border-left: 0 !important; }
  11. 边框颜色
  12. .border-primary { border-color: #007bff !important; }
  13. .border-secondary { border-color: #6c757d !important; }
  14. .border-success { border-color: #28a745 !important; }
  15. .border-info { border-color: #17a2b8 !important; }
  16. .border-warning { border-color: #ffc107 !important; }
  17. .border-danger { border-color: #dc3545 !important; }
  18. .border-light { border-color: #f8f9fa !important; }
  19. .border-dark { border-color: #343a40 !important; }
  20. .border-white { border-color: #fff !important; }
  21. 边框圆角
  22. .rounded { border-radius: 0.25rem !important; }
  23. .rounded-top { border-top-left-radius: 0.25rem !important; border-top-right-radius: 0.25rem !important; }
  24. .rounded-right { border-top-right-radius: 0.25rem !important; border-bottom-right-radius: 0.25rem !important; }
  25. .rounded-bottom { border-bottom-right-radius: 0.25rem !important; border-bottom-left-radius: 0.25rem !important; }
  26. .rounded-left { border-top-left-radius: 0.25rem !important; border-bottom-left-radius: 0.25rem !important; }
  27. .rounded-circle { border-radius: 50% !important; }
  28. .rounded-0 { border-radius: 0 !important; }

显示状态类

  1. .d-none { display: none !important; }
  2. .d-inline { display: inline !important; }
  3. .d-inline-block { display: inline-block !important; }
  4. .d-block { display: block !important; }
  5. .d-table { display: table !important; }
  6. .d-table-row { display: table-row !important; }
  7. .d-table-cell { display: table-cell !important; }
  8. .d-flex { display: -webkit-box !important; display: -ms-flexbox !important; display: flex !important; }
  9. .d-inline-flex { display: -webkit-inline-box !important; display: -ms-inline-flexbox !important; display: inline-flex !important; }
  10. 在固定大小显示隐藏
  11. .d-sm-none { //只提供一个例子 display: none !important; }

浮动类

  1. .float-left { float: left !important; }
  2. .float-right { float: right !important; }
  3. .float-none { float: none !important; }
  4. .float-xl-none { float: none !important; }

定位类

  1. .position-static { position: static !important; }
  2. .position-relative { position: relative !important; }
  3. .position-absolute { position: absolute !important; }
  4. .position-fixed { position: fixed !important; }
  5. .position-sticky { position: -webkit-sticky !important; position: sticky !important; }
  6. .fixed-top { position: fixed; top: 0; right: 0; left: 0; z-index: 1030; }
  7. .fixed-bottom { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1030; }

判断浏览器是否支持

  1. @supports ((position: -webkit-sticky) or (position: sticky)) {
  2. .sticky-top { position: -webkit-sticky; position: sticky; top: 0; z-index: 1020; }
  3. }

其他类

  1. .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; -webkit-clip-path: inset(50%); clip-path: inset(50%); border: 0; }
  2. .w-25 { width: 25% !important; }
  3. .w-50 { width: 50% !important; }
  4. .w-75 { width: 75% !important; }
  5. .w-100 { width: 100% !important; }
  6. .h-25 { height: 25% !important; }
  7. .h-50 { height: 50% !important; }
  8. .h-75 { height: 75% !important; }
  9. .h-100 { height: 100% !important; }
  10. .mw-100 { max-width: 100% !important; }
  11. .mh-100 { max-height: 100% !important; }
  12. .m-0 { margin: 0 !important; }
  13. .mt-0,
  14. .my-0 { margin-top: 0 !important; }
  15. .mr-0,
  16. .mx-0 { margin-right: 0 !important; }
  17. .mb-0,
  18. .my-0 { margin-bottom: 0 !important; }
  19. .ml-0,
  20. .mx-0 { margin-left: 0 !important; }
  21. .m-1 { margin: 0.25rem !important; }
  22. .mt-1,
  23. .my-1 { margin-top: 0.25rem !important; }
  24. .mr-1,
  25. .mx-1 { margin-right: 0.25rem !important; }
  26. .mb-1,
  27. .my-1 { margin-bottom: 0.25rem !important; }
  28. .ml-1,
  29. .mx-1 { margin-left: 0.25rem !important; }
  30. .m-2 { margin: 0.5rem !important; }
  31. .p-0 { padding: 0 !important; }
  32. .pt-0,
  33. .py-0 { padding-top: 0 !important; }
  34. .pr-0,
  35. .px-0 { padding-right: 0 !important; }
  36. .pb-0,
  37. .py-0 { padding-bottom: 0 !important; }
  38. .pl-0,
  39. .px-0 { padding-left: 0 !important; }
  40. .p-1 { padding: 0.25rem !important; }
  41. .pt-1,
  42. .py-1 { padding-top: 0.25rem !important; }
  43. .pr-1,
  44. .px-1 { padding-right: 0.25rem !important; }
  45. .m-sm-0 { margin: 0 !important; }
  46. .m-auto{ margin:auto !important; }

文字类

  1. .text-justify { text-align: justify !important; }
  2. .text-nowrap { white-space: nowrap !important; }
  3. .text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  4. .text-left { text-align: left !important; }
  5. .text-right { text-align: right !important; }
  6. .text-center { text-align: center !important; }
  7. .text-lowercase { text-transform: lowercase !important; }
  8. .text-uppercase { text-transform: uppercase !important; }
  9. .text-capitalize { text-transform: capitalize !important; }
  10. .font-weight-light { font-weight: 300 !important; }
  11. .font-weight-normal { font-weight: 400 !important; }
  12. .font-weight-bold { font-weight: 700 !important; }
  13. .font-italic { font-style: italic !important; }
  14. .text-white { color: #fff !important; }
  15. .text-primary { color: #007bff !important; }
  16. .text-dark { color: #343a40 !important; }
  17. a.text-dark:hover, a.text-dark:focus { color: #1d2124 !important; }
  18. .text-muted { color: #6c757d !important; }
  19. .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; }

显示与隐藏

  1. .visible { visibility: visible !important; }
  2. .invisible { visibility: hidden !important; }

发表评论

表情:
评论列表 (有 0 条评论,459人围观)

还没有评论,来说两句吧...

相关阅读

    相关

         字符串相关类:                "hello" 在编译期main()方法之前通过加载器加载进内存;它是字符串常量对象 。              

    相关

    包装类(Wrapper) 装箱:包装类使得一个基本数据类型的数据变成了类。 拆箱:将数字包装类中内容变为基本数据类型。 有了类的特点,可以调用类中的方法。 对于8

    相关

    1. String类:不可变的字符序列(如:String str = "atguigu"; str += "javaEE")     1.关注于String常用的方法!

    相关 Bootstrap 表单

    表单        单独的表单控件会被自动赋予一些全局样式。所有设置了 .form-control 类的 <input>、<textarea> 和 <select> 元素都将