I'm currently working on positioning an SVG icon over a CSS border, but I'm running into an issue with the layering of the border. The design calls for the border to be in the background, while the icon should be in the foreground. I'm experimenting with using the z-index
property to achieve this!
Design
https://i.sstatic.net/9eHpw.png
Output
.se-venue-cta {
width: 300px;
text-align: center;
margin: 5% auto;
background: #000;
background: #FFF1EA;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
padding: 20px;
position: relative;
z-index: 2;
}
.se-venue-cta-text p {
color: #FE6F48;
text-align: center;
}
.se-venue-cta-text {
border: 2px solid #FE6F48;
border-radius: 10px;
margin-bottom: 30px;
}
.se-venue-cta-btn {
height: 44px;
}
.se-venue-cta-btn a {
transition: all 0.3s ease-in-out;
display: flex;
background: #FE6F48;
border-radius: 6px;
height: 100%;
justify-content: center;
align-items: center;
text-decoration: none;
color: #ffffff;
font-weight: bold;
font-size: 16px;
}
span {
display: block;
position: absolute;
left: 50%;
top: 8px;
transform: translateX(-50%);
z-index: 999;
overflow: hidden;
}
<div class="se-venue-cta">
<div class="se-venue-cta-text">
<p> The average wedding costs $33,900. Get a quote now and let us plan you a beautiful elopement, while saving you over $28,000</p>
</div>
<div class="se-venue-cta-btn">
<a href=""> Get a Quote </a>
</div>
<!-- svg icon -->
<span>
<svg width="20" height="27" viewBox="0 0 20 27" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7889 15.4035C12.6086 15.6051 12.4191 15.798 12.2211 15.9818C11.6767 15.1346 11.5056 13.9309 11.8133 12.8475C12.0244 12.1027 12.5644 11.1263 13.39 10.8225C14.1 10.5615 14.6111 11.1791 14.6856 11.8305C14.8344 13.1242 12.79 15.4035 12.79 15.4035H12.7889ZM13.1056 18.3938C13.9133 18.7054 14.7944 18.7301 15.7156 18.4556C16.3041 18.2729 16.8621 18.0017 17.3711 17.6512C14.41 22.5911 10 27 10 27C10 27 5.66778 22.6688 2.70556 17.7806C3.57333 17.4521 4.46778 16.5656 5.37333 15.129C5.97556 14.175 6.55889 13.0028 7.03889 11.8046L7.1 11.9216C7.16667 12.0566 7.23556 12.1916 7.30444 12.3266C7.82667 13.3571 8.36778 14.4214 8.47111 15.4991C8.53444 16.1764 8.26444 16.3913 8.17445 16.4621C7.71889 16.8221 6.70778 16.8435 5.71222 16.5139C5.57924 16.4695 5.43609 16.4669 5.30162 16.506...
</div>