【发布时间】:2021-04-18 14:17:36
【问题描述】:
我的 HTML 代码如下:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="leftFormComp">
<!-- Password Box -->
<div class="selectWrapper">
<!-- add class "error" to show validation message -->
<label for="ext-comp-1037" class="inputLabel"><fmt:message key="registration.password"/>: <span class="required">*</span></label>
<div id="x-form-el-ext-comp-1037" class="x-form-element">
<input type="password" class="required" name="password" id="ext-comp-1037" />
<i class="fa fa-eye" id="togglePassword"></i>
</div>
</div>
</div>
<div class="leftFormComp">
<!-- Password Box -->
<div class="selectWrapper">
<!-- add class "error" to show validation message -->
<label for="ext-comp-1038" class="inputLabel"><fmt:message key="registration.retypepassword"/>: <span class="required">*</span></label>
<div id="x-form-el-ext-comp-1038" class="x-form-element">
<input type="password" class="required" name="password2" id="ext-comp-1038" />
<i class="fa fa-eye" id="togglePassword2" style="float: right;"></i>
</div>
</div>
</div>
我尝试过使用 float、margin 属性,但字体超赞的眼睛图标不会在文本框内移动。
上述代码的页面如下所示: HTML Page
这发生在我的应用程序中,但是当我在 JS Fiddle 中使用 margin-left:-30px 单独运行代码时,它工作正常。设置 margin-left:-30px 后我的代码中的图像如下: Margin-left:30px
我已经尝试了一切。如果有人可以帮助我,那就太好了。
EDIT1:在 Tanner Dolby 的代码之后添加的图像。
【问题讨论】:
-
这能回答你的问题吗? w3schools.com/css/css_positioning.asp
-
请包含你的css。
-
你为什么要浮动它?