javascript - How to set height div css for 16:9 aspect ratio in portrait mode for Ionic 2 -
suppose have div on top of ion-content. i'm trying set height of div getting width of device , calculate aspect ratio 16:9 youtube app. however, have no idea how achieve using css. now, have.
div { width: auto; max-height: 40%; <-- how set height 16:9 background: black; div.img { width: 360px; max-height: 202.5px; }
what wanted:
you need use simple css style
56.25% = 16:9 aspect ratio
.img { width: 100%; height: 56.25vw; }
Comments
Post a Comment