Change video size depending on whether it is displayed on a phone or a computer

Sometimes I use short videos on my homework page.

<div id="div-with-bg"> 
<video controls style="width:50%;height:50%;" poster="../images/smiley1.png">
  <source src="../video/Networking_Tips.mp4" type='video/mp4;codecs="avc1.42E01E, mp4a.40.2"'/>
</video>
</div><br>

How can I dynamically change the size of the video, depending on the display, phone or computer?

Can this be done with PHP?

You might be able to do it with PHP, but a better approach would be to use media queries.

1 Like

As per skawid’s comment. You would simply do this using css.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service