- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
所以我在设置单选按钮的样式方面遇到了很大的麻烦,因此我设法让它在 Chrome 中完美运行,在 Firefox 中运行得很少,而在 IE 中则完全没有。
这是预期的外观(在 Chrome 中):
这是它在 Firefox 中的样子:
还有 IE...
我有一个 JSFiddle 供你们使用,但我似乎无法弄清楚如何让这个跨浏览器工作。有什么想法吗?
JSFiddle:http://jsfiddle.net/s5rpd97b/
强制粘贴代码,尽管它在 JSFiddle 上:
HTML:
<input style="background: url(http://socialavatarnetworkscript.com/media/img/male_avatar.png);margin-right: 240px;" class="gender" name="gender" type="radio" value="male">
<input style="background: url(http://socialavatarnetworkscript.com/media/img/female_avatar.png)" class="gender" name="gender" type="radio" value="female">
CSS:
input[type="radio"].gender::after{
background: rgba(0, 0, 0, 0.01);
position: absolute;
width: 170px;
height: 300px;
display: block;
content: '';
color: white;
font-size: 1px;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
input[type="radio"].gender:checked::after{
background: rgba(0, 0, 0, 0.8);
position: absolute;
width: 170px;
height: 300px;
display: block;
content: 'SELECTED';
border-radius: 4px;
color: white;
font-family: titillium, sans-serif;
font-weight: 500;
font-size: 22px;
text-align: center;
line-height: 300px;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
input[type="radio"]{
display: inline-block;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
border-radius: 4px !important;
outline: none !important;
border: none !important;
}
input[type="radio"].gender{
height: 300px;
width: 170px;
border-radius: 4px !important;
outline: none !important;
border: none !important;
}
最佳答案
如评论中所述,:after
和 :before
伪元素被插入到应用它们的元素内部。 :after
和 :before
不应将输入作为 <input>
使用元素不能有 child :(
解决方案是应用图像和 :after
radio 输入标签的伪元素。从语义的 Angular 来看,给标签赋值也很好。
radio 输入用display: none
隐藏并通过附有匹配 for
的相应标签选择它们和 id
属性。
input + label
仅在每次输入后直接定位标签元素。
input + label:after
和 input:checked + label:after
提供选定的不透明叠加和过渡动画
HTML
<div id="welcome-gender">
<input class="male" name="gender" type="radio" value="male" id="male-one">
<label for="male-one">Male One</label>
<input class="female" name="gender" type="radio" value="female" id="female-one">
<label for="female-one">Female One</label>
</div>
CSS
input[type="radio"]{
display: none;
}
label {
position: relative;
width: 170px;
height: 300px;
display: inline-block;
color: white;
font-size: 0;
border-radius: 4px;
}
.male + label {
background: url(http://socialavatarnetworkscript.com/media/img/male_avatar.png);
}
.female + label {
background: url(http://socialavatarnetworkscript.com/media/img/female_avatar.png)
}
input + label:after {
background: #FFF;
content: '';
}
input:checked + label:after {
background: rgba(0, 0, 0, 0.8);
position: absolute;
width: 170px;
height: 300px;
display: block;
content: 'SELECTED';
border-radius: 4px;
color: white;
font-family: titillium, sans-serif;
font-weight: 500;
font-size: 22px;
text-align: center;
line-height: 300px;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
关于html - 造型 radio 输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25345886/
有什么办法可以在shopify的css中获取页面标识符。 我想在 shopify 特定页面而不是所有页面中进行样式工作。 所以我想指定页面,主页或我构建的页面,博客页面或购物页面等。 最佳答案 你可以
我正在尝试设计 RadChart 的样式。这是一个条形图,我想更改条形的默认颜色。所以我使用了 RadChart.PaletteBrushes 并定义了 SolidBrush 颜色(在以下链接中找到了
我正在使用一个名为 play-services-plugins 的 Google 库至include Open Source Notices在我的应用程序上。 我可以毫无问题地实现它,但我不知道如何设
我正在尝试在 eclipse 中使用 papyrus Marte 进行建模,我想知道双向可导航关联与仅一个方向可导航关联之间的区别。 提前致谢。 最佳答案 因为它代表一个链接,所以一个关联有两个端点。
有什么方法可以设置由 Linkify.addLinks() 操作生成的链接的样式吗?具体来说,我想更改默认的蓝色。 谢谢 最佳答案 我认为样式 linkify 是可能的,但如果你想添加链接,你可能想使
我想知道是否可以设置栏的样式 http://puu.sh/3LSN8.png在那张图片中(在文本区域中)。 我不知道它叫什么,但它会闪烁,它是显示文本所在位置的栏。 谢谢。 最佳答案 它叫做 care
我对此很困惑。我搜索了教程,但找不到对我来说很有意义的教程,如何为 MathJax 输出设置 CSS 类?我只是想让字体变大。当前包括: 在我的页面底部。可以很好地渲染 TEX,但我想在上面设置一
我到处找这个,没有运气!我希望你们能帮助我:) 我正在制作一个自定义的 tumblr 主题,但有一件事我不喜欢它,即 tumblr 以表格方式显示其帖子评论。我的意思具体是这样的: 在 tumblr
我想为 KendoUI 元素的必填字段和无效字段设置样式(例如,必填输入的背景颜色不同)。 我使用的样式在这里: .k-textbox>input[required], .k-picker-wrap
我在设计这个 nvd3 line chart 时遇到了一些问题.我有很多看起来更接近我喜欢的方式,但 y 轴标签和图表之间的窄边距让我发疯。我能够对 x 轴标签使用负行间距,但显然这对 y 轴不起作用
有没有人用过这个控件?它在 firefox 中显示,顶部的关闭按钮一直向右移动,所以我想调整 css 或在其上使用 jquery 来修复它。有谁知道如何做到这一点?我一直在尝试使用 DialogCss
我正在尝试根据其工作位置来设置常规 WP 循环的样式。我在循环中添加了检查以查看它的位置并相应地添加类并且一切正常。 问题是,当我打开 Style.CSS 以使用这些类并添加属性时,它不起作用。所以我
我有一些单选按钮,但文本看起来离单选按钮很远,我想让文本更靠近单选按钮 这是我的代码 ion-row radio-group (ionChange)="onChange($event)">
默认情况下,core-scaffold 侧边导航的背景颜色为白色,内容的背景颜色接近于灰色。我想反转这些样式,使侧导航的背景颜色为灰色,内容为白色。 我添加了以下规则,它们在 Chrome 上执行我想
我想在“标签”标签内设置单选输入的样式。我已经改变了背景颜色,但是当我点击我的 radio 时,里面的白点没有出现。我为此编写了代码,但我真的不知道问题出在哪里。
似乎对于造型 polymer 1.0 元素基本上有两种选择: 通过自定义样式设置样式: 样式可以应用于 ...部分。在此,您可以调整预定义的样式。 通过 dom-module 元素设置样式: 另一个例
有没有办法在没有插件的情况下设置 facebook likebox 的样式?我的点赞框在深色背景上,蓝色链接表示我的 Facebook 页面名称没有很好地融合,我想更改点赞框内的所有文本颜色,我必须使
我能否以在集合中的每个单选按钮之间出现换行符的方式设置这些样式? f.collection_radio_buttons( :chosen, [['A1', 1],['A2', 2], ['A3
我正在尝试根据条件为数据框的文本或单元格着色。这是我的代码。它有效: def Highlight_Majors(val): color = 'blue' if val == "Austria"
我正在尝试将图像设置为 Sherlock 操作栏的背景,但即使它是 720 x 112 像素,图像似乎也不会拉伸(stretch)。白色部分仍然是操作栏的一部分,因为三角形设置在正确的位置并且右侧的按
我是一名优秀的程序员,十分优秀!