私はfigure
タグを持っています。その中にはimg
とfigcaption
があります。figcaptionフィギュアの垂直高さ?
私はあなたがおそらくブラウザの高さを一致させるためにvh
を使用することになりました。この理由は、ということですで、ウィンドウサイズに基づいて可変である(figure
の高さに一致するようにfigcaption
の幅を取得しようとしています私はfigcaption
90度を回転させ、図の高さに中心figcaption
テキストを希望しています。
HTML
<figure>
<img src="http://placehold.it/350x150">
<figcaption>Title</figcaption>
</figure>
CSS
figure {
padding:20px;
display:block;
background:#ffa2df;
position: relative;
}
figure img {
width: 100%;
height: auto;
}
figcaption {
transform: rotate(-90deg);
transform-origin: 0 0;
text-align: center;
background: red;
position: absolute;
width: 100%;
height: 20px;
display:flex;
flex-direction: column;
float:left;
}
ない、数字の高さは、ブラウザの幅に基づいて可変であるとして。私はオプションとして高さを修正することができましたが、私はむしろそれは柔軟でした –