原代码:
<label for="username" class="sub-title">用户名:</label>
<input type="text" id="username" class="sub-input" placeholder="123" autocomplete="off"><br />
<label for="pwd" class="sub-title">密码:</label>
<input type="password" id="pwd" class="sub-input" placeholder="****" autocomplete="off"><br />
原样式:
实际我希望的情况是和路径那样,可是浏览器记录了之前输入过的账户和密码,由于用了bootstrap或layui的插件,所以出现刷新后样式不一致的问题,丑爆了
解决方法:
在text="password"的input标签上加上下面这句
autocomplete="new-password"
<label for="username" class="sub-title">用户名:</label>
<input type="text" id="username" class="sub-input" placeholder="123" autocomplete="off"><br />
<label for="pwd" class="sub-title">密码:</label>
<input type="password" id="pwd" class="sub-input" placeholder="****" autocomplete="new-password"><br />
再次打开后样式:
完美!