[英]Align text to an input field in react
Im not quite sure on how I can place the paragraph 2 at the bottom of the div right next to the input field.我不太确定如何将第 2 段放在输入字段旁边的 div 底部。 I employed some css from a post from here but it does not work (at least in my case)
我从这里的帖子中使用了一些 css 但它不起作用(至少在我的情况下)
<div className = 'group'>
<label>Password</label>
<input
name = "password"
type = "password"
value = {this.state.password}
onChange = {this.handleChange}
/>
<p>{this.state.passwordError}</p>
<p className = 'group' >{this.state.passwordError2}</p>
</div><br></br>
CSS CSS
.group {
display: flex;
margin-bottom: 10px;
}
.infotext {
display: inline-block;
}
Here is a picture of what it looks like right now and below it is what I hoped it would look like after applying the css这是它现在的样子,下面是我希望应用 css 后的样子
Here I have used tags instead of classes, just replace them with your classnames在这里,我使用标签而不是类,只需将它们替换为您的类名
div { position: absolute } p { display: inline-block; }
<div className='group'> <label>Password</label> <input name="password" type="password" value={ this.state.password} onChange={ this.handleChange} /> <p>{this.state.passwordError}</p> <p className='group'>{this.state.passwordError2}</p> </div><br></br>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.