摘要:在原來有一篇文章寫到了效果篇純實(shí)現(xiàn)的思路與實(shí)例這篇文章主要寫各種自定義的復(fù)選框,實(shí)現(xiàn)如圖所示的復(fù)選框大致的代碼都如下所示那么對(duì)應(yīng)的代碼第一種實(shí)現(xiàn)如圖所示代碼
在原來有一篇文章寫到了《CSS效果篇--純CSS+HTML實(shí)現(xiàn)checkbox的思路與實(shí)例》.
這篇文章主要寫各種自定義的checkbox復(fù)選框,實(shí)現(xiàn)如圖所示的復(fù)選框:
大致的html代碼都如下所示:
那么對(duì)應(yīng)的css代碼:
body { background: #555; font-family: "Open Sans", sans-serif; font-weight: 300; } body h1, body h2 { color: #eee; font-size: 30px; text-align: center; margin: 20px 0 50px 0; -webkit-font-smoothing: antialiased; text-shadow: 0px 1px black; } body .ondisplay { text-align: center; border-bottom: 1px solid gray; padding: 20px 0; } body .ondisplay section { width: 100px; height: 100px; background: #555; display: inline-block; position: relative; text-align: center; margin-top: 5px; border: 1px solid gray; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; } body .ondisplay section:before { content: "click it"; color: #bbb; font-size: 12px; font-weight: 400; -webkit-font-smoothing: antialiased; text-shadow: 0px 1px black; } body .ondisplay section:after { content: attr(title); position: absolute; width: 100%; left: 0; bottom: 3px; color: #fff; font-size: 12px; font-weight: 400; -webkit-font-smoothing: antialiased; text-shadow: 0px 1px black; }
第一種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .slideOne */ .slideOne { width: 50px; height: 10px; background: #333; margin: 20px auto; position: relative; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideOne label { display: block; width: 16px; height: 16px; position: absolute; top: -3px; left: -3px; cursor: pointer; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); -moz-transition: all 0.4s ease; -o-transition: all 0.4s ease; -webkit-transition: all 0.4s ease; transition: all 0.4s ease; } .slideOne input[type=checkbox] { visibility: hidden; } .slideOne input[type=checkbox]:checked + label { left: 37px; }
第二種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .slideTwo */ .slideTwo { width: 80px; height: 30px; background: #333; margin: 20px auto; position: relative; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideTwo:after { content: ""; position: absolute; top: 14px; left: 14px; height: 2px; width: 52px; background: #111; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideTwo label { display: block; width: 22px; height: 22px; cursor: pointer; position: absolute; top: 4px; z-index: 1; left: 4px; background: #fcfff4; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-transition: all 0.4s ease; -o-transition: all 0.4s ease; -webkit-transition: all 0.4s ease; transition: all 0.4s ease; -moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); } .slideTwo label:after { content: ""; width: 10px; height: 10px; position: absolute; top: 6px; left: 6px; background: #333; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px black, 0px 1px 0px rgba(255, 255, 255, 0.9); -webkit-box-shadow: inset 0px 1px 1px black, 0px 1px 0px rgba(255, 255, 255, 0.9); box-shadow: inset 0px 1px 1px black, 0px 1px 0px rgba(255, 255, 255, 0.9); } .slideTwo input[type=checkbox] { visibility: hidden; } .slideTwo input[type=checkbox]:checked + label { left: 54px; } .slideTwo input[type=checkbox]:checked + label:after { background: #00bf00; } /* end .slideTwo */
第三種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .slideThree */ .slideThree { width: 80px; height: 26px; background: #333; margin: 20px auto; position: relative; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideThree:after { content: "OFF"; color: #000; position: absolute; right: 10px; z-index: 0; font: 12px/26px Arial, sans-serif; font-weight: bold; text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.15); } .slideThree:before { content: "ON"; color: #00bf00; position: absolute; left: 10px; z-index: 0; font: 12px/26px Arial, sans-serif; font-weight: bold; } .slideThree label { display: block; width: 34px; height: 20px; cursor: pointer; position: absolute; top: 3px; left: 3px; z-index: 1; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-transition: all 0.4s ease; -o-transition: all 0.4s ease; -webkit-transition: all 0.4s ease; transition: all 0.4s ease; -moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); } .slideThree input[type=checkbox] { visibility: hidden; } .slideThree input[type=checkbox]:checked + label { left: 43px; } /* end .slideThree */
第四種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .roundedOne */ .roundedOne { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .roundedOne label { width: 20px; height: 20px; cursor: pointer; position: absolute; left: 4px; top: 4px; background: -moz-linear-gradient(top, #222222 0%, #45484d 100%); background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%); background: linear-gradient(to bottom, #222222 0%, #45484d 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; } .roundedOne label:after { content: ""; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; background: #00bf00; background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%); background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%); background: linear-gradient(to bottom, #00bf00 0%, #009400 100%); filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .roundedOne label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); opacity: 0.3; } .roundedOne input[type=checkbox] { visibility: hidden; } .roundedOne input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .roundedOne */
第五種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .roundedTwo */ .roundedTwo { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .roundedTwo label { width: 20px; height: 20px; position: absolute; top: 4px; left: 4px; cursor: pointer; background: -moz-linear-gradient(top, #222222 0%, #45484d 100%); background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%); background: linear-gradient(to bottom, #222222 0%, #45484d 100%); -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; } .roundedTwo label:after { content: ""; width: 9px; height: 5px; position: absolute; top: 5px; left: 4px; border: 3px solid #fcfff4; border-top: none; border-right: none; background: transparent; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } .roundedTwo label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); opacity: 0.3; } .roundedTwo input[type=checkbox] { visibility: hidden; } .roundedTwo input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .roundedTwo */
第六種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .squaredOne */ .squaredOne { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .squaredOne label { width: 20px; height: 20px; position: absolute; top: 4px; left: 4px; cursor: pointer; background: -moz-linear-gradient(top, #222222 0%, #45484d 100%); background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%); background: linear-gradient(to bottom, #222222 0%, #45484d 100%); -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; } .squaredOne label:after { content: ""; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; background: #00bf00; background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%); background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%); background: linear-gradient(to bottom, #00bf00 0%, #009400 100%); -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; } .squaredOne label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); opacity: 0.3; } .squaredOne input[type=checkbox] { visibility: hidden; } .squaredOne input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .squaredOne */
第七種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .squaredTwo */ .squaredTwo { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .squaredTwo label { width: 20px; height: 20px; cursor: pointer; position: absolute; left: 4px; top: 4px; background: -moz-linear-gradient(top, #222222 0%, #45484d 100%); background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%); background: linear-gradient(to bottom, #222222 0%, #45484d 100%); -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white; } .squaredTwo label:after { content: ""; width: 9px; height: 5px; position: absolute; top: 4px; left: 4px; border: 3px solid #fcfff4; border-top: none; border-right: none; background: transparent; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } .squaredTwo label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); opacity: 0.3; } .squaredTwo input[type=checkbox] { visibility: hidden; } .squaredTwo input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .squaredTwo */
第八種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .squaredThree */ .squaredThree { width: 20px; position: relative; margin: 20px auto; } .squaredThree label { width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: -moz-linear-gradient(top, #222222 0%, #45484d 100%); background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%); background: linear-gradient(to bottom, #222222 0%, #45484d 100%); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.4); -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.4); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.4); } .squaredThree label:after { content: ""; width: 9px; height: 5px; position: absolute; top: 4px; left: 4px; border: 3px solid #fcfff4; border-top: none; border-right: none; background: transparent; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } .squaredThree label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); opacity: 0.3; } .squaredThree input[type=checkbox] { visibility: hidden; } .squaredThree input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .squaredThree */
第九種實(shí)現(xiàn)如圖所示:
html代碼:
css代碼:
/* .squaredFour */ .squaredFour { width: 20px; position: relative; margin: 20px auto; } .squaredFour label { width: 20px; height: 20px; cursor: pointer; position: absolute; top: 0; left: 0; background: #fcfff4; background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5); } .squaredFour label:after { content: ""; width: 9px; height: 5px; position: absolute; top: 4px; left: 4px; border: 3px solid #333; border-top: none; border-right: none; background: transparent; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } .squaredFour label:hover::after { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); opacity: 0.5; } .squaredFour input[type=checkbox] { visibility: hidden; } .squaredFour input[type=checkbox]:checked + label:after { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; } /* end .squaredFour */
總結(jié),所有自定義checkbox代碼如下:
CSS3 Checkbox Styles
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/51685.html
摘要:在原來有一篇文章寫到了效果篇純實(shí)現(xiàn)的思路與實(shí)例這篇文章主要寫各種自定義的復(fù)選框,實(shí)現(xiàn)如圖所示的復(fù)選框大致的代碼都如下所示那么對(duì)應(yīng)的代碼第一種實(shí)現(xiàn)如圖所示代碼 在原來有一篇文章寫到了《CSS效果篇--純CSS+HTML實(shí)現(xiàn)checkbox的思路與實(shí)例》.這篇文章主要寫各種自定義的checkbox復(fù)選框,實(shí)現(xiàn)如圖所示的復(fù)選框:showImg(https://segmentfault.com...
摘要:現(xiàn)在前端頁(yè)面效果日益豐富,默認(rèn)的組件樣式顯然不能滿足設(shè)計(jì)需求。前段時(shí)間開發(fā)項(xiàng)目中剛好接觸到相關(guān)的需求,在此特地整理下修改樣式的方法。它使用純編寫,沒有任何的文件。 現(xiàn)在前端頁(yè)面效果日益豐富,默認(rèn)的input組件樣式顯然不能滿足設(shè)計(jì)需求。前段時(shí)間開發(fā)項(xiàng)目中剛好接觸到相關(guān)的需求,在此特地整理下修改radio、CheckBox樣式的方法。 原理:大致原理都是使用原生的checkbox或inp...
摘要:現(xiàn)在前端頁(yè)面效果日益豐富,默認(rèn)的組件樣式顯然不能滿足設(shè)計(jì)需求。前段時(shí)間開發(fā)項(xiàng)目中剛好接觸到相關(guān)的需求,在此特地整理下修改樣式的方法。它使用純編寫,沒有任何的文件。 現(xiàn)在前端頁(yè)面效果日益豐富,默認(rèn)的input組件樣式顯然不能滿足設(shè)計(jì)需求。前段時(shí)間開發(fā)項(xiàng)目中剛好接觸到相關(guān)的需求,在此特地整理下修改radio、CheckBox樣式的方法。 原理:大致原理都是使用原生的checkbox或inp...
摘要:經(jīng)常能看到別人做前端的時(shí)候,實(shí)現(xiàn)一些漂亮的復(fù)選框或單選框按鈕,由于現(xiàn)在項(xiàng)目原因,很多單選框和復(fù)選框看起來很不好看,于是,心血來潮打算自己實(shí)現(xiàn)了一遍。 經(jīng)常能看到別人做前端的時(shí)候,實(shí)現(xiàn)一些漂亮的復(fù)選框或單選框按鈕,由于現(xiàn)在項(xiàng)目原因,很多單選框和復(fù)選框看起來很不好看,于是,心血來潮打算自己實(shí)現(xiàn)了一遍。 一、首先上css代碼: 其中,說明我以注釋的形式寫到里面; 關(guān)于z-index我是基于...
閱讀 3472·2023-04-25 18:52
閱讀 2484·2021-11-22 15:31
閱讀 1224·2021-10-22 09:54
閱讀 3010·2021-09-29 09:42
閱讀 605·2021-09-26 09:55
閱讀 909·2021-09-13 10:28
閱讀 1100·2019-08-30 15:56
閱讀 2107·2019-08-30 15:55