gpt4 book ai didi

html - 为什么我不能用 border-radius 做一个圆圈?

转载 作者:行者123 更新时间:2023-11-28 04:44:51 25 4
gpt4 key购买 nike

* {
margin: 0;
}

div {
background-color: green;
height: 900px;
width: 50%;
margin: auto;
border-radius: 50px;
overflow: hidden;
padding: 20px;
border: 4px solid red;
box-sizing: border-box;
}

div:hover {
box-shadow: 5px 5px 5px 1px blue;
}

@media screen and (max-width:600px) {
div {
background-color: aqua;
color: red;
width: 100%;
height: 10%;
}
body {
background-color: chocolate
}
}

.divas {
background-color: yellow;
position: relative;
margin-top: 20%;
height: 300px;
border-radius: 50%;
}
<div>This is text . This is text . This is text . This is text . This is text . This is text . This is text . This is text . This is text . This is text . This is text . This is text . </div>
<div class="divas"></div>

你好,我想做一个完美的圆形。我尝试用 border-radius 创建它,但它不允许我创建一个完美的圆。有人可以向我解释为什么吗?我尝试更改填充等,但它仍然不起作用。?提前致谢。

最佳答案

如果你想用 border-radius 创建圆,那么你要应用 border-radius 的 div 的高度和宽度应该相同

那么只有 border-radius 看起来像圆

例子

#circle{
width: 100px;
height: 100px;
border-radius: 50%;
background: #000;
}
<div id="circle"></div>

关于html - 为什么我不能用 border-radius 做一个圆圈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51082150/

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