今矢印のデザインをしているのですが、なかなか思った通りになりません。
貼り付けてある画像のように、画面の両端に白の矢印と黒のバックグラウンドカラーをつけたいです。
html
1<!DOCTYPE html> 2<html lang="ja"> 3 <head> 4 <!-- Required meta tags --> 5 <meta charset="utf-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 7 8 <!--Swiper--> 9 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/css/swiper.min.css"> 10 <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script> 11 12 </head> 13 <body> 14 <!-- Slider main container --> 15 <div class="swiper-container"> 16 <!-- Additional required wrapper --> 17 <div class="swiper-wrapper"> 18 <!-- Slides --> 19 <div class="swiper-slide" style="linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%"> 20 <img src="https://picsum.photos/id/1041/650/400" alt=""> 21 </div> 22 <div class="swiper-slide"> 23 <img src="https://picsum.photos/id/1042/650/400" alt=""> 24 </div> 25 <div class="swiper-slide"> 26 <img src="https://picsum.photos/id/1043/650/400" alt=""> 27 </div> 28 </div> 29 <!-- If we need pagination --> 30 <div class="swiper-pagination"></div> 31 32 <!-- If we need navigation buttons --> 33 <div class="swiper-button-prev swipe-sign"></div> 34 <div class="swiper-button-next swipe-sign"></div> 35 </div> 36 37 <style> 38 .swiper-button-prev{ 39 position: relative; 40 display: inline-block; 41 padding: 0 0 0 16px; 42 color: #000; 43 vertical-align: middle; 44 text-decoration: none; 45 font-size: 50px; 46 } 47 48 .swiper-button-prev::before{ 49 position: absolute; 50 top: 0; 51 bottom: 0; 52 left: 0; 53 margin: auto; 54 content: ""; 55 vertical-align: middle; 56 box-sizing: border-box; 57 width: 50px; 58 height: 50px; 59 border: 1px solid #191919; 60 -webkit-border-radius: 25%; 61 border-radius: 25%; 62 background-color: #191919; 63 } 64 65 .swiper-button-prev::after{ 66 position: absolute; 67 top: 0; 68 bottom: 0; 69 left: 0; 70 margin: auto; 71 content: ""; 72 vertical-align: middle; 73 left: 5px; 74 box-sizing: border-box; 75 width: 20px; 76 height: 20px; 77 border: 3px solid transparent; 78 border-left: 50px solid #fff; 79 } 80 </style> 81 82 <script> 83 var mySwiper = new Swiper ('.swiper-container', { 84 loop: true, 85 slidesPerView: 2, 86 spaceBetween: 5, 87 centeredSlides : true, 88 pagination: '.swiper-pagination', 89 nextButton: '.swiper-button-next', 90 prevButton: '.swiper-button-prev', 91 breakpoints: { 92 767: { 93 slidesPerView: 1, 94 spaceBetween: 0 95 } 96 } 97 }) 98 </script> 99 100 </body> 101</html> 102 103
回答1件
あなたの回答
tips
プレビュー