こんにちは
下記のような CSS ではどうでしょうか。
動画のみの場合
.has-header-video .custom-header-media iframe,
.has-header-video .custom-header-media video {
object-fit: contain;
}
ヘッダーまるごとの場合
.home.blog.has-header-video .custom-header-media {
position: static;
height: auto;
min-height: 200px;
max-height: 100vh;
}
.admin-bar.home.blog.has-header-video .custom-header-media {
height: auto;
max-height: calc(100vh - 32px);
}
.has-header-video.home.blog .custom-header {
height: auto;
}
.has-header-video .custom-header-media iframe,
.has-header-video .custom-header-media video {
position: static;
min-height: auto;
object-fit: contain;
}
@ishitakaさん、ご返信ありがとうございます。
上記、両方試しましたがだめでした。
何かが邪魔をしているのでしょうか?
もともと組み込まれているcssを優先できるのは!importantしかないですよね?
追記:私の記述が悪く、補足です。
PCは表示されますが、可変しない、ということで困っています。失礼しました!
@ishitakaさん
はい、都度キャッシュクリアしてレスポンシブビューワーで画面確認を行なっています。
動画自体はvimeoで作成して15秒くらいの短いやつなんですが…
すみません、埋め込み動画のことを忘れてました。
vimeo でしたら下記のような CSS ではどうでしょうか。
.home.blog.has-header-video .custom-header-media {
position: static;
height: auto;
min-height: 200px;
}
.admin-bar.home.blog.has-header-video .custom-header-media {
height: auto;
max-height: auto;
}
.has-header-video.home.blog .custom-header {
height: auto;
}
#wp-custom-header {
position: relative;
width: 100%;
height: auto;
padding-top: 56.25%; /* vimeo 16:9 */
}
.has-header-video .custom-header-media iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: none;
}
@ishitakaさん、返信遅くなりました。
上記の件は、未だ微妙ですがとりあえずは画面内に収めることができ、解決いたしました!
元々書かれていたコード↓
.has-header-video .custom-header-media video {
position: fixed;
left: 50%;
max-width: none;
min-height: 100%;
min-width: 100%;
min-width: 100vw;
top: 50%;
padding-bottom: 1px;
transform: translateX(-50%) translateY(-50%);
このfixed;を調整したらスマホ画面に収まることができたという‥。
しかし、背景のバックスクリーンがスマホでも画面のheightがずれてしまいます、これはデバイスによって仕方のないことなのか、未だ分かりませんがとりあえずは見切れていないのでよしとします!
本当にありがとうございました!