美化HTML表单控件
1.checkbox样式优化
效果图如下:
代码如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>checkbox美化</title> </head> <style type="text/css"> /*input框中颜色更改*/ .divBox{ display: flex; } .iconColor{ width: 80px; height: 80px; position: relative; } #color-input-red+label { display: block; width: 20px; height: 20px; cursor: pointer; position: absolute; border-radius: 4px; border:1px solid rgba(240, 84, 77, 1); top: 0; left: 0; background: white; } #color-input-red:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: rgba(240, 84, 77, 1); } input[type=checkbox] { visibility: hidden; } #color-input-orange+label { display: block; width: 20px; height: 20px; border-radius: 4px; cursor: pointer; position: absolute; top: 0; left: 0; background: rgba(234, 152, 54, 1); } #color-input-orange:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: white; } #color-input-yellow+label { display: block; width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: rgba(230, 192, 58, 1); } #color-input-yellow:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: white; } #color-input-green+label { display: block; width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: rgba(95, 189, 65, 1); } #color-input-green:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: white; } #color-input-blue+label { display: block; width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: rgba(61, 170, 230, 1); } #color-input-blue:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: white; } #color-input-purple+label { display: block; width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: rgba(195, 122, 211, 1); } #color-input-purple:checked+label::before { display: block; content: "2714"; text-align: center; font-size: 16px; color: white; } </style> <body> <div class="chat-windows-color-div"> <div class="divBox"> <div class="iconColor"> <input id="color-input-red" class="chat-button-location-radio-input" type="checkbox" name="color-input-red" value="#f0544d" /> <label for="color-input-red"></label> </div> <div class="iconColor"> <input id="color-input-orange" class="chat-button-location-radio-input" type="checkbox" name="color-input-orange" value="#ea9836" /> <label for="color-input-orange"></label> </div> <div class="iconColor"> <input id="color-input-yellow" class="chat-button-location-radio-input" type="checkbox" name="color-input-yellow" value="#e6c03a" /> <label for="color-input-yellow"></label> </div> <div class="iconColor"> <input id="color-input-green" class="chat-button-location-radio-input" type="checkbox" name="color-input-green" value="#5fbd41" /> <label for="color-input-green"></label> </div> <div class="iconColor"> <input id="color-input-blue" class="chat-button-location-radio-input" type="checkbox" name="color-input-blue" value="#3daae6" /> <label for="color-input-blue"></label> </div> <div class="iconColor"> <input id="color-input-purple" class="chat-button-location-radio-input" type="checkbox" name="color-input-purple" value="#c37ad3" /> <label for="color-input-purple"></label> </div> </div> </div> </body> </html>
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771782.input[type=file] 样式美化
效果图如下:
代码如下:
<style> .a-upload { padding: 4px 10px; height: 20px; line-height: 20px; position: relative; cursor: pointer; color: #888; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; display: inline-block; *display: inline; *zoom: 1 } .a-upload input { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; filter: alpha(opacity=0); cursor: pointer } .a-upload:hover { color: #444; background: #eee; border-color: #ccc; text-decoration: none } .file { position: relative; display: inline-block; background: #D0EEFF; border: 1px solid #99D3F5; border-radius: 4px; padding: 4px 12px; overflow: hidden; color: #1E88C7; text-decoration: none; text-indent: 0; line-height: 20px; } .file input { position: absolute; font-size: 100px; right: 0; top: 0; opacity: 0; } .file:hover { background: #AADFFD; border-color: #78C3F3; color: #004974; text-decoration: none; } </style> <a href="javascript:;" class="a-upload"> <input type="file" name="" id="">点击这里上传文件 </a> <a href="javascript:;" class="file">选择文件 <input type="file" name="" id=""> </a>
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667683.input[type=radio]的样式美化
效果图如下:
代码如下
<div> <p style="font-size:18px;margin-top:30px;color:rgba(0,0,0,0.44)">对吗?</p> <label class="demo--label"> <input class="demo--radio" type="radio" name="demo-radio"> <span class="demo--radioInput"></span>对 </label> <label class="demo--label"> <input class="demo--radio" type="radio" name="demo-radio"> <span class="demo--radioInput"></span>不对 </label> </div> <div> <p style="font-size:18px;margin-top:30px;color:rgba(0,0,0,0.44)">你喜欢的是?</p> <label class="demo--label"><input class="demo--radio" type="checkbox" name="demo-checkbox1"> <span class="demo--checkbox demo--radioInput"></span>A </label> <label class="demo--label"> <input class="demo--radio" type="checkbox" name="demo-checkbox2"> <span class="demo--checkbox demo--radioInput"></span>B </label> <label class="demo--label"> <input class="demo--radio" type="checkbox" name="demo-checkbox3"> <span class="demo--checkbox demo--radioInput"></span>C </label> </div> <style> .demo--label{margin:20px 20px 0 0;display:inline-block} .demo--radio{display:none} .demo--radioInput{background-color:#fff;border:1px solid rgba(0,0,0,0.15);border-radius:100%;display:inline-block;height:16px;margin-right:10px;margin-top:-1px;vertical-align:middle;width:16px;line-height:1} .demo--radio:checked + .demo--radioInput:after{background-color:#57ad68;border-radius:100%;content:"";display:inline-block;height:12px;margin:2px;width:12px} .demo--checkbox.demo--radioInput,.demo--radio:checked + .demo--checkbox.demo--radioInput:after{border-radius:0} </style>
12345678910111213141516171819202122232425262728293031324.input[type=text]的样式美化
效果图如下:
代码如下:
<input type="text" class="form_input" placeholder="请输入姓名" /> <style> input{ font-size:12px; /* 设置输入框中字体的大小 */ height:30px; /* 设置输入框的高度 */ border-radius:4px; /* 设置输入框的圆角的大小 */ border:1px solid #c8cccf; /* 设置输入框边框的粗细和颜色 */ color:#986655; /* 设置输入框中文字的颜色 */ outline:0; /* 将输入框点击的时候出现的边框去掉 */ text-align:left; /* 设置输入框中文字的位置 */ padding-left: 10px; display:block; /* 将输入框设置为块级元素 */ cursor: pointer; box-shadow: 2px 2px 5px 1px #ccc; } input::-webkit-input-placeholder{ color: #986655; font-size: 12px; } </style>
12345678910111213141516171819202122232425262728293031323334353637383940414243相关知识
bootstarp 的表单控件大小设置和class='form
HTML网页设计:十一、表单
前端===>HTML
LabVIEW界面设计之控件美化
JQuery给表单id元素、HTML标签id元素赋值
input时间表单默认样式修改(input[type=“date”])
HTML + CSS + JavaScript 两小时快速入门教程
Winform(C#) 国内开源美化控件主题库2:花木兰控件库
input时间表单默认样式修改(input[type="date"])
移动前端开发—Html
网址: 美化HTML表单控件 https://www.huajiangbk.com/newsview1356802.html
上一篇: JavaFX:使用CSS样式美化 |
下一篇: 串钱柳的主要价值以及花语:深深的 |
推荐分享

- 1君子兰什么品种最名贵 十大名 4012
- 2世界上最名贵的10种兰花图片 3364
- 3花圈挽联怎么写? 3286
- 4迷信说家里不能放假花 家里摆 1878
- 5香山红叶什么时候红 1493
- 6花的意思,花的解释,花的拼音 1210
- 7教师节送什么花最合适 1167
- 8勿忘我花图片 1103
- 9橄榄枝的象征意义 1093
- 10洛阳的市花 1039