質問編集履歴

2

文章を変更

2022/04/13 03:48

投稿

suzu1234
suzu1234

スコア41

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  理屈が理解できないのですが、こちらの現象について詳しい方がいましたら是非教えていただきたいです。
4
4
 
5
- レスポンシブの中にある「.position-image { width: 80%; margin-top: 100px; }」のmarginの部分が訊きません。widthなどは適用することができます。
5
+ 「@media screen and (max-width: 768px) 」の中にある「.position-image { width: 80%; margin-top: 100px; }」のmarginの部分が訊きません。widthなどは適用することができます。
6
6
 
7
7
  ```ここに言語を入力
8
8
  <section id="values">

1

コードを追加

2022/04/13 03:46

投稿

suzu1234
suzu1234

スコア41

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,137 @@
1
1
  画像にclassをつけてmargin-topを指定したのですが反映されませんでした。しかし、「#〇〇 .〇〇」のように、親要素に指定したidをつけたところページにページにmarginを反映させることができました。
2
2
 
3
3
  理屈が理解できないのですが、こちらの現象について詳しい方がいましたら是非教えていただきたいです。
4
+
5
+ レスポンシブの中にある「.position-image { width: 80%; margin-top: 100px; }」のmarginの部分が訊きません。widthなどは適用することができます。
6
+
7
+ ```ここに言語を入力
8
+ <section id="values">
9
+ <div class="container main">
10
+
11
+ <h2 class="section-title">
12
+ <span class="jp">新しい価値の創造</span>
13
+ <span class="en">Create New Values</span>
14
+ </h2>
15
+
16
+ <img class="position-image" src="https://code-step.com/demo/html/store3/img/products1.jpg" alt="">
17
+
18
+ <div class="position-text">
19
+ <p>テキストテキスト<br/>テキストテキスト</p>
20
+ </div>
21
+
22
+ </div>
23
+ </section>
24
+ ```
25
+
26
+ ```ここに言語を入力
27
+ .main {
28
+ max-width: 1000px;
29
+ width: 100%;
30
+ margin: 0 auto;
31
+ background-color: pink;
32
+ }
33
+
34
+ .section-title {
35
+ writing-mode: vertical-rl;
36
+ }
37
+
38
+ .section-title .en {
39
+ font-size: 14px;
40
+ }
41
+
42
+ .section-title .jp {
43
+ font-size: 36px;
44
+ letter-spacing: 5px;
45
+ font-weight: normal;
46
+ }
47
+
48
+ .position-image {
49
+ width: 64%;
50
+ }
51
+
52
+ .position-text {
53
+ background-color: red;
54
+ width: 35%;
55
+ padding: 30px 0;
56
+ text-align: center;
57
+ color: white;
58
+ font-weight: bold;
59
+ }
60
+
61
+
62
+
63
+
64
+ #values .main {
65
+ margin-top: 180px;
66
+ display: flex;
67
+ flex-direction: row-reverse;
68
+ position: relative;
69
+ }
70
+
71
+ #values .section-title {
72
+ margin: 0;
73
+ background-color: red;
74
+ }
75
+
76
+ #values .section-title .jp {
77
+ font-size: 32px;
78
+ letter-spacing: 5px;
79
+ }
80
+
81
+ #values .position-image {
82
+ margin-right: 8px;
83
+ margin-top: 100px;
84
+ }
85
+
86
+ #values .position-text {
87
+ position: absolute;
88
+ top: 400px;
89
+ left: 280px;
90
+ background-color: rgba(255,255,0,0.6);
91
+ }
92
+
93
+
94
+
95
+
96
+ @media screen and (max-width: 768px) {
97
+ .main {
98
+ padding: 0 4%;
99
+ }
100
+
101
+ .section-title .en {
102
+ font-size: 14px;
103
+ }
104
+
105
+ #values .section-title .en,
106
+ #sciense .section-title .en {
107
+ display: none;
108
+ }
109
+
110
+ #values .section-title .jp,
111
+ #sciense .section-title .jp {
112
+ font-size: 24px;
113
+ }
114
+
115
+ .section-title .jp {
116
+ font-size: 28px;
117
+ }
118
+
119
+ .position-image {
120
+ width: 80%;
121
+ margin-top: 100px;
122
+ }
123
+
124
+
125
+ #values .main {
126
+ margin-top: 80px;
127
+ position: relative;
128
+ }
129
+
130
+ #values .position-text {
131
+ position: absolute;
132
+ top: 200px;
133
+ left: 0px;
134
+ }
135
+
136
+ }
137
+ ```