2016-04-03 6 views
1

下のスクリーンショットをよく見ると、矢印の左側に若干の隙間があることがわかります。&:after要素の間のギャップを修正するには?

私は、要素がピクセル整合していないときにそれが起こると思います。どうすれば修正できますか?

jsbin

.stepList { 
 
    zoom: 1; 
 
    list-style: none; 
 
    padding: 0; 
 
    margin: 0 -15px 10px -15px; 
 
    border-color: #E7EAEC; 
 
    border-width: 1px; 
 
    border-top-style: solid; 
 
    border-bottom-style: solid; 
 
} 
 
.stepList:before, 
 
.stepList:after { 
 
    content: ""; 
 
    display: table; 
 
} 
 
.stepList:after { 
 
    clear: both; 
 
} 
 
.stepList > li { 
 
    float: left; 
 
    text-align: center; 
 
    background-color: white; 
 
    position: relative; 
 
} 
 
.stepList > li.currentStep { 
 
    background-color: #233646; 
 
} 
 
.stepList > li.currentStep:not(:last-child):after { 
 
    border-left-color: #233646; 
 
} 
 
.stepList > li:hover { 
 
    background-color: #B70103; 
 
} 
 
.stepList > li:hover .stepTitle { 
 
    color: white; 
 
} 
 
.stepList > li:hover:not(:last-child):after { 
 
    border-left-color: #B70103; 
 
} 
 
.stepList > li:not(:last-child):before, 
 
.stepList > li:not(:last-child):after { 
 
    left: 100%; 
 
    top: 50%; 
 
    border: solid transparent; 
 
    content: " "; 
 
    height: 0; 
 
    width: 0; 
 
    position: absolute; 
 
    pointer-events: none; 
 
    z-index: 100; 
 
} 
 
.stepList > li:not(:last-child):after { 
 
    border-color: rgba(35, 54, 70, 0); 
 
    border-left-color: white; 
 
    border-width: 14px; 
 
    margin-top: -14px; 
 
} 
 
.stepList > li:not(:last-child):before { 
 
    border-color: rgba(231, 234, 236, 0); 
 
    border-left-color: #E7EAEC; 
 
    border-width: 15px; 
 
    margin-top: -15px; 
 
} 
 
.currentStep .stepTitle { 
 
    color: white; 
 
} 
 
.stepNumber { 
 
    display: inline-block; 
 
    font-size: .9em; 
 
    border-radius: 1em; 
 
    text-align: center; 
 
    line-height: 16px; 
 
    padding: 0 .3333em; 
 
    background-color: white; 
 
    border: 2px solid #ccc; 
 
    margin-right: 4px; 
 
    color: black; 
 
    font-weight: bold; 
 
} 
 
.stepWrap { 
 
    padding: 4px 0; 
 
    display: block; 
 
} 
 
a.stepWrap { 
 
    text-decoration: none; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width"> 
 
    <title>JS Bin</title> 
 
</head> 
 
<body> 
 
<ul class="stepList"> 
 
    <li class="currentStep" style="width:25%;"> 
 
     <span class="stepWrap"><span class="stepNumber">1</span><span class="stepTitle">Customer Information</span></span> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">2</span><span class="stepTitle">Passenger Information</span></a> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">3</span><span class="stepTitle">Trip Itinerary</span></a> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">4</span><span class="stepTitle">Miscellaneous</span></a> 
 
    </li> 
 
</ul> 
 
</body> 
 
</html>

+0

私は、任意の矢印の左側にある任意の識別可能なギャップが表示されません。あなたは、このギャップがどこにあるのかを正確に指し示す表記と矢印でスクリーンショットを作ることができますか? Btw、どのブラウザを使用しているのか、どのようなタイプのコンピュータ(MacまたはPC)をお知らせください – zer00ne

+1

私は上記の@ zer00neのコメントに同意します。私はあまりにも隙間や線が見えません(スクリーンショットには見えますが)。このリンクは、アプローチの変更に対応している場合に役立ちます。http://stackoverflow.com/questions/27636373/how-to-make-this-arrow-in-css-only/28196665#28196665 – Harry

+0

@ zer00ne矢印が追加されました:http://i.imgur.com/EXq9Lw7.pngそのスクリーンショットはWin10のChromeを使用して撮影されました。 – mpen

答えて

0

私はただの国境左調整:を0PXする前に、 正解ですと願っています。

.stepList { 
 
    zoom: 1; 
 
    list-style: none; 
 
    padding: 0; 
 
    margin: 0 -15px 10px -15px; 
 
    border-color: #E7EAEC; 
 
    border-width: 1px; 
 
    border-top-style: solid; 
 
    border-bottom-style: solid; 
 
} 
 
.stepList:before, 
 
.stepList:after { 
 
    content: ""; 
 
    display: table; 
 
} 
 
.stepList:after { 
 
    clear: both; 
 
} 
 
.stepList > li { 
 
    float: left; 
 
    text-align: center; 
 
    background-color: white; 
 
    position: relative; 
 
} 
 
.stepList > li.currentStep { 
 
    background-color: #233646; 
 
} 
 
.stepList > li.currentStep:not(:last-child):after { 
 
    border-left-color: #233646; 
 
} 
 
.stepList > li:hover { 
 
    background-color: #B70103; 
 
} 
 
.stepList > li:hover .stepTitle { 
 
    color: white; 
 
} 
 
.stepList > li:hover:not(:last-child):after { 
 
    border-left-color: #B70103; 
 
} 
 
.stepList > li:not(:last-child):before, 
 
.stepList > li:not(:last-child):after { 
 
    left: 100%; 
 
    top: 50%; 
 
    border: solid transparent; 
 
    content: " "; 
 
    height: 0; 
 
    width: 0; 
 
    position: absolute; 
 
    pointer-events: none; 
 
    z-index: 100; 
 
} 
 
.stepList > li:not(:last-child):after { 
 
    border-color: rgba(35, 54, 70, 0); 
 
    border-left-color: white; 
 
    border-width: 14px; 
 
    margin-top: -14px; 
 
} 
 
.stepList > li:not(:last-child):before { 
 
    border-color: rgba(231, 234, 236, 0); 
 
    border-left-color: #E7EAEC; 
 
    border-width: 15px; 
 
    margin-top: -15px; 
 
    border-left: 0px; 
 
} 
 
.currentStep .stepTitle { 
 
    color: white; 
 
} 
 
.stepNumber { 
 
    display: inline-block; 
 
    font-size: .9em; 
 
    border-radius: 1em; 
 
    text-align: center; 
 
    line-height: 16px; 
 
    padding: 0 .3333em; 
 
    background-color: white; 
 
    border: 2px solid #ccc; 
 
    margin-right: 4px; 
 
    color: black; 
 
    font-weight: bold; 
 
} 
 
.stepWrap { 
 
    padding: 4px 0; 
 
    display: block; 
 
} 
 
a.stepWrap { 
 
    text-decoration: none; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width"> 
 
    <title>JS Bin</title> 
 
</head> 
 
<body> 
 
<ul class="stepList"> 
 
    <li class="currentStep" style="width:25%;"> 
 
     <span class="stepWrap"><span class="stepNumber">1</span><span class="stepTitle">Customer Information</span></span> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">2</span><span class="stepTitle">Passenger Information</span></a> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">3</span><span class="stepTitle">Trip Itinerary</span></a> 
 
    </li> 
 
    <li style="width:25%;"> 
 
     <a href="" class="stepWrap"><span class="stepNumber">4</span><span class="stepTitle">Miscellaneous</span></a> 
 
    </li> 
 
</ul> 
 
</body> 
 
</html>

+0

残念ながら[not](http://i.imgur.com/OSnDcaP.png)。 – mpen

+0

@mpen使用しているOSとブラウザは何ですか? – Alen

+0

Win10、Chrome。時には完璧に並んでいることもありますが、時にはそうではありません。ブラウザの幅やズームを調整してみてください。私はそれがピクセルオフセットの問題だと確信しています。 – mpen

関連する問題