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

質問編集履歴

3

参考画像の追加

2017/10/25 12:49

投稿

kenkbou
kenkbou

スコア151

title CHANGED
File without changes
body CHANGED
@@ -94,4 +94,4 @@
94
94
  ```
95
95
 
96
96
  以下のような背景のデザインにしたいと考えております。
97
- ![イメージ説明](932402dcd46fbe3e5a65e5173f2a3136.png)
97
+ ![イメージ説明](529849ac31f5a340726b6f909134d21c.png)

2

参考画像の追加

2017/10/25 12:49

投稿

kenkbou
kenkbou

スコア151

title CHANGED
File without changes
body CHANGED
@@ -91,4 +91,7 @@
91
91
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="none">
92
92
  <path d="M0,100 v-100 L100,100 Z" fill="#aaa" />
93
93
  </svg>
94
- ```
94
+ ```
95
+
96
+ 以下のような背景のデザインにしたいと考えております。
97
+ ![イメージ説明](932402dcd46fbe3e5a65e5173f2a3136.png)

1

ソースコードの記載

2017/10/25 12:49

投稿

kenkbou
kenkbou

スコア151

title CHANGED
File without changes
body CHANGED
@@ -9,4 +9,86 @@
9
9
  サイト全体に斜め線のoverlayをかける
10
10
   → コンテンツ部分はz-indexで前に出したが、positionがabsoluteしたものが前に出ない
11
11
 
12
- 何か良い方法をご存知の方教えていただきたいです。
12
+ 何か良い方法をご存知の方教えていただきたいです。
13
+
14
+ 以下がソースとなります。
15
+ ※ id=content01にはoverlayはかけたくありません。
16
+ ※ content02、03のabsoluteしている画像にはoverlayはかけたくない
17
+ ※ content02の画像がcontent01に若干 重なる(content02が上)
18
+ といった条件で作りたいです。
19
+
20
+ ```Html
21
+ <body>
22
+ <div class="overlay"></div>
23
+ <div id="content01">
24
+ <img src="images/content01.png" width="600px">
25
+ </div>
26
+ <div id="content02">
27
+ <img src="images/content02.png" width="600px">
28
+ </div>
29
+ <div id="content02">
30
+ <img src="images/content03.png" width="600px">
31
+ </div>
32
+ </body>
33
+
34
+ <style>
35
+ body {position:relative;}
36
+ .overlay {
37
+ position: absolute;
38
+ width: 100%;
39
+ height: 100%;
40
+ background-image: url(images/strip.png);
41
+ background-repeat: repeat;
42
+ z-index: 11;
43
+ }
44
+ #content01 {
45
+ min-height: 500px;
46
+ background-image: url(images/content01.png);
47
+ background-position: top center;
48
+ background-repeat: no-repeat;
49
+ background-size: contain;
50
+ }
51
+ #content02 {
52
+ height: 500px;
53
+ padding-top: 120px;
54
+ padding-bottom: 120px;
55
+ width: 100%;
56
+ background: #ccc;
57
+ z-index: 1;
58
+ }
59
+ #content02 img {
60
+ position: absolute;
61
+ }
62
+ #content02:before {
63
+ background-image: url("svg/content02.svg");
64
+ }
65
+ #content03 {
66
+ height: 500px;
67
+ padding-top: 120px;
68
+ padding-bottom: 120px;
69
+ width: 100%;
70
+ background: #aaa;
71
+ z-index: 1;
72
+ }
73
+ #content03 img {
74
+ position: absolute;
75
+ }
76
+ #content03:before {
77
+ background-image: url("svg/content03.svg");
78
+ }
79
+ </style>
80
+ ```
81
+
82
+ content02.svg
83
+ ```SVG
84
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="none">
85
+ <path d="M0,100 v-100 L100,100 Z" fill="#ccc" />
86
+ </svg>
87
+ ```
88
+
89
+ content03.svg
90
+ ```SVG
91
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="none">
92
+ <path d="M0,100 v-100 L100,100 Z" fill="#aaa" />
93
+ </svg>
94
+ ```