Hed*_*vig 4 html css responsive-design responsive
我已经解决了这个问题好几天了,这让我抓狂,当我缩小屏幕时,我希望圆圈内的文本在cirkle div内的相同位置移动,如图所示。
如果您有任何提示,请分享!
CSS代码和HTML代码:
.circleBase {
border-radius: 50%;
}
.contact-circle {
margin-top: 29%;
margin-left: 4%;
position: fixed;
width: 23%;
height: auto;
padding-top: 23%;
background-color: rgba(255, 86, 86, 0.2);
}
#contact-text {
top: 20%;
bottom: 20%;
left: 18%;
font-size: auto;
position: absolute;
text-align: center;
width: 60%;
opacity: 1;
}Run Code Online (Sandbox Code Playgroud)
<div class="circleBase contact-circle">
<div id="contact-text">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
</p>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
使用另一种方法来居中文本。这是一个关于flex的想法:
.circleBase {
border-radius: 50%;
}
.contact-circle {
position: fixed;
width: 23%;
height: auto;
padding-top: 23%;
background-color: rgba(255, 86, 86, 0.2);
}
#contact-text {
top: 0;
position: absolute;
bottom: 0;
left: 10%;
right: 10%;
display: inline-flex;
justify-content: center;
align-items: center;
text-align: center
}Run Code Online (Sandbox Code Playgroud)
<div class="circleBase contact-circle">
<div id="contact-text">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
</p>
</div>
</div>Run Code Online (Sandbox Code Playgroud)