一般的打星号写法:
<span style="color:red">*</span>
通过CSS更加规范统一整齐
<style>
.layui-input{height:30px;} /* layui-input 默认太高了,这里固定高度*/
label.required:after { /* 给红色的必填项打红色星号(文字后)如果打前面用before*/
content: ' *';
color: red;
}
</style>
.layui-form-label.required:after { /* 这种写法也可以*/
content: ' *';
color: red;
}
html
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label required">用户名</label>
<div class="layui-input-inline">
<input type="tel" name="username" lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label required">登入次数</label>
<div class="layui-input-inline">
<input type="text" name="logins" lay-verify="required" autocomplete="off" class="layui-input">
</div>
</div>
</div>