2017-08-17 7 views
3

ナビゲーションボタンの後ろに円を追加したい。しかし、私はそれを達成することができません。私はスワイパーを使用しています。CSSの前に、円をバックグラウンドで追加する。

これは、ナビゲーション矢印の下に円を配置しているときのスナップショットです。 enter image description here

あなたが見ることができるように

enter image description hereenter image description here

、私は余裕左の::調整しています前に、バックグラウンド円はナビゲーションボタンの上に行きます。私は円を作成するためにCSSの前に擬似::を使用しています。しかし、私はそれを達成することはできません。これは私のCSSの仕事です。それを確認して、私に知らせてください、どこが間違っていますか?

.content .swiper-button-next { 
 
    height: 25px; 
 
    padding-left: 62px; 
 
    padding-top: 0px; 
 
    margin-top: -13px; 
 
    z-index: 4 !important; 
 
    position: absolute; 
 
} 
 

 
.swiper-button-next.swiper-button-white{ 
 
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%…2L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E"); 
 
    right: 10px; 
 
    left: auto; 
 
} 
 

 
.swiper-button-next, .swiper-button-prev { 
 
    top: 50%; 
 
    width: 27px; 
 
    cursor: pointer; 
 
    background-size: 27px 44px; 
 
    background-position: center; 
 
    background-repeat: no-repeat; 
 
} 
 

 

 
.content .swiper-button-next:before { 
 
    content: ''; 
 
    display: inline-block; 
 
    width: 50px; 
 
    height: 50px; 
 
    -moz-border-radius: 50%; 
 
    border-radius: 50%; 
 
    margin-left: -53px; 
 
    margin-top: -11px; 
 
    opacity: 0.7; 
 
    z-index: -2; 
 
    position: relative; 
 
    background: #080808; 
 
}
<div class="content swiper-container-horizontal swiper-container-free-mode"> 
 
    <div class="swiper-button-next swiper-button-white"></div> 
 
</div>

事前にありがとうございます。

+2

私はそれを "逆" でしょう。要素にサークルを追加し、背景画像を ':before'要素に追加します。 – pstenstrm

+0

私は質問を修正しました。私は今まで解決策を得ていませんでした。助けてください –

答えて

1

.swiper-button-next:before { 
 
    content: ''; 
 
    display: inline-block; 
 
    width: 50px; 
 
    height: 50px; 
 
    -moz-border-radius: 50%; 
 
    border-radius: 50%; 
 
    background-color: #060606; 
 
    margin-left: -53px; 
 
    margin-top: -11px; 
 
    opacity: 0.8; 
 
    z-index: -2; 
 
    position: relative; 
 
} 
 

 
.swiper-button-next { 
 
    height: 25px; 
 
    padding-left: 62px; 
 
    padding-top: 0px; 
 
    margin-top: -13px; 
 
    z-index: 4 !important; 
 
    position: absolute; 
 
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%…2L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E"); 
 
    right: 10px; 
 
    left: auto; 
 
    top: 50%; 
 
    width: 27px; 
 
    cursor: pointer; 
 
    background-size: 27px 44px; 
 
    background-position: center; 
 
    background-repeat: no-repeat; 
 
} 
 
.arrow{ width: auto; 
 
    display: inline-block; 
 
    position: absolute; 
 
    z-index: 9999; 
 
    left: 31px; 
 
    vertical-align: middle; 
 
    color: #ffffff; 
 
    opacity: 0.3; 
 
    font-size:20px; 
 
}
<div class="swiper-button-next swiper-button-white"><div class="arrow">❯<div></div>

0

あなたはpseudoelementcontentプロパティにシンボルを置くことができます:

.swiper-button-next { 
 
    height: 25px; 
 
    padding-left: 62px; 
 
    padding-top: 0px; 
 
    margin-top: -13px; 
 
    z-index: 4 !important; 
 
    position: absolute; 
 
    right: 10px; 
 
    left: auto; 
 
    top: 50%; 
 
    width: 27px; 
 
    cursor: pointer; 
 
    text-align: center; 
 
} 
 

 
.swiper-button-next:before { 
 
    content: '>'; 
 
    color: white; 
 
    display: inline-block; 
 
    width: 50px; 
 
    height: 50px; 
 
    -moz-border-radius: 50%; 
 
    border-radius: 50%; 
 
    background-color: #060606; 
 
    margin-left: -53px; 
 
    margin-top: -11px; 
 
    opacity: 0.8; 
 
    z-index: -2; 
 
    position: relative; 
 
    line-height: 50px; /* vertically center the symbol */ 
 
}
<div class="swiper-button-next swiper-button-white"></div>

+0

しかし、 '.swiper-button-next'クラスには、"> "と同等の背景イメージがあります。 –

0

をスニペットを確認し、私はあなたのコードを少し

.swiper-button-next::before { 
 
    background-image: url("http://www.iconsdb.com/icons/preview/white/arrow-30-xxl.png"); 
 
    background-repeat: no-repeat; 
 
    background-size: 24px 29px; 
 
    content: ""; 
 
    display: inline-block; 
 
    height: 50px; 
 
    margin-top: 10px; 
 
    opacity: 0.8; 
 
    position: relative; 
 
    right: -15px; 
 
    width: 22px; 
 
    z-index: -2; 
 
} 
 

 
.swiper-button-next { 
 
    padding-top: 0px; 
 
    margin-top: -13px; 
 
    z-index: 4 !important; 
 
    position: absolute; 
 
    width: 50px; 
 
    height: 50px; 
 
    -moz-border-radius: 50%; 
 
    border-radius: 50%; 
 
    background-color: #060606; 
 
    right: 10px; 
 
    left: auto; 
 
    top: 50%; 
 
    cursor: pointer; 
 

 
}
<div class="swiper-button-next swiper-button-white"></div>
を変更していてください

1

問題を解決します.swiper-button-nextのdivからz-indexを削除してください。

.swiper-button-next:before { 
 
    content: ''; 
 
    display: inline-block; 
 
    width: 50px; 
 
    height: 50px; 
 
    -moz-border-radius: 50%; 
 
    border-radius: 50%; 
 
    background-color: #060606; 
 
    margin-left: -53px; 
 
    margin-top: -11px; 
 
    opacity: 0.8; 
 
    z-index: -2; 
 
    position: relative; 
 
} 
 

 
.swiper-button-next { 
 
    height: 25px; 
 
    padding-left: 62px; 
 
    padding-top: 0px; 
 
    margin-top: -13px; 
 
    position: absolute; 
 
    background-image: url(http://www.clker.com/cliparts/C/n/U/D/t/D/transparent-arrow-hi.png); 
 
    right: 10px; 
 
    left: auto; 
 
    top: 50%; 
 
    width: 27px; 
 
    cursor: pointer; 
 
    background-size: 27px 44px; 
 
    background-position: center; 
 
    background-repeat: no-repeat; 
 
}
<div class="swiper-button-next swiper-button-white"></div>

関連する問題