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; } 

enter image description here

what wanted:

enter image description here

you need use simple css style

56.25% = 16:9 aspect ratio

.img {     width: 100%;     height: 56.25vw; } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -