浅析Web表单美化CSS框架Topcoat
Topcoat同样是一款简洁的Web表单构建应用,和Semantic UI、BootMetro等CSS框架不同的是,Topcoat主要用于构建美化的Web表单,包括提交按钮、输入框、单选框/复选框、滑动杆、搜索框等表单元素。
以蓝色按钮为例,相关代码如下:
HTML
<button class="topcoat-button--large--cta" >Button</button>
<button class="topcoat-button--large--cta" disabled>Button</button>
CSS
.topcoat-button--large--cta {
font-size: 0.875rem;
font-weight: 600;
line-height: 1.688rem;
padding: 0 0.875rem;
}
input[type="checkbox"] {
position: absolute;
overflow: hidden;
padding: 0;
border: 0;
opacity: 0.001;
z-index: 1;
vertical-align: top;
outline: none;
}
.checkbox {
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
position: relative;
display: inline-block;
vertical-align: top;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox__label {
position: relative;
display: inline-block;
vertical-align: top;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox--disabled {
opacity: 0.3;
cursor: default;
pointer-events: none;
}
.checkbox:before,
.checkbox:after {
content: '';
position: absolute;
}
.checkbox:before {
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
}
input[type="checkbox"] {
position: absolute;
overflow: hidden;
padding: 0;
border: 0;
opacity: 0.001;
z-index: 1;
vertical-align: top;
outline: none;
}
.checkbox,
.topcoat-checkbox__checkmark {
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
position: relative;
display: inline-block;
vertical-align: top;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox__label,
.topcoat-checkbox {
position: relative;
display: inline-block;
vertical-align: top;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox--disabled,
input[type="checkbox"]:disabled + .topcoat-checkbox__checkmark {
opacity: 0.3;
cursor: default;
pointer-events: none;
}
.checkbox:before,
.checkbox:after,
.topcoat-checkbox__checkmark:before,
.topcoat-checkbox__checkmark:after {
content: '';
position: absolute;
}
.checkbox:before,
.topcoat-checkbox__checkmark:before {
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
}
Topcoat的特点
小巧、简单、易用
专注表单元素设计,每一个表单元素都非常精美
支持移动化,网站建设让这些表单元素在移动端同样有着不错的效果
Topcoat相关组件实例
按钮
单选框/复选框
以单选框为例,相关代码如下:
HTML
<!-- NO LABEL -->
<label class="topcoat-radio-button">
<input type="radio" name="topcoat">
<div class="topcoat-radio-button__checkmark"></div>
</label>
<br>
<br>
<!-- LEFT LABEL -->
<label class="topcoat-radio-button">
Left label
<input type="radio" name="topcoat">
<div class="topcoat-radio-button__checkmark"></div>
</label>
<br>
<br>
<!-- RIGHT LABEL -->
<label class="topcoat-radio-button">
<input type="radio" name="topcoat">
<div class="topcoat-radio-button__checkmark"></div>
Right label
</label>
<br>
<br>
<!-- DISABLED -->
<label class="topcoat-radio-button">
<input type="radio" name="topcoat" Disabled>
<div class="topcoat-radio-button__checkmark"></div>
Disabled
</label>
CSS:
input[type="radio"] {
height: 1.063rem;
width: 1.063rem;
margin-top: 0;
margin-right: -1.063rem;
margin-bottom: -1.063rem;
margin-left: 0;
}
input[type="radio"]:checked + .topcoat-radio-button__checkmark:after {
opacity: 1;
}
.topcoat-radio-button {
color: #c6c8c8;
line-height: 1.063rem;
}
.topcoat-radio-button__checkmark:before {
width: 1.063rem;
height: 1.063rem;
background: #595b5b;
border: 1px solid #333434;
box-shadow: inset 0 1px #737373;
}
.topcoat-radio-button__checkmark {
position: relative;
width: 1.063rem;
height: 1.063rem;
}
.topcoat-radio-button__checkmark:after {
opacity: 0;
width: 0.313rem;
height: 0.313rem;
background: #c6c8c8;
border: 1px solid rgba(0,0,0,0.05);
box-shadow: 0 1px rgba(255,255,255,0.1);
-webkit-transform: none;
-ms-transform: none;
transform: none;
top: 0.313rem;
left: 0.313rem;
}
input[type="radio"]:focus + .topcoat-radio-button__checkmark:before {
border: 1px solid #0036ff;
box-shadow: inset 0 1px rgba(255,255,255,0.36), 0 0 0 2px #6fb5f1;
}
input[type="radio"]:active + .topcoat-radio-button__checkmark:before {
border: 1px solid #333434;
background-color: #3f4041;
box-shadow: inset 0 1px rgba(0,0,0,0.05);
}
input[type="radio"]:disabled:active + .topcoat-radio-button__checkmark:before {
border: 1px solid #333434;
background: #595b5b;
box-shadow: inset 0 1px #737373;
}
.range {
padding: 0;
margin: 0;
font: inherit;
color: inherit;
background: transparent;
border: none;
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
vertical-align: top;
outline: none;
-webkit-appearance: none;
}
.range__thumb {
cursor: pointer;
}
.range__thumb--webkit {
cursor: pointer;
-webkit-appearance: none;
}
.range:disabled {
opacity: 0.3;
cursor: default;
pointer-events: none;
}
.range,
.topcoat-range {
padding: 0;
margin: 0;
font: inherit;
color: inherit;
background: transparent;
border: none;
-moz-box-sizing: border-box;
box-sizing: border-box;
background-clip: padding-box;
vertical-align: top;
outline: none;
-webkit-appearance: none;
}
.range__thumb,
.topcoat-range::-moz-range-thumb {
cursor: pointer;
}
.range__thumb--webkit,
.topcoat-range::-webkit-slider-thumb {
cursor: pointer;
-webkit-appearance: none;
}
.range:disabled,
.topcoat-range:disabled {
opacity: 0.3;
cursor: default;
pointer-events: none;
}
更多关于Topcoat的组件,大家可以前往其官方网站进行学习。
浅析Web表单美化CSS框架Topcoat相关推荐
- Web表单美化CSS框架Topcoat
Topcoat同样是一款简洁的Web表单构建应用,和Semantic UI.BootMetro等CSS框架不同的是,Topcoat主要用于构建美化的Web表单,包括提交按钮.输入框.单选框/复选框.滑 ...
- 【Java Web前端开发】HTML表单和CSS部分
文章目录 HTML标签:表单标签 CSS:页面美化和布局控制 案例: HTML标签:表单标签 * 表单:* 概念:用于采集用户输入的数据的.用于和服务器进行交互.* form:用于定义表单的.可以定义 ...
- web表单设计:点石成金_如何设计安全的Web表单:验证,清理和控制
web表单设计:点石成金 While cybersecurity is often thought of in terms of databases and architecture, much of ...
- Flask之Web表单使用
Web表单使用 @(Flask) request对象包含客户端发出的所有请求信息. request.form能获取POST请求中提交的表单数据. 使用的包 Flask-WTF可以把处理Web表单的过程 ...
- python-flask(二)集成bootstrap、集成web表单、集成邮件发送
文章目录 一.flask集成bootstrap 1. 什么是Bootstrap? 2. Flask中如何集成Bootstrap? 3. Flask-Bootstrap实现了什么? 二.Flask中集成 ...
- HTML 表格、表单和CSS初识
表格.表单和CSS初识 一.提问 html骨架结构是什么 常用标签有哪些 图像标签有哪些属性,绝对路径和相对路径的区别 链接标签有哪些属性,说出各个属性的作用 列表标签分几种,分别是什么 二.本章任务 ...
- html表单模板属性,HTML5超酷响应式表单美化模板插件
这是一款非常效果非常酷的HTML5超酷响应式表单美化效果插件.表单的整体效果使用扁平化风格,使用media queries来为各种屏幕创建响应式效果.在大屏幕上,整个表单分三列显示,当屏幕小到一定程度 ...
- Flask开发系列之Web表单
Flask开发系列之Web表单 简单示例 from flask import Flask, request, render_templateapp = Flask(__name__) @app.rou ...
- JavaScript/jQuery 表单美化插件小结
Niceforms Niceforms是一款独立的表单美化工具,当前版本为2.0 官方主页:http://www.emblematiq.com/lab/niceforms/ 官方演示:http://w ...
最新文章
- Samsung Pay体验札记:或推支付新浪潮
- Joomla2.5 JDate 时区日期运算
- 为什么在iOS上访问优酷和土豆一样可以播放呢?
- 【转】UML基础: 第1部分 - 类图 (Class Diagram)
- 快能通小学生计算机的游戏,亲子小游戏,帮助孩子更快学会交通安全知识
- python linux开发_python之Linux开发环境安装
- maven配置项目根路径_Java的项目构建工具Maven的配置和使用教程
- ros操作系统的介绍
- 滤波器截止频率理解?
- am 启动 activity 流程分析
- effective stl
- 端午节之苍南懒人游 (*^__^*) ……
- 学习三部曲:WHAT、HOW、WHY
- 学习线性代数-行列式 笔记(一)
- Python笔记day04(基础)|列表、元组
- python生词本查单词译文_GitHub - To-knowledge/Wudao-dict: 有道词典的命令行版本,支持英汉互查和在线查询。...
- sql子表求和在总表中显示,并参与搜索
- qq家园里游戏c语言,盘点腾讯旗下5款过气游戏,全部玩过的人都该结婚了吧
- Android8.0 修改默认铃声 添加新铃声
- 脚本自动化部署docker微服务,取代Jenkins
热门文章
- 我的读书笔记 -《人性的弱点》
- 沈阳市民有望年底前拿到“一卡通”社保卡
- 2021_WWW_Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation
- 云小朵软件内测分发测试平台说明文档
- 字典(dict),增删改查,嵌套
- 城市信息学其六-信息时代的城市概念化
- JS 进一法 四舍五入
- 测试工程师刚入职如何快速熟悉需求并输出测试用例?
- 最新全国手机号码归属地信息SQLite数据库2019年2月更新 1
- http状态码301和302详解及区别——辛酸的探索之路