Help us understand the problem. What is going on with this article?

Video要素の縦横比を変更する

More than 3 years have passed since last update.

検証環境

Chrome 54.0.2840.59

問題点

Video要素のwidth, heightを変更しても要素の縦横比がキープされた状態で大きさが変更されてしまうため、Video要素は縦横比を変えることが出来ない。グーグル先生は解決方法を教えてくれない(と、ある勉強会で聞いた)

原因

Video要素のobject-fitがデフォルトでcontainになっている。
※Image要素とかは、fill

解決方法

object-fit: fillを指定する。

video {
    object-fit: fill;
    width: 75%;
}

解決方法2

transformでも一応大丈夫そう

video {
    transform: scale(0.75, 1);
}

グーグル先生向け

アスペクト比 変わらない width height

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした