两个div我有以下HTML:CSS安排彼此相邻
<div className={`page-header-profile-photo-container`}>
<div className="user-picture">
</div>
<div className="user-name">
<p>Sample GmbhH</p>
</div>
</div>
而且我的CSS:
.page-header-profile-photo-container{
position: absolute;
top: 10%;
right: 130px;
width: 200px;
}
.user-picture {
position: relative;
top: 10%;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #787567;
}
.user-name{
position: absolute;
top: 5%;
}
这使得像以下:
我想在圆形div和文本之间留有一些空间。 page-header-profile-photo-container的位置必须是绝对的。
我该如何解决这个问题?
您是否尝试过使用'显示:内联block'您'.user_name class'? –