這裏有一個demo解釋按鈕的這種垂直對齊和SVG
我終於用table
和table-cell
修復它,但你能解釋一下這個垂直對齊是什麼?這沒有任何意義。它既不是頂端對齊,也不是中間和底部,它驅使我堅果。如果你刪除了svg
並放置文本,它就可以正常工作。
什麼是默認對齊?
#footer{
left: 0;
right: 0;
top: 0;
position: absolute;
/*display:table;*/
}
button.ytp-play-button {
padding: 0;
width: 50px;
height: 50px;
border: none;
}
button{
display:inline-block;
/*display:table-cell;*/
/*vertical-align:middle;*/
}
<div id="footer">
\t <button class="ytp-play-button ytp-button" aria-live="assertive" tabindex="32" aria-label="Pause">
\t \t <svg width="100%" height="100%" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
\t \t \t \t <defs>
\t \t \t \t \t <path id="ytp-12" d="M 11 10 L 17 10 L 17 26 L 11 26 M 20 10 L 26 10 L 26 26 L 20 26">
\t \t \t \t \t \t \t <animate id="animation" begin="indefinite" attributeType="XML" attributeName="d" fill="freeze" from="M11,10 L17,10 17,26 11,26 M20,10 L26,10 26,26 20,26" to="M11,10 L18,13.74 18,22.28 11,26 M18,13.74 L26,18 26,18 18,22.28" dur="0.1s" keySplines=".4 0 1 1" repeatCount="1"></animate>
\t \t \t \t \t </path>
\t \t \t \t </defs>
\t \t \t \t <use xlink:href="#ytp-12" class="ytp-svg-shadow"></use>
\t \t \t \t <use xlink:href="#ytp-12" class="ytp-svg-fill"></use>
\t \t </svg>
\t </button>
\t <button>sign up</button>
\t <button>feedback</button>
</div>
Omg。非常感謝。 – Miro