やり方は色々あると思いますが、下記のような方法で可能です。
方法1 メディアクエリで分ける
html5
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8 <style>
9 .videoWrap {
10 width: 320px;
11 height: 200px;
12 position: relative;
13 margin: 0 auto;
14 }
15
16 video {
17 width: 100%;
18 background-size: cover;
19 }
20
21 a {
22 display: block;
23 position: absolute;
24 bottom: -10px;
25 left: -20px;
26 font-size: 20px;
27 padding: 20px;
28 background-color: rgba(36, 36, 36, 0.507);
29 text-decoration: none;
30 color: rgb(230, 230, 230);
31 }
32
33 @media (min-width: 600px) {
34 .videoWrap {
35 width: 640px;
36 height: 400px;
37 position: relative;
38 margin: 0 auto;
39 }
40
41 a {
42 bottom: -20px;
43 left: -40px;
44 font-size: 40px;
45 padding: 40px;
46 }
47
48 }
49 </style>
50</head>
51
52<body>
53 <div class="videoWrap">
54 <video autoplay muted loop>
55 <source src="https://f.easyuploader.app/eu-prd/upload/20200820123159_475a4850713442547259.mp4"
56 type="video/mp4" />
57 </video>
58 <a href="https://pixabay.com/videos/underwater-sea-ocean-water-37712/">フリー&再配布OK!</a>
59 </div>
60</body>
61
62</html>
方法2 画像を使う
HTML
1<!DOCTYPE html>
2<html lang="ja">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8 <style>
9 .videoWrap {
10 width: 80vw;
11 max-width: 640px;
12 background-size: contain;
13 margin: 0 auto;
14 position: relative;
15 }
16
17 video {
18 width: 100%;
19 }
20
21 a {
22 display: block;
23 position: absolute;
24 width: 45%;
25 max-width: 288px;
26 height: 25%;
27 background-image: url(https://f.easyuploader.app/eu-prd/upload/20200822160950_5a7a43327a4f45315375.png);
28 background-size: contain;
29 background-repeat: no-repeat;
30 text-decoration: none;
31 color: rgb(230, 230, 230);
32 bottom: -8%;
33 left: -8%;
34 }
35 </style>
36</head>
37
38<body>
39 <div class="videoWrap">
40 <video autoplay muted loop>
41 <source src="https://f.easyuploader.app/eu-prd/upload/20200820123159_475a4850713442547259.mp4"
42 type="video/mp4" />
43 </video>
44 <a href="https://pixabay.com/videos/underwater-sea-ocean-water-37712/"></a>
45 </div>
46</body>
47
48</html>
方法3 Javascriptで制御
HTML
1<!DOCTYPE html>
2<html lang="ja">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8 <style>
9 .videoWrap {
10 width: 80vw;
11 max-width: 640px;
12 background-size: contain;
13 margin: 0 auto;
14 position: relative;
15 }
16
17 video {
18 width: 100%;
19 }
20
21 a {
22 display: block;
23 position: absolute;
24 font-size: 0;
25 line-height: 0;
26 width: 45%;
27 max-width: 288px;
28 height: 25%;
29 background-color: rgba(0, 0, 0, 0.548);
30 text-decoration: none;
31 text-align: center;
32 color: rgb(230, 230, 230);
33 bottom: -8%;
34 left: -8%;
35 }
36 </style>
37</head>
38
39<body>
40 <div class="videoWrap">
41 <video autoplay muted loop>
42 <source src="https://f.easyuploader.app/eu-prd/upload/20200820123159_475a4850713442547259.mp4"
43 type="video/mp4" />
44 </video>
45 <a href="https://pixabay.com/videos/underwater-sea-ocean-water-37712/">フリー&再配布OK!</a>
46 </div>
47 <script>
48
49 window.addEventListener("resize", () => {
50 setTimeout(fontAdjust, 10);
51 });
52
53 window.addEventListener("load", () => {
54 setTimeout(fontAdjust, 50);
55 });
56
57 const fontAdjust = () => {
58 const a = document.getElementsByTagName("a")[0];
59 const aHeight = a.clientHeight;
60 const fontSize = aHeight * 0.33;
61 a.style.fontSize = fontSize + "px";
62 a.style.lineHeight = aHeight + "px";
63 }
64
65
66 </script>
67
68</body>
69
70</html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/08/20 13:05
2020/08/20 13:17
2020/08/20 15:14
2020/08/22 07:57
2020/08/23 02:57