【发布时间】:2022-11-17 20:14:35
【问题描述】:
我想让我的设计更具响应性。但是每当我制作那些背景圆圈时,它就会停止响应,并且人的图像和黄色圆圈不再粘在中心。关于如何更好、更有效地完成它的任何提示?
我很难使其响应,因为所有元素都有positions: absolute。我目前正在这样做:
<div className="background">
<div className='outer-circle'></div> // Gray circles
<img src={landingPersonImage} alt=""> // Image of the person
<div className='section1-img-bg'></div> // Yellow circle
</div>
我的主要问题是黄色圆圈没有粘在那些背景圆圈的中心。这是我的意思的视频: https://drive.google.com/file/d/1ZA_skdNAyt2L9pewoTIuIF4CKJLCsqIR/view?usp=share_link
Codepen-https://codepen.io/c0mpli-the-scripter/pen/OJExaLR 输出在 Codepen 上显示不正确。绿色圆圈是由box-shadow创建的同心圆
【问题讨论】:
-
尽量避免使用绝对位置,当你真的需要使用它时,将它放在一个带有
position relative的包装容器中,这样它将包含项目,然后使用相对位置容器,你将能够定位根据您对响应式视图的喜好。
标签: html css frontend responsive