回答編集履歴
2
表示が崩れていたので修正
test
CHANGED
@@ -54,6 +54,7 @@
|
|
54
54
|
|
55
55
|
<div class="top-image">の後に兄弟要素として追加してください。
|
56
56
|
チェック用の後続要素です。
|
57
|
+
|
57
58
|
```html
|
58
59
|
<div class="text-content">The quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dog</div>
|
59
60
|
```
|
1
コメントを読んで、コード改修
test
CHANGED
@@ -17,3 +17,43 @@
|
|
17
17
|
bottom: -4px;
|
18
18
|
}
|
19
19
|
```
|
20
|
+
|
21
|
+
---
|
22
|
+
2022-04-16追記
|
23
|
+
|
24
|
+
borderはpaddingの外側にあるので、borderを動かす為にpaddingを操作してます。
|
25
|
+
ただそのままだと、増えたpadding分、後続の要素に影響を与えてしまうので
|
26
|
+
borderの外側にあるmarginも操作してバランスをとっています。
|
27
|
+
|
28
|
+
```css
|
29
|
+
.top-text a {
|
30
|
+
color: black;
|
31
|
+
position: relative;
|
32
|
+
border-bottom: 1px solid #333;
|
33
|
+
display: inline-block;
|
34
|
+
transition: all .3s;
|
35
|
+
/* 問題のプロパティ */
|
36
|
+
/* bottom: 2px; */
|
37
|
+
padding-bottom:0;
|
38
|
+
margin-bottom:0.4em;
|
39
|
+
}
|
40
|
+
|
41
|
+
.top-text a:hover {
|
42
|
+
border-bottom: 1px solid #3330;
|
43
|
+
/* opacity: 0; */
|
44
|
+
/* bottom: -4px; */
|
45
|
+
padding-bottom:0.4em;
|
46
|
+
margin-bottom:0;
|
47
|
+
}
|
48
|
+
.text-content{
|
49
|
+
padding:2em;
|
50
|
+
text-align:center;
|
51
|
+
background:tomato;
|
52
|
+
}
|
53
|
+
```
|
54
|
+
|
55
|
+
<div class="top-image">の後に兄弟要素として追加してください。
|
56
|
+
チェック用の後続要素です。
|
57
|
+
```html
|
58
|
+
<div class="text-content">The quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dog</div>
|
59
|
+
```
|