To achieve the desired outcome, one method involves utilizing pseudo elements.
Below is a snippet of code that can help get you started:
#faq {
width: 100%;
position: relative;
padding: 40px 0; /* ensure padding matches height of pseudo elements */
}
#faq:before {
content: '';
background: url('https://i.sstatic.net/mG3Vb.png');
width: 100%;
height: 40px; /* set height equal to background image size */
background-size: 100% 100%;
position: absolute;
top: 0;
}
#faq:after {
content: '';
background: url('https://i.sstatic.net/JSEyE.png');
width: 100%;
height: 40px; /* set height equal to background image size */
background-size: 100% 100%;
position: absolute;
bottom: 0;
}
#details-wrapper {
background-color: #387dff;
width: 100%
}
#details {
width: 300px;
margin: 0 auto;
font-family: sans-serif;
color: white;
font-size: 16px;
}
<section id="faq">
<div id="details-wrapper">
<div id="details">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</section>
Edit
Following Temani Afif's advice, I have adjusted the code snippet to use background-size: 100% 100%;
instead of background-size: 100% 40px;
, simplifying adjustments needed.