gpt4 book ai didi

border - css 曲线边框渲染奇怪

转载 作者:行者123 更新时间:2023-11-28 18:19:32 27 4
gpt4 key购买 nike

我正在尝试使用 DIV 和 CSS 绘制一些逻辑门。我得到的东西看起来大多没问题,但或中间门 (OR) 在 Chrome 中绘制边框的方式有些奇怪。曲线中有 2 个间隙。同样在所有浏览器中,我检查了或门的左凹曲线在末端变薄。

jsfiddle

大门的 HTML

<div class="gate">
<div class="outer">
<div class="inner">
<div class="andInA"></div>
<div class="andInB"></div>
<div class="andOutA"></div>
<div class="andLeft"></div>
<div class="andRight"></div>
</div>
</div>
</div>
<br />
<div class="gate">
<div class="outer">
<div class="inner">
<div class="orLeft"></div>
<div class="orBottomRight"></div>
<div class="orTopRight"></div>
<div class="orLeftCurve"></div>
<div class="orInA"></div>
<div class="orInB"></div>
<div class="andOutA"></div>
</div>
</div>
</div>
<br />
<div class="gate">
<div class="outer">
<div class="inner">
<div class="andInA"></div>
<div class="andInB"></div>
<div class="andOutA"></div>
<div class="andLeft"></div>
<div class="andRight"></div>
<div class="nand"></div>
</div>
</div>
</div>

大门的 CSS

.gate {
position: relative;
width: 300px;
height: 150px;
}
.outer {
position: relative;
padding: 0 28.6% 0 0;
height: 100%;
}
.inner {
position: relative;
margin: 0 20% 0 20%;
width: 100%;
height: 100%;
}
.gate .andLeft {
position: absolute;
left: 0px;
height: 97%;
width: 45%;
background-color: white;
box-sizing: border-box;
-moz-box-sizing: border-box;
border-top: 2px solid black;
border-bottom: 2px solid black;
border-left: 2px solid black;
border-right: 0px solid black;
}
.gate .andRight {
position: absolute;
right: 0px;
height: 97%;
width: 75%;
background-color: white;
box-sizing: border-box;
-moz-box-sizing: border-box;
border-top: 2px solid black;
border-bottom: 2px solid black;
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 100% 100% 0%;
}
.gate .nand {
position: absolute;
top: 50%;
right: 20%;
margin-top: -4%;
margin-right: -30%;
width: 10%;
height: 12%;
box-sizing: border-box;
-moz-box-sizing: border-box;
border: 2px solid black;
background-color: white;
border-radius: 100% 100% 100% 100%;
}
.gate .orLeft {
position: absolute;
left: 0px;
height: 100%;
width: 25%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 2px solid black;
border-bottom: 2px solid black;
border-left: 0px solid black;
border-right: 0px solid black;
}
.gate .orLeftCurve {
position: absolute;
left: -25%;
height: 100%;
width: 50%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 0px solid black;
border-bottom: 0px solid black;
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 50% 50% 0%;
}
.gate .orTopRight {
position: absolute;
top: 0%;
right: 0px;
height: 50%;
width: 75%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 2px solid black;
border-bottom: 0px solid black;
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 100% 0% 0%;
}
.gate .orBottomRight {
position: absolute;
top: 50%;
right: 0px;
height: 50%;
width: 75%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 0px solid black;
border-bottom: 2px solid black;
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 0% 100% 0%;
}

.gate .andInA {
position: absolute;
top: 25%;
margin-left: -20%;
width: 20%;
height: 1px;
border-top: 2px solid black;
}
.gate .andInB {
position: absolute;
top: 74%;
margin-left: -20%;
width: 20%;
height: 1px;
border-bottom: 2px solid black;
}
.gate .andOutA {
position: absolute;
top: 50%;
right: 0px;
margin-right: -20%;
width: 20%;
height: 1px;
border-top: 2px solid black;
}

.gate .orInA {
position: absolute;
top: 25%;
margin-left: -20%;
width: 41.5%;
height: 1px;
border-top: 2px solid black;
}
.gate .orInB {
position: absolute;
top: 74%;
margin-left: -20%;
width: 41.5%;
height: 1px;
border-bottom: 2px solid black;
}

最佳答案

边框的宽度好像有问题。如果您修改为 1px(每边的 border-top 和 border-bottom),它在 Chrome 中看起来不错。 Check it out

.gate .orTopRight {
position: absolute;
top: 0%;
right: 0px;
height: 50%;
width: 75%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 1px solid black; // Modified to 1px
border-bottom: 0px solid black;
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 100% 0% 0%;
}
.gate .orBottomRight {
position: absolute;
top: 50%;
right: 0px;
height: 50%;
width: 75%;
box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: white;
border-top: 0px solid black;
border-bottom: 1px solid black; // Modified to 1px
border-left: 0px solid black;
border-right: 2px solid black;
border-radius: 0% 0% 100% 0%;
}

关于border - css 曲线边框渲染奇怪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17313088/

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