css position - Responsive absolute positioned elements -
i have image slider need have link on 1 side. have set link want on image doesn't scale down when screen resized.
how absolute positioned element scale down screen size , move image resizing?
here jsfiddle https://jsfiddle.net/s0v6j04a/
<div class="sliders"> <div class="slider"><div id="promo1"> <div id="promo-link"> <a href="#">test link</a> </div> <img src="https://unsplash.imgix.net/photo-1434139240289-56c519f77cb0?fit=crop&fm=jpg&h=700&q=75&w=1050" /> </div> </div> </div> #slider{ position:relative; } .div1, .div2 { min-height: 400px; background: #d25a1e; position: relative; width: calc(50% - 30px); } .div1 { float: left; background-image: url('https://ununsplash.imgix.net/photo-1433838552652-f9a46b332c40?fit=crop&fm=jpg&q=75&w=1050') !important; background-repeat: no-repeat; background-position: center center; -o-background-size: 100% 100%, auto; -moz-background-size: 100% 100%, auto; -webkit-background-size: 100% 100%, auto; background-size: 100% 100%, auto; } .div2 { float: right; background-image: url('https://ununsplash.imgix.net/photo-1427805371062-cacdd21273f1?fit=crop&fm=jpg&q=75&w=1050') !important; background-repeat: no-repeat; background-position: center center; -o-background-size: 100% 100%, auto; -moz-background-size: 100% 100%, auto; -webkit-background-size: 100% 100%, auto; background-size: 100% 100%, auto; } .div1:after, .div2:before { content:''; position: absolute; top: 0; width: 0; height: 0; } .div1:after { left: 100%; border-top: 400px solid #d25a1e; border-right: 50px solid transparent; } .div2:before { right: 100%; border-bottom: 400px solid #d25a1e; border-left: 50px solid transparent; } #promo1{width:100%; position:relative;} #promo1 img{width:100%;} #promo-link{ position: absolute; z-index: 100000; left: 25%; top: 50%; font-size: 30px; padding: 20px 40px; border: 2px solid #fff; } #promo-link a{ text-decoration:none; color:#fff; font-family:"times new roman", times, serif }
Comments
Post a Comment