画像スライダの両側にdivの矢印ボタンを置いて、垂直に整列させ、divのそれぞれの辺に合わせて配置します。 div、右矢印はdivの右側に揃えられます。私の問題は、私がfloat:right
とline-height
を使用しているとき、矢印の画像が垂直に正しく整列しているが、ボタンが垂直に整列していないことです。CSS - 縦方向の中心を合わせて右に浮かぶ問題
これは私のhtmlです:
<div class="row">
<div class="large-1 columns arrow">
<div class="button tertiary previous">
<img src="{{ asset('/img/left-arrow.svg') }}" />
</div>
</div>
<div class="large-10 columns">
<div class="swiper-container">
<div class="swiper-wrapper">
@foreach($issues as $issue)
<div class="swiper-slide">
<img
src="/imagecache/large/{{ $issue->first()->image }}"
onclick="magazineDetail(
'{{ $issue->first()->magazine->id }}',
'{{ $issue->first()->magazine->name }}',
'{{ $issue->first()->magazine->summary ?: '' }}',
'{{ $issue->first()->magazine->image ?: '' }}',
'{{ $issue->first()->image }}'
)"
>
</div>
@endforeach
</div>
</div>
</div>
<div class="large-1 columns arrow">
<div class="button tertiary next">
<img src="{{ asset('/img/right-arrow.svg') }}" />
</div>
</div>
</div>
これは私のSCSSです:
ul {
&.button-group {
margin-left: 0;
li:first-child {
width: 30%;
}
li:not(:last-child) {
margin-right: .7rem;
}
}
}
.button {
text-decoration: none;
line-height: inherit;
&:focus {
outline: none;
background-color: none;
}
&:active {
box-shadow: 0 0 0 0 transparent;
}
&.primary {
background-color: $purple;
color: $white;
&:hover {
background: rgba($purple, 0.4);
}
}
&.secondary {
background-color: $white;
border-color: $black;
color: $black;
&:hover {
background: $white;
border-color: $light-gray;
color: $black;
}
}
&.tertiary {
background: transparent;
border-color: $white;
color: $white;
height: 100%;
font-size: 1.1rem;
padding: .4rem;
&:active {
background: $white;
color: $black;
}
}
&.narrow {
padding-left: 2.2em;
padding-right: 2.2em;
}
&.expand {
width: 100%;
}
}
.carousel {
margin-top: 10%;
.carousel-nav {
text-align: right;
}
.featured-magazines {
margin-top: $global-margin;
}
.button.tertiary {
height: 40px;
line-height: normal;
&.next {
vertical-align:middle;
float:right;
line-height: 200px
}
}
.all {
margin-top: 30px;
width: 100%;
}
.swiper-container{
text-align: center;
}
.arrow {
line-height: 200px;
}
}
垂直のみ 'inline'または'インラインblock'要素ではなく、山車上で動作揃えます。あなたの問題がこれに関連していない場合は、上記のコードではなく、出力されたコードを返信してください。デバッグが簡単になります。 –