JSFiddle - React, Tailwind, and code Playground
by anay1231
HTML
<div class="wrapper_slider slider_home-slider">
<div class="owl-item">
<div class="banner_item">
<a class="slider-img" href="#"><img alt="Homepage Slider" src="https://www.bay20.com/wp-content/themes/bay20/images/data/images/eCommerce-Specialists-Banner.jpg"></a>
<div class="text-banner">
<h2>Solo. Endless Possibilities.</h2>
<p>A versatile new collection to suit any environment.</p>
<div class="buttons-slide"><a href="#">SHOP NOW</a></div>
</div>
</div>
</div>
</div>
CSS
.slider_home-slider{
display:inline-block;
width:100%;
}
.slider-img{
display:none;
}
.text-banner{
padding: 50px 15px;
display: block;
text-align: center;
margin: 0 auto;
}
.text-banner h2 {
font-size: 30px;
font-weight: bold;
color: #000;
margin-bottom: 5px;
padding: 14px 25px;
background: rgba(255, 255, 255, 0.75);
display: inline-block;
line-height:normal;
}
.text-banner p {
font-size: 16px;
color: #000;
margin-bottom: 5px;
margin-top: 0;
padding: 15px;
background: rgba(255, 255, 255, 0.75);
display: inline-block;
}
.text-banner .buttons-slide a {
color: #fff;
font-size: 14px;
font-weight: bold;
text-decoration: none;
height: 50px;
line-height: 50px;
min-width: 150px;
text-align: center;
padding: 0;
display: inline-block;
background: linear-gradient(to bottom, #21293e 50%, #db4d6f 50%) no-repeat scroll right bottom / 100% 210% #db4d6f;
}
JavaScript
jQuery(document).ready(function(){
jQuery('.slider_home-slider .banner_item').each(function(){
var imgSrc = jQuery(this).find('img').attr('src');
jQuery(this).css('background-image', 'url("'+imgSrc +'")');
});
})