gpt4 book ai didi

html - CSS - 没有填充的斜边框

转载 作者:搜寻专家 更新时间:2023-10-31 22:38:12 27 4
gpt4 key购买 nike

我有一个 div,我需要一个左侧倾斜的边框,但我只找到了元素填充有颜色的解决方案。我只需要边框,就像这张图:

enter image description here

我该怎么做?

我的实际代码:

HTML

<div class="arrow">
<span id="time">30 mins</span>
<img src="assets/up_arrow.png" />
</div>

CSS

.arrow {
display: inline-block;
text-align: right;
text-decoration: none;
margin-left: 35%;
padding: 5px 0 5px 0;
border-style: solid;
border-width: 1px 0 1px 0;
border-color: #929A9D transparent #929A9D transparent;
}

.arrow > img {
vertical-align: middle;
width: 12px;
height: 12px;
}

最佳答案

TRY THIS DEMO

HTML 和 CSS

#a {
position: relative;
width: 120px;
padding: 10px 20px;
font-size: 20px;
position: relative;
margin-left:50px;

color: #2E8DEF;

border: 3px solid #2E8DEF;
border-left:0;
}
#a:before {
content: " ";
position: absolute;
display: block;
width: 50%;
height: 100%;
top: -3px;
left: -30px;
z-index: -1;

border:3px solid #2E8DEF;
border-right: 0px;

transform-origin: bottom left;
-ms-transform: skew(-30deg, 0deg);
-webkit-transform: skew(-30deg, 0deg);
transform: skew(-30deg, 0deg);
}
<div id="a">

Hello

</div>

关于html - CSS - 没有填充的斜边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42853676/

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