gpt4 book ai didi

javascript - 无显示改变输入方式 :none

转载 作者:太空宇宙 更新时间:2023-11-04 03:30:48 24 4
gpt4 key购买 nike

替换标准输入的常用方法是display:none输入,然后在标签中添加background-image

CSS:

input[type="checkbox"] {
display: none;
}
input[type="checkbox"]+label {
background: url('../images/checkbox_unchecked.png') left center no-repeat;
background-size: 25px;
}
input[type="checkbox"]:checked+label {
background: url('../images/checkbox_checked.png') left center no-repeat;
background-size: 25px;
}

问题:之后 HTML 被破坏了。当我想改变元素的方向时,我必须在 CSS 中改变它(background: right)。

如何更改输入字段的图像/样式而不先将其设置为display:none,然后再更改背景图像?它必须在 Android 2.3 中工作。

编辑:JSFiddle .

最佳答案

rtl 问题的简单解决方法(假设这是这里的主要问题,基于您的 JSFiddle 演示),也是在设置时对 dir 属性设置样式到“rtl”:

.styles[dir="rtl"] input[type="radio"]+label {
background-position: right; /* Set the background position to the right. */
padding-left: 0; /* Reset the left padding on the label. */
padding-right: 35px; /* Give the label some right padding. */
}

JSFiddle demo .


根据 Can I Use...,我上面使用的所有内容都应该在 Android 2.3 上运行.

关于javascript - 无显示改变输入方式 :none,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26337011/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com