如何在段落的左侧设置图像?
如何将图像设置为与文本并肩?这就是我所拥有的,不确定我在做什么错。谢谢你!
.aboutme {
white-space: normal;
word-wrap: break-word;
font-family: proxima-nova, Times New Roman;
color: rgb(196, 191, 181);
font-weight: 400;
font-size: 18px;
font-style: normal;
text-align: left;
height: auto;
width: auto;
margin: 0;
line-height: 1.7em;
float: right;
}
.homepageimgdef {
max-width: 500px;
height: 500px;
border-radius: 50%;
display: block;
float: left;
}
<div>
<p class="aboutme">
"Paragraph text"
</p>
<img class="homepageimgdef" src="./HomePagePictureBlackWhite.jpg" alt="LeeBlackWhite">
</div>
How Do I set an image to be side by side with the text? This is what I have, not sure what I am doing wrong. Thank you!
.aboutme {
white-space: normal;
word-wrap: break-word;
font-family: proxima-nova, Times New Roman;
color: rgb(196, 191, 181);
font-weight: 400;
font-size: 18px;
font-style: normal;
text-align: left;
height: auto;
width: auto;
margin: 0;
line-height: 1.7em;
float: right;
}
.homepageimgdef {
max-width: 500px;
height: 500px;
border-radius: 50%;
display: block;
float: left;
}
<div>
<p class="aboutme">
"Paragraph text"
</p>
<img class="homepageimgdef" src="./HomePagePictureBlackWhite.jpg" alt="LeeBlackWhite">
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 @M4N0评论所说,使用flexbox。
您的代码应该看起来像
As @m4n0 comment says, use a flexbox.
Your code should look like
您需要从两个选择器中删除
float
,从文本中删除text-align
,在div
中,使用Flexbox
将您想要的HTML组件对齐。You'll need to remove the
float
from both selectors, removetext-align
from the text, and in thediv
, useflexbox
to align your HTML components they way that you want.我建议将您的内容放入Divs,以便您可以更好地控制自己的元素。
I would suggest putting your content into divs so that you may have more control over your elements.