gpt4 book ai didi

CSS3/SVG 分隔符

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

我正在尝试使用 svg 或纯 css3 制作 header 分隔符,如下所示: preview from design

在 header 中我有标准的 bootstrap 4 轮播

<section class="slider">
<div id="carousel" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" style="background-image:url(images/20180818_STP501.jpg);">
<div class="container position-relative h-100">
<div class="carousel-container">
<div class="carousel-content">
<h2>Consectetuer adipiscing elit,<br/>diam nibh euismod tincidunt</h2>
<p>Enim ad veniam, ullamcorper<br/>suscipit aliquip commodo</p>
<div class="mt-5">
<a href="#">Euismod</a>
</div>
</div>
</div>
</div>
</div>
<div class="carousel-item" style="background-image:url(images/20180818_STP501.jpg);">
<div class="container position-relative h-100">
<div class="carousel-container">
<div class="carousel-content">
<h2>Consectetuer adipiscing eli,<br/>diam nibh euismod tincidunt</h2>
<p>Enim ad veniam, ullamcorper<br/>suscipit aliquip commodo</p>
<div class="mt-5">
<a href="#">Euismod</a>
</div>
</div>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>

Border radis 工作正常,但我在底部标题中需要很少的圆形分隔符。它可能用 css3 制作吗?或者需要 svg 形状?

最佳答案

我希望这就是您要问的:在下一个示例中,我将使用 clip-path 来剪辑 header 。请注意,我使用的路径有一个 1/1 和 clipPathUnits="objectBoundingBox" 的边界框。

MDN quote: This value indicates that all coordinates inside the element are relative to the bounding box of the element the clipping path is applied to. It means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are considered to have a length of 1 unit value.

#header {
padding: 0;
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/castell.jpg);
background-size: cover;
height: 50vh;
-webkit-clip-path: url(#clip);
clip-path: url(#clip);
}
<svg height="0" width="0" class="svg-clip" style="position:absolute">
<defs>
<clipPath id="clip" clipPathUnits="objectBoundingBox">
<path d="M0,0L0,.5 A.6,.6 0 0 0 1,.5L1,0z" />
</clipPath>
</defs>
</svg>

<div id="header"></div>

关于CSS3/SVG 分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56272762/

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