我正在尝试使用CSS正确定位密码字段的拨动开关。问题是该定位在google chrome中很好用,但是在firefox和IE中不起作用。我试图找出解决方案,但是Web开发的初学者我没有解决办法。请帮助我找出解决方案。
我的HTML部分
<div id="password">
<label for="pwd">Password</label>
<div>
<input type="password" id="pwd" name="pass_word" autocomplete="off" maxlength="12" value="<?php echo $pwd; ?>">
<span class="icon"><i id="show-pwd" class="far fa-eye hide"></i></span>
<span class="icon"><i id="hide-pwd" class="far fa-eye-slash"></i></span>
</div>
<div id="perr" class="err"><?php echo $pwderr; ?></div>
</div>
<div id="confirm-password">
<label for="cnfpwd">Confirm Password</label>
<div>
<input type="password" id="cnfpwd" name="cnf_pwd" autocomplete="off" maxlength="12" value="<?php echo $cpwd; ?>">
<span class="icon"><i id="show-cnfpwd" class="far fa-eye hide"></i></span>
<span class="icon"><i id="hide-cnfpwd" class="far fa-eye-slash"></i></span>
</div>
<div id="cperr" class="err"><?php echo $cpwderr; ?></div>
</div>
我的CSS部分
.confirm-password{
position: relative;
}
.icon{
position: absolute;
transform: translate3d(-140%,40%,0);
color: #555;
}
第一个图像显示了它在chrome中的外观,第二个图像显示了在Firefox中的外观。
您div
的ID为,confirm-password
但CSS规则适用于类:.confirm-password
。更改.
为#
,您div
现在将已position: relative
分配给它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句