gpt4 book ai didi

html - 具体圆形导航

转载 作者:太空宇宙 更新时间:2023-11-04 08:39:18 25 4
gpt4 key购买 nike

如何正确制作这样的导航栏,尤其是这两条相交线。我知道我可以使用 transform: skewX(10deg); 来旋转这条垂直线,但不确定我是否可以使用整个 html&css

enter image description here

HTML:

<main>
<div class="rounded-rectangle">
<ul class="top">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
<ul class="bottom">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
</div>
</main>

Fiddle

最佳答案

您可以使用容器的伪元素来绘制相交线。

html,
body {
height: 100%;
}

body {
display: flex;
flex-direction: row;
font-family: 'Raleway', sans-serif;
background-color: #e24d3d;
}

main {
flex-grow: 1;
}

ul li {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
list-style: none;
text-transform: uppercase;
font-size: 30px;
}

button {
background-color: transparent;
border: none;
color: white;
padding: 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 2.5em;
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
}

button:focus {
outline: -webkit-focus-ring-color auto 0px;
}

ul.top {
display: flex;
justify-content: space-around;
height: 50%;
}

ul.top div:nth-last-child(1) {
border-right: 1px solid #FFF;
}

ul.bottom {
display: flex;
justify-content: space-around;
height: 50%;
}

.rounded-rectangle {
background-color: rgba(128, 213, 226, 0.4);
height: 320px;
max-width: 520px;
border-radius: 10px;
margin: auto;
position: relative;
}

.rounded-rectangle:before, .rounded-rectangle:after {
content: '';
position: absolute;
background: #fff;
}

.rounded-rectangle:before {
top: 50%;
height: 1px;
left: 0; right: 0;
}

.rounded-rectangle:after {
left: 50%;
width: 1px;
top: 0; bottom: 0;
transform: rotate(10deg);
}

ul {
padding: 0;
margin: 0;
}
<main>
<div class="rounded-rectangle">
<ul class="top">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
<ul class="bottom">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
</div>
</main>

关于html - 具体圆形导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44250837/

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