【发布时间】:2021-11-04 11:27:32
【问题描述】:
这是我现在拥有的代码,我尝试使用内联和我能想到的所有 css 语法,但它仍然不能正常工作。我尝试在反应中填充边距。我还使用一个盒子来装箱所有组件以及包括图像和文本在内的所有内容。
p {
margin-left: 40%;
margin-top: -50%;
text-align: left;
font-family: "Montserrat", sans-serif;
font-weight: 100;
line-height: 1.5;
display: inline-block;
}
img {
height: 110px;
width: 110px;
margin-left: 5%;
display: inline-block;
}
.container {
display: inline-block;
}
这里是 react.js 文件中的一些代码
<div className={classes.empty}></div>
<div className="container">
<img
className={classes.img}
src={ProfilePic}
alt="Profile"
style={{ marginTop: "12%", display: "inline-block;" }}
></img>
<p>
So May See Macy <br />
Computer Science Major <br />
Current Standing: Sophomore <br />
GPA: 3.6
</p>
</div>
</div>
【问题讨论】:
-
我建议你用 2 个分割容器。并在 css 中使用
align-items属性。