gpt4 book ai didi

html - 想要使带边框的箭头响应

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

如何让这个箭头框响应?

这是我现在的代码:

<div class="arrow-box"></div>

.arrow-box {
border-bottom: 0;
position: relative;
background: #fff;
border: 1px solid #13aac5;
border-bottom: 0;
width: 1000px;
height: 240px;
box-shadow: 1px 1px 21px 0px rgba(50, 50, 50, 0.3);
&:before {
position: absolute;
bottom: -63px;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 501px 0 501px;
border-color: #13aac5 transparent transparent transparent;
content: '';
}
&:after {
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 500px 0 500px;
border-color: #fff transparent transparent transparent;
content: '';
bottom: -62px;
}

}

你可以看看这个fiddle

它在桌面上按预期工作,但没有响应,谁能帮我让它响应?

最佳答案

您可以使用 vw 单位,它是视口(viewport)宽度的百分比。
Read more .

.arrow-box {
border-bottom: 0;
position: relative;
background: #fff;
border: 1px solid #13aac5;
border-bottom: 0;
width: 96vw;
height: 240px;
margin:auto;
box-shadow: 1px 1px 21px 0px rgba(50, 50, 50, 0.3);
}

.arrow-box:before {
position: absolute;
bottom: -63px;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 48vw 0;
border-color: #13aac5 transparent transparent transparent;
content: '';
}

.arrow-box:after {
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 48vw 0;
border-color: #fff transparent transparent transparent;
content: '';
bottom: -62px;
}
<div class="arrow-box"></div>

更新vw 单元与容器一起使用(参见 CSS 中的注释):

.container {
width: 80vw; /* say we want to have it 80% of our viewport */
}

.arrow-box {
border-bottom: 0;
position: relative;
background: #fff;
border: 1px solid #13aac5;
border-bottom: 0;
width: 76vw; /* it should be little less than .container because of shadow
* or you may set it more precizely with calc(80vw - 42px) */
height: 240px;
margin: auto;
box-shadow: 1px 1px 21px 0px rgba(50, 50, 50, 0.3);
}

.arrow-box:before {
position: absolute;
bottom: -63px;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 38vw 0; /* 50% of .arrow-box width */
border-color: #13aac5 transparent transparent transparent;
content: '';
}

.arrow-box:after {
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-width: 62px 38vw 0;
border-color: #fff transparent transparent transparent;
content: '';
bottom: -62px;
}
<div class="container">
<div class="arrow-box"></div>
</div>

关于html - 想要使带边框的箭头响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51758482/

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