我一直尝试将图像放置在容器内,以便将其放置在h1标记文本的顶部,但它只是将图像添加到其旁边,而我希望图像位于文本的顶部,我应该怎么做?:
const Login = () => {
return(
<div className="login-container">
<form className='log' >
<img className='img'
src={logo}
alt="logo"/>
<hi> Hello there</hi>
<input placeholder="enter email"/>
<input placeholder="password"/>
<button type="submit">Submit</button>
</form>
</div>
)
}
下面是我的css文件,它具有登录组件文件的样式:
.login-container {
width: 600px;
height: 500px;
margin-top: 20px;
margin-bottom: 10px;
margin-left: 350px ;
display: flex;
border: 7px solid grey;
background-color: white;
border-radius: 10px;
align-items: center;
justify-content: center;
}
.log{
text-align: center;
columns: 170px;
position: relative;
display: block;
margin-left: 190px;
margin-right: 180px;
width: 200px;
height: 170px;
border: 10px solid rgb(140, 128, 168);
border-radius: 10px;
align-items: center;
justify-content: center;
}
input{
margin-top: 30px;
text-align: center;
border-radius: 30px;
}
h1 {
font-family: Lato, sans-serif;
color-scheme: blue;
display: block;
}
img {
width: 20px;
height: 20px;
border-radius: 30px;
margin-left: 60px;
}
1条答案
按热度按时间axr492tv1#
1.排印错误为
<h1>
而非<hi>
。1.使用
<div>
标签为您提到的要求显示图像上的文本