gpt4 book ai didi

html - 如何在减小屏幕宽度的同时防止覆盖图像上的文本

转载 作者:行者123 更新时间:2023-11-27 23:09:14 25 4
gpt4 key购买 nike

“我正在减小屏幕宽度,但段落文本覆盖了图像,我应该做些什么来防止覆盖文本”

“这是部分网站 build ,我尝试在代码中使用一些 css3 属性,但无法解决问题”

<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
#facilities{
height: 430px;
background: #fff;
}
#facilities .facility-img {
width: 40%;
float: left;
}
#facilities .facility-img img{
width: 600px;
border-radius: 50%;
padding: 30px 70px;
}
#facilities .facility-info{
float: right;
width: 50%;
text-align: center;
padding-top: 60px;
}
#facilities .facility-info h1{
color: #333;
}
#facilities .facility-info p{
color: #333;
}
</style>
</head>
<body>
<section id="facilities">
<div class="container">
<div class="facility-img ">
<img src="https://images.pexels.com/photos/1170979/pexels-photo-1170979.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="facility-photo">
</div>
<div class="facility-info">
<h1>In a hospital , half of the patients get better food than at home.</h1>
<p>~Gerhard KocSher</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit.Sit autem ducimus delectus nam aut neque vitae, ab repellendus, qui, quibusdam eum commodi sunt? Non veniam quos illo, assumenda doloremque sit possimus sunt architecto quo neque doloribus provident consequuntur eius error.
</p>
</div>
</div>
</section>
</body>
</html>

最佳答案

将图像上的 width: 600px 更改为 width: 100%

关于html - 如何在减小屏幕宽度的同时防止覆盖图像上的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58624058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com