回答編集履歴
1
コード修正
answer
CHANGED
@@ -25,14 +25,45 @@
|
|
25
25
|
h2 span.sub_title {
|
26
26
|
font-size: 1.1rem;
|
27
27
|
}
|
28
|
-
.title::before {
|
28
|
+
.title::before, .title::after {
|
29
29
|
content: url("https://placehold.jp/40x40.png");
|
30
30
|
width: 40px;
|
31
31
|
height: 40px;
|
32
32
|
}
|
33
|
+
```
|
34
|
+
|
35
|
+
現状のHTMLを変更しないなら、
|
36
|
+
`position: absolute;` で配置するといいでしょう。
|
37
|
+
|
38
|
+
```css
|
39
|
+
.title {
|
40
|
+
margin: 150px auto 75px auto;
|
41
|
+
text-align: center;
|
42
|
+
position: relative;
|
43
|
+
width: max-content;
|
44
|
+
padding: 0 40px;
|
45
|
+
}
|
33
|
-
.title
|
46
|
+
.title span {
|
47
|
+
display: block;
|
48
|
+
}
|
49
|
+
h2 span {
|
50
|
+
font-size: 3rem;
|
51
|
+
}
|
52
|
+
h2 span.sub_title {
|
53
|
+
font-size: 1.1rem;
|
54
|
+
}
|
55
|
+
.title::before, .title::after {
|
34
56
|
content: url("https://placehold.jp/40x40.png");
|
35
57
|
width: 40px;
|
36
58
|
height: 40px;
|
59
|
+
position: absolute;
|
60
|
+
top: 50%;
|
61
|
+
transform: translatey(-50%)
|
37
62
|
}
|
63
|
+
.title::before {
|
64
|
+
left: 0;
|
65
|
+
}
|
66
|
+
.title::after {
|
67
|
+
right: 0;
|
68
|
+
}
|
38
69
|
```
|