css - 使用 css 设计输入 radio

标签 css input

<分区>

我用[input type="radio"]制作了这张幻灯片:http://jsfiddle.net/Jtec5/23/
代码:CSS:

#slideselector {
    position: absolue;
    top:0;
    left:0;
    border: 2px solid black;
    padding-top: 1px;
}
.slidebutton {
    height: 21px;
    margin: 2px;
}

我正在尝试使用 css 设置输入 radio 的样式,因此它看起来像这样:enter image description here有什么建议吗?

最佳答案

像这样

DEMO

CSS

#slideselector {
    position: absolue;
    top:0;
    left:0;
    border: 2px solid black;
    padding-top: 1px;
}
.slidebutton {
    height: 21px;
    margin: 2px;
}
#slideshow { 
    margin: 50px auto; 
    position: relative; 
    width: 240px; 
    height: 240px; 
    padding: 10px; 
    box-shadow: 0 0 20px rgba(0,0,0,0.4); 
}

#slideshow > div { 
    position: absolute; 
    top: 10px; 
    left: 10px; 
    right: 10px; 
    bottom: 10px;
    overflow:hidden;
}

.imgLike {
    width:100%;
    height:100%;
}
/* Radio */

input[type="radio"] {
    background-color: #ddd;
    background-image: -webkit-linear-gradient(0deg, transparent 20%, hsla(0,0%,100%,.7), transparent 80%),
                      -webkit-linear-gradient(90deg, transparent 20%, hsla(0,0%,100%,.7), transparent 80%);
    border-radius: 10px;
    box-shadow: inset 0 1px 1px hsla(0,0%,100%,.8),
                0 0 0 1px hsla(0,0%,0%,.6),
                0 2px 3px hsla(0,0%,0%,.6),
                0 4px 3px hsla(0,0%,0%,.4),
                0 6px 6px hsla(0,0%,0%,.2),
                0 10px 6px hsla(0,0%,0%,.2);
    cursor: pointer;
    display: inline-block;
    height: 15px;
    margin-right: 15px;
    position: relative;
    width: 15px;
    -webkit-appearance: none;
}
input[type="radio"]:after {
    background-color: #444;
    border-radius: 25px;
    box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.4),
                0 1px 1px hsla(0,0%,100%,.8);
    content: '';
    display: block;
    height: 7px;
    left: 4px;
    position: relative;
    top: 4px;
    width: 7px;
}
input[type="radio"]:checked:after {
    background-color: #f66;
    box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.4),
                inset 0 2px 2px hsla(0,0%,100%,.4),
                0 1px 1px hsla(0,0%,100%,.8),
                0 0 2px 2px hsla(0,70%,70%,.4);
}

关于css - 使用 css 设计输入 radio ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18272497/

相关文章:

html - 删除颜色输入内的边框

css - 帮助页脚背景图片

jquery - 当文本太长时,在文本框中使用 jQuery 模拟 "typing text"

c - 在 C 中使用 scanf() 连续读取两个字符

angularjs - 如何在 AngularJS 中自动将输入字段中的第一个字符大写?

html - 避免在 BlackBerry WebWorks 中选择字段的蓝色

javascript - 通过用户输入和 Javascript 更改特定表格单元格中的文本

html - 如何将 CSS 放入字符串中?

html - Chrome : Fixed background is displayed as it wasn't fixed

javascript - 将悬停转换为 jquery 的单击事件