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

回答編集履歴

1

コード追加

2021/01/22 04:23

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -2,11 +2,30 @@
2
2
 
3
3
  単純に親にグリッド線、子に透過グラデーションを設定すればいいでしょう。
4
4
 
5
- CSSはそのままでHTMLを下記のように。
6
-
7
5
  ```html
8
6
  <div class="grid">
9
7
  <div class="grad">
10
8
  </div>
11
9
  </div>
10
+ ```
11
+
12
+ ```css
13
+ .grad {
14
+ width: 300px;
15
+ height: 100px;
16
+ background-image: linear-gradient(
17
+ to top,
18
+ rgba(255, 255, 255, 0),
19
+ rgba(255, 255, 255, 1)
20
+ );
21
+ }
22
+ .grid {
23
+ width: 300px;
24
+ height: 300px;
25
+ background-image: linear-gradient(currentColor 1px, transparent 1px),
26
+ linear-gradient(to right, currentColor 1px, transparent 1px);
27
+ background-size: 40px 40px;
28
+ background-color: rgba(255, 255, 255, 0);
29
+ background-blend-mode: lighten;
30
+ }
12
31
  ```