[英]<fieldset> like effect without using <fieldset> tag and with pure HTML (no CSS)
[英]How to put label on input like fieldset of HTML tag
您可以通过更改 CSS 文件来实现。 只需使用<label>
和<input>
并添加一些 CSS class 到它。
.input-field { display: flex; flex-direction: column; width: 500px; }.input-field label { margin-left: 10px; }.input-field label.label-style { background: #FFF; font-weight: bold; padding: 0 10px; }.input-field input { height: 30px; margin-top: -10px; z-index: -1; padding: 10px 20px; border-radius: 10px; }
<div class="input-field"> <label for="name"><span class="label-style">Full Name</span></label> <input type="text" placeholder="Name" name="name"> </div>
要将它与 SCSS 一起使用,您可以在此处参考 codepen
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.