質問編集履歴
2
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,14 +1,56 @@
|
|
1
|
+
内容を修正致しました。わかりづらく申し訳ございません。
|
1
2
|
いつもお世話になっております。どうかご教授下さい。
|
2
3
|
|
4
|
+
|
3
5
|
現在SVGでテキストを表示させているのですが、ウィンドウを可変してもx,yの座標を決めている為、当然ながら中央揃えになりません。
|
4
6
|
|
5
7
|
```html
|
6
|
-
<
|
8
|
+
<div class="gradient_bg mask">
|
9
|
+
</div>
|
10
|
+
<svg>
|
7
|
-
|
11
|
+
<clipPath id="svgPath">
|
8
|
-
|
12
|
+
<text x="300" y="300" textLength="700" font-family="sans-serif" font-size="150px"font-style="italic"font-weight="bold">HOGE</text>
|
9
|
-
|
13
|
+
</clipPath>
|
10
14
|
</svg>
|
15
|
+
</body>
|
16
|
+
|
11
17
|
```
|
12
18
|
|
19
|
+
```css
|
20
|
+
.gradient_bg{
|
21
|
+
width: 1020px;
|
22
|
+
height: 400px;
|
23
|
+
margin: 0 auto;
|
24
|
+
background: linear-gradient(270deg, #3fb1d3, #ffffff);
|
25
|
+
background-size: 600% 600%;
|
26
|
+
|
27
|
+
-webkit-animation: AnimationName 15s ease infinite;
|
28
|
+
-moz-animation: AnimationName 15s ease infinite;
|
29
|
+
animation: AnimationName 15s ease infinite;
|
30
|
+
|
31
|
+
@-webkit-keyframes AnimationName {
|
32
|
+
0%{background-position:0% 50%}
|
33
|
+
50%{background-position:100% 50%}
|
13
|
-
|
34
|
+
100%{background-position:0% 50%}
|
35
|
+
}
|
36
|
+
@-moz-keyframes AnimationName {
|
37
|
+
0%{background-position:0% 50%}
|
38
|
+
50%{background-position:100% 50%}
|
39
|
+
100%{background-position:0% 50%}
|
40
|
+
}
|
41
|
+
@keyframes AnimationName {
|
42
|
+
0%{background-position:0% 50%}
|
43
|
+
50%{background-position:100% 50%}
|
44
|
+
100%{background-position:0% 50%}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.mask {
|
49
|
+
-webkit-clip-path: url(#svgPath);
|
50
|
+
clip-path: url(#svgPath);
|
51
|
+
}
|
52
|
+
```
|
53
|
+
|
54
|
+
やりたいことはグラデーションをマスクしたSVGテキストを1020pxの間でセンタ揃えにしたいという事になります。
|
55
|
+
説明不足で大変申し訳ございません。
|
14
|
-
|
56
|
+
どうぞご教授お願いいたします。
|
1
文言の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
```html
|
6
6
|
<svg "width="1020px" height="400px">
|
7
7
|
<clipPath id="svgPath">
|
8
|
-
<text x="100" y="100" textLength="700" font-family="sans-serif" font-size="150px"font-style="italic"font-weight="bold">
|
8
|
+
<text x="100" y="100" textLength="700" font-family="sans-serif" font-size="150px"font-style="italic"font-weight="bold">HOGE</text>
|
9
9
|
</clipPath>
|
10
10
|
</svg>
|
11
11
|
```
|