Resizing in html and CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Resizing in html and CSS

if i want to resize the embedded youtube thumbnail specifically for mobile devices how should i define the height and width, as even in PX or in % it will change both for desktop and mobile, but i want it to be resized only for mobile. is it possible in the html embedded code of the video .. plz guide

6th May 2018, 3:11 AM
Jimmy
6 Answers
+ 1
use '@media' in CSS to define styles depending on screen sizes. https://www.w3schools.com/css/css_rwd_mediaqueries.asp
6th May 2018, 4:36 AM
wenz
wenz - avatar
+ 1
@media only screen and (max-width: 500px) { #myvideo { width: 80vw;}} in this example CSS applies styles for screens with less than 500px width. the width of the video is 80vw/80% of the screen width. ok?
6th May 2018, 4:51 AM
wenz
wenz - avatar
0
should i use the viewport and if yes how. plz guide.
6th May 2018, 4:38 AM
Jimmy
0
so i have to use the #idname for every video that i will embed..is I am getting correctly
6th May 2018, 5:06 AM
Jimmy
0
you can use one class for all videos
6th May 2018, 5:19 AM
wenz
wenz - avatar
0
yeah.. just did the same as u guided.. thanks a lot bro. u really rock !!! ☺
6th May 2018, 5:22 AM
Jimmy