gpt4 book ai didi

html - 如何使用Html和Css在正方形中设计4个菱形(菱形)和8个三 Angular 形(Kundli Design)

转载 作者:行者123 更新时间:2023-11-28 15:37:54 27 4
gpt4 key购买 nike

我想在一个正方形中插入 4 个菱形(菱形)和 8 个三 Angular 形。通过在stack overflow中搜索,我已经设计了90%。但是现在,我遇到了一个问题,如 PLUNKER DEMO 所示。 . 我想加入 Plunker 中显示的 2 个形状。任何人都可以通过编辑相同的 PLUNKER DEMO 来帮助我,因为我需要控制所有 12 个单独的形状(以便我可以在这些形状中插入标签)。提前致谢。

.square1 {
height: 300px;
width: 600px;
overflow: hidden;
margin: -18px;
border-right: none;
border-left: none;
}

.square2 {
height: 300px;
width: 300px;
overflow: hidden;
margin-left: -256px;
border-left: none;
border-right: none;
}

.square3 {
height: 300px;
width: 600px;
overflow: hidden;
margin: -18px;
border-left: none;
border-right: none;
margin-top: -265px;
}

.square4 {
height: 300px;
width: 300px;
overflow: hidden;
margin-left: -256px;
border-left: none;
border-right: none;
}

svg {
height: 100%;
width: 100%;
}

polygon {
fill: aliceblue;
stroke: crimson;
stroke-linejoin: round;
}

polygon:hover {
fill: cornflowerblue;
}
<body>
<table>
<tr>
<td>
<div class='square1'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='5,5 50,50 95,5' />

<polygon id="t2" points='5,5 50,50 5,95' />
<polygon id="t3" points='5,95 50,50 95,95 50,145' />
<polygon id="t4" points='95,5 50,50 95,95 145,50' />
</svg>
</div>
</td>
<td>
<div class='square2'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='5,5 50,50 95,5' />

<polygon id="t2" points='' />
<polygon id="t3" points='5,95 50,50 95,95 50,145' />
<polygon id="t4" points='95,5 50,50 95,95' />
</svg>
</div>
</td>
</tr>
<tr>
<td>
<div class='square3'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='' />

<polygon id="t2" points='5,5 50,50 5,95' />
<polygon id="t3" points='5,95 50,50 95,95' />
<polygon id="t4" points='95,5 50,50 95,95 145,50' />
</svg>
</div>
</td>
<td>
<div class='square4'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='' />

<polygon id="t2" points='' />
<polygon id="t3" points='5,95 50,50 95,95' />
<polygon id="t4" points='95,5 50,50 95,95' />
</svg>
</div>
</td>
</tr>

</table>
</body>

最佳答案

Here is the fixed code:

.square1 {
height: 300px;
width: 600px;
overflow: hidden;
margin: -18px;
border-right:none;
border-left:none;
}
.square2 {
height: 300px;
width: 300px;
overflow: hidden;
margin-left: -256px;
border-left:none;
border-right:none;
}
.square3 {
height: 300px;
width: 600px;
overflow: hidden;
margin: -18px;
border-left:none;
border-right:none;
margin-top: -128px;
}
.square4 {
height: 300px;
width: 300px;
overflow: hidden;
margin-left: -256px;
border-left:none;
border-right:none;
margin-top:-135px;
position: relative;
top: 12px;

}

svg {
height: 100%;
width: 100%;
}
polygon {
fill: aliceblue;
stroke: crimson;
stroke-linejoin: round;
}
polygon:hover {
fill: cornflowerblue;
}
<table><tr><td>
<div class='square1'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='5,5 50,50 95,5' />
<text x="33" y="26" font-size="20" fill="black" stroke="black" stroke-width=".06">a10</text>
<polygon id="t2" points='5,5 50,50 5,95' />
<text x="10" y="56" font-size="20" fill="black" stroke="black" stroke-width=".06">a20</text>
<polygon id="t3" points='5,95 50,50 95,95 50,145' />
<text x="36" y="96" font-size="20" fill="black" stroke="black" stroke-width=".06">a30</text>
<polygon id="t4" points='95,5 50,50 95,95 145,50' />
<text x="80" y="56" font-size="20" fill="black" stroke="black" stroke-width=".06">a40</text>
</svg>
</div></td><td>
<div class='square2'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='5,5 50,50 95,5' />

<polygon id="t2" points='' />
<polygon id="t3" points='5,95 50,50 95,95 50,145' />
<polygon id="t4" points='95,5 50,50 95,95' />
</svg>
</div></td>
</tr>
<tr><td>
<div class='square3'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='' />

<polygon id="t2" points='5,5 50,50 5,95' />
<polygon id="t3" points='5,95 50,50 95,95' />
<polygon id="t4" points='95,5 50,50 95,95 145,55' />
</svg>
</div></td><td>
<div class='square4'>
<svg viewBox='0 0 150 150'>
<polygon id="t1" points='' />

<polygon id="t2" points='' />
<polygon id="t3" points='5,95 50,50 95,95' />
<polygon id="t4" points='95,5 50,50 95,95' />
</svg>
</div></td>
</tr>

</table>

关于html - 如何使用Html和Css在正方形中设计4个菱形(菱形)和8个三 Angular 形(Kundli Design),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43929761/

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