teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コードを<code>の欄に記入し直しました。

2019/11/25 15:38

投稿

Teruaki0131
Teruaki0131

スコア9

title CHANGED
File without changes
body CHANGED
@@ -17,8 +17,49 @@
17
17
  左:スマホサイズ 右:PCサイズ
18
18
  ![イメージ説明](6c1ac45b48a8abc864e0587eb602709e.png)
19
19
 
20
- ↓@mediaでPCサイズになった場合の指示として記述したコード↓
21
- ![イメージ説明](37819a2a404ef1e28453023d4e7b762a.png)
22
20
 
21
+ コード
22
+ HTML
23
+
24
+ <div class="uncle_first">
25
+ <img class="uncle_first" src="img/young_uncle_2.png" alt="uncle">
26
+ </div>
27
+ <div class="uncle_second">
28
+ <img class="uncle_first" src="img/young_uncle.jpg" alt="uncle">
29
+ </div>
30
+
31
+ CSS
32
+ /*共通CSS*/
33
+ div.uncle_first {
34
+ width: 100%;
35
+ height: auto;
36
+ /*position: relative;*/
37
+ /*object-fit: cover;*/
38
+ margin-top: 60px;
39
+ }
40
+
41
+ div.uncle_second {
42
+ display: none
43
+ }
44
+
45
+
46
+ /*mediumサイズの時の記述*/
47
+
48
+ @media screen and (min-width: 744px) {
49
+
50
+ /*正方形画像です*/
51
+ img.uncle_first {
52
+ display: none;
53
+ }
54
+
55
+ /*長方形画像です*/
56
+ img.uncle_second {
57
+ display: block;
58
+ width: 100%;
59
+ height: auto;
60
+ }
61
+
62
+ }
63
+
23
64
  内容が煩雑になっているかもしれません、申し訳ございません。
24
65
  原因と解決方法を教えていただきたいです、よろしくお願いいたします。