質問編集履歴
1
このようにtxt-wrapではなくimgが動いてしまいます。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
```html
|
2
|
-
|
2
|
+
<section class="section1">
|
3
3
|
<div class="txt-wrap">
|
4
4
|
<div class="h2-wrap">
|
5
5
|
<h2>フィットネス<span>ダイエット目的</span></h2>
|
@@ -9,19 +9,21 @@
|
|
9
9
|
<img class="main-img" src="img/img-index-01.jpg">
|
10
10
|
</div>
|
11
11
|
</section>
|
12
|
-
|
13
12
|
```
|
14
13
|
```css
|
14
|
+
|
15
|
-
section1 {
|
15
|
+
.section1 {
|
16
16
|
display: flex;
|
17
|
-
align-items: center
|
17
|
+
align-items: center;
|
18
|
+
max-width: 1280px;
|
19
|
+
|
18
20
|
}
|
19
21
|
|
20
22
|
.section1 .txt-wrap {
|
21
23
|
flex: 0 1 50%;
|
22
24
|
background: red;
|
23
|
-
padding:
|
25
|
+
padding: 100px 0 150px 0;
|
24
|
-
|
26
|
+
margin-right: -100px
|
25
27
|
}
|
26
28
|
|
27
29
|
.section1 .txt-wrap .h2-wrap {
|
@@ -30,36 +32,27 @@
|
|
30
32
|
width: 98%;
|
31
33
|
position: relative;
|
32
34
|
z-index: 2;
|
33
|
-
padding: 40px 20px
|
35
|
+
padding: 40px 20px;
|
34
|
-
}
|
35
36
|
|
36
|
-
.section1 .txt-wrap h2 {}
|
37
|
-
|
38
|
-
.section1 .txt-wrap ul {
|
39
|
-
width: 70%;
|
40
|
-
margin-left: 30px;
|
41
|
-
margin-top: 20px
|
42
37
|
}
|
43
38
|
|
44
|
-
.section1 .txt-wrap ul li {
|
45
|
-
border: 1px solid;
|
46
|
-
color: #fff;
|
47
|
-
padding: 10px;
|
48
|
-
margin: 0 0 0 5px
|
49
|
-
}
|
50
|
-
|
51
39
|
.section1 .img {
|
52
40
|
flex: 0 1 50%;
|
53
41
|
position: relative;
|
54
|
-
z-index: 1;
|
55
|
-
margin-left: -100px
|
56
|
-
|
57
42
|
}
|
58
43
|
|
59
44
|
.section1 .img .main-img {
|
60
|
-
width:
|
45
|
+
width: 110%;
|
61
46
|
box-shadow: 0 0 3px #ddd;
|
62
47
|
}
|
48
|
+
|
49
|
+
.section1 .img .sub-img {
|
50
|
+
position: absolute;
|
51
|
+
bottom: 20px;
|
52
|
+
left: -10px;
|
53
|
+
z-index: 2;
|
54
|
+
width: 50%
|
55
|
+
}
|
63
56
|
```
|
64
57
|
.imgにmargin-leftt:-100pxをつけると.imgが左に100pxずれるのはわかるのですが
|
65
58
|
.txt-wrapにmargin-right:-100pxをつけると.txt-wrapが右にずれるのではなく.imgが左に100pxずれるのはなぜでしょうか。
|