您好,欢迎访问四川文乐途图包装有限公司!

全国咨询热线

18980820575
✕

营山网站设计公司,营山网页设计,营山网站维护,营山网站优化,seo优化,,营山网站建设,营山网站公司

Web表单美化CSS框架Topcoat

Topcoat同样是一款简洁的Web表单构建应用,和Semantic UI、BootMetro等CSS框架不同的是,Topcoat主要用于构建美化的Web表单,包括提交按钮、输入框、单选框/复选框、滑动杆、搜索框等表单元素。

创新互联技术团队十载来致力于为客户提供网站建设、成都做网站、品牌网站制作、网络营销推广、搜索引擎SEO优化等服务。经过多年发展,公司拥有经验丰富的技术团队,先后服务、推广了数千家网站,包括各类中小企业、企事单位、高校等机构单位。

Topcoat的特点

  • 小巧、简单、易用

  • 专注表单元素设计,每一个表单元素都非常精美

  • 支持移动化,让这些表单元素在移动端同样有着不错的效果

Topcoat相关组件实例

按钮

以蓝色按钮为例,相关代码如下:

HTML

 
 
  1. <button class="topcoat-button--large--cta" >Button</button>
  2. <button class="topcoat-button--large--cta" disabled>Button</button>
  3. CSS
  4. .topcoat-button--large--cta {
  5.   font-size: 0.875rem;
  6.   font-weight: 600;
  7.   line-height: 1.688rem;
  8.   padding: 0 0.875rem;
  9. }
  10. input[type="checkbox"] {
  11.   position: absolute;
  12.   overflow: hidden;
  13.   padding: 0;
  14.   border: 0;
  15.   opacity: 0.001;
  16.   z-index: 1;
  17.   vertical-align: top;
  18.   outline: none;
  19. }
  20. .checkbox {
  21.   -moz-box-sizing: border-box;
  22.   box-sizing: border-box;
  23.   background-clip: padding-box;
  24.   position: relative;
  25.   display: inline-block;
  26.   vertical-align: top;
  27.   cursor: default;
  28.   -webkit-user-select: none;
  29.   -moz-user-select: none;
  30.   -ms-user-select: none;
  31.   user-select: none;
  32. }
  33. .checkbox__label {
  34.   position: relative;
  35.   display: inline-block;
  36.   vertical-align: top;
  37.   cursor: default;
  38.   -webkit-user-select: none;
  39.   -moz-user-select: none;
  40.   -ms-user-select: none;
  41.   user-select: none;
  42. }
  43. .checkbox--disabled {
  44.   opacity: 0.3;
  45.   cursor: default;
  46.   pointer-events: none;
  47. }
  48. .checkbox:before,
  49. .checkbox:after {
  50.   content: '';
  51.   position: absolute;
  52. }
  53. .checkbox:before {
  54.   -moz-box-sizing: border-box;
  55.   box-sizing: border-box;
  56.   background-clip: padding-box;
  57. }
  58. input[type="checkbox"] {
  59.   position: absolute;
  60.   overflow: hidden;
  61.   padding: 0;
  62.   border: 0;
  63.   opacity: 0.001;
  64.   z-index: 1;
  65.   vertical-align: top;
  66.   outline: none;
  67. }
  68. .checkbox,
  69. .topcoat-checkbox__checkmark {
  70.   -moz-box-sizing: border-box;
  71.   box-sizing: border-box;
  72.   background-clip: padding-box;
  73.   position: relative;
  74.   display: inline-block;
  75.   vertical-align: top;
  76.   cursor: default;
  77.   -webkit-user-select: none;
  78.   -moz-user-select: none;
  79.   -ms-user-select: none;
  80.   user-select: none;
  81. }
  82. .checkbox__label,
  83. .topcoat-checkbox {
  84.   position: relative;
  85.   display: inline-block;
  86.   vertical-align: top;
  87.   cursor: default;
  88.   -webkit-user-select: none;
  89.   -moz-user-select: none;
  90.   -ms-user-select: none;
  91.   user-select: none;
  92. }
  93. .checkbox--disabled,
  94. input[type="checkbox"]:disabled + .topcoat-checkbox__checkmark {
  95.   opacity: 0.3;
  96.   cursor: default;
  97.   pointer-events: none;
  98. }
  99. .checkbox:before,
  100. .checkbox:after,
  101. .topcoat-checkbox__checkmark:before,
  102. .topcoat-checkbox__checkmark:after {
  103.   content: '';
  104.   position: absolute;
  105. }
  106. .checkbox:before,
  107. .topcoat-checkbox__checkmark:before {
  108.   -moz-box-sizing: border-box;
  109.   box-sizing: border-box;
  110.   background-clip: padding-box;
  111. }

单选框/复选框

以单选框为例,相关代码如下:

 
 
  1. HTML
  2. <!-- NO LABEL -->
  3. <label class="topcoat-radio-button">
  4.   <input type="radio" name="topcoat">
  5.   <div class="topcoat-radio-button__checkmark"></div>
  6. </label>
  7. <br>
  8. <br>
  9. <!-- LEFT LABEL -->
  10. <label class="topcoat-radio-button">
  11.   Left label
  12.   <input type="radio" name="topcoat">
  13.   <div class="topcoat-radio-button__checkmark"></div>
  14. </label>
  15. <br>
  16. <br>
  17. <!-- RIGHT LABEL -->
  18. <label class="topcoat-radio-button">
  19.   <input type="radio" name="topcoat">
  20.   <div class="topcoat-radio-button__checkmark"></div>
  21.   Right label
  22. </label>
  23. <br>
  24. <br>
  25. <!-- DISABLED -->
  26. <label class="topcoat-radio-button">
  27.   <input type="radio" name="topcoat" Disabled>
  28.   <div class="topcoat-radio-button__checkmark"></div>
  29.   Disabled
  30. </label>
  31. CSS:
  32. input[type="radio"] {
  33.   height: 1.063rem;
  34.   width: 1.063rem;
  35.   margin-top: 0;
  36.   margin-right: -1.063rem;
  37.   margin-bottom: -1.063rem;
  38.   margin-left: 0;
  39. }
  40. input[type="radio"]:checked + .topcoat-radio-button__checkmark:after {
  41.   opacity: 1;
  42. }
  43. .topcoat-radio-button {
  44.   color: #c6c8c8;
  45.   line-height: 1.063rem;
  46. }
  47. .topcoat-radio-button__checkmark:before {
  48.   width: 1.063rem;
  49.   height: 1.063rem;
  50.   background: #595b5b;
  51.   border: 1px solid #333434;
  52.   box-shadow: inset 0 1px #737373;
  53. }
  54. .topcoat-radio-button__checkmark {
  55.   position: relative;
  56.   width: 1.063rem;
  57.   height: 1.063rem;
  58. }
  59. .topcoat-radio-button__checkmark:after {
  60.   opacity: 0;
  61.   width: 0.313rem;
  62.   height: 0.313rem;
  63.   background: #c6c8c8;
  64.   border: 1px solid rgba(0,0,0,0.05);
  65.   box-shadow: 0 1px rgba(255,255,255,0.1);
  66.   -webkit-transform: none;
  67.   -ms-transform: none;
  68.   transform: none;
  69.   top: 0.313rem;
  70.   left: 0.313rem;
  71. }
  72. input[type="radio"]:focus + .topcoat-radio-button__checkmark:before {
  73.   border: 1px solid #0036ff;
  74.   box-shadow: inset 0 1px rgba(255,255,255,0.36), 0 0 0 2px #6fb5f1;
  75. }
  76. input[type="radio"]:active + .topcoat-radio-button__checkmark:before {
  77.   border: 1px solid #333434;
  78.   background-color: #3f4041;
  79.   box-shadow: inset 0 1px rgba(0,0,0,0.05);
  80. }
  81. input[type="radio"]:disabled:active + .topcoat-radio-button__checkmark:before {
  82.   border: 1px solid #333434;
  83.   background: #595b5b;
  84.   box-shadow: inset 0 1px #737373;
  85. }
  86. .range {
  87.   padding: 0;
  88.   margin: 0;
  89.   font: inherit;
  90.   color: inherit;
  91.   background: transparent;
  92.   border: none;
  93.   -moz-box-sizing: border-box;
  94.   box-sizing: border-box;
  95.   background-clip: padding-box;
  96.   vertical-align: top;
  97.   outline: none;
  98.   -webkit-appearance: none;
  99. }
  100. .range__thumb {
  101.   cursor: pointer;
  102. }
  103. .range__thumb--webkit {
  104.   cursor: pointer;
  105.   -webkit-appearance: none;
  106. }
  107. .range:disabled {
  108.   opacity: 0.3;
  109.   cursor: default;
  110.   pointer-events: none;
  111. }
  112. .range,
  113. .topcoat-range {
  114.   padding: 0;
  115.   margin: 0;
  116.   font: inherit;
  117.   color: inherit;
  118.   background: transparent;
  119.   border: none;
  120.   -moz-box-sizing: border-box;
  121.   box-sizing: border-box;
  122.   background-clip: padding-box;
  123.   vertical-align: top;
  124.   outline: none;
  125.   -webkit-appearance: none;
  126. }
  127. .range__thumb,
  128. .topcoat-range::-moz-range-thumb {
  129.   cursor: pointer;
  130. }
  131. .range__thumb--webkit,
  132. .topcoat-range::-webkit-slider-thumb {
  133.   cursor: pointer;
  134.   -webkit-appearance: none;
  135. }
  136. .range:disabled,
  137. .topcoat-range:disabled {
  138.   opacity: 0.3;
  139.   cursor: default;
  140.   pointer-events: none;
  141. }

更多关于Topcoat的组件,大家可以前往其官方网站进行学习。

友情链接 :