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

質問編集履歴

2

コードの追記

2017/04/16 15:57

投稿

Yossyu
Yossyu

スコア8

title CHANGED
File without changes
body CHANGED
@@ -15,42 +15,90 @@
15
15
 
16
16
  ##コード
17
17
  ```html
18
+ <ul>
19
+ <li>
18
- <a href="#" class="button">
20
+ <a href="#" class="button">
19
- <img src="xxxx">
21
+ <img src="/image/xxxxx.jpg">
20
- </a>
22
+ </a>
23
+ </li>
24
+ <li>
25
+ <a href="#" class="button">
26
+ <img src="/image/xxxxx.jpg">
27
+ </a>
28
+ </li>
29
+ <li>
30
+ <a href="#" class="button">
31
+ <img src="/image/xxxxx.jpg">
32
+ </a>
33
+ </li>
34
+ <li>
35
+ <a href="#" class="button">
36
+ <img src="/image/xxxxx.jpg">
37
+ </a>
38
+ </li>
39
+ </ul>
21
40
  ```
22
41
 
23
42
  ```css
43
+ * {
44
+ padding: 0;
45
+ margin: 0;
46
+ }
47
+ ul {
48
+ display: -webkit-flex;
49
+ display: -moz-flex;
50
+ display: -ms-flex;
51
+ display: -o-flex;
52
+ display: flex;
53
+ -webkit-flex-wrap: wrap;
54
+ -moz-flex-wrap: wrap;
55
+ -ms-flex-wrap: wrap;
56
+ -o-flex-wrap: wrap;
57
+ flex-wrap: wrap;
58
+ }
59
+ li {
60
+ width: 300px;
61
+ }
62
+ a {
63
+ overflow: hidden;
64
+ display: block;
65
+ position: relative;
66
+ }
24
- a.button::before, a.button::after {
67
+ a.button::before,
68
+ a.button::after {
25
- position: absolute;
69
+ position: absolute;
26
- top: 0;
70
+ top: 0;
27
- right: 0;
71
+ right: 0;
28
- bottom: 0;
72
+ bottom: 0;
29
- left: 0;
73
+ left: 0;
30
- z-index: 2;
74
+ z-index: 2;
31
- content: '';
75
+ content: '';
32
- -webkit-transition: all .5s;
76
+ -webkit-transition: all .5s;
33
- transition: all .5s;
77
+ transition: all .5s;
34
- }
78
+ }
79
+
35
- a.button::before {
80
+ a.button::before {
36
- border-top: 20px solid #196ea9;
81
+ border-top: 20px solid #196ea9;
37
- border-bottom: 20px solid #196ea9;
82
+ border-bottom: 20px solid #196ea9;
38
- -webkit-transform: scale(0, 1);
83
+ -webkit-transform: scale(0, 1);
39
- -ms-transform: scale(0, 1);
84
+ -ms-transform: scale(0, 1);
40
- transform: scale(0, 1);
85
+ transform: scale(0, 1);
41
- }
86
+ }
87
+
42
- a.button::after {
88
+ a.button::after {
43
- border-right: 20px solid #196ea9;
89
+ border-right: 20px solid #196ea9;
44
- border-left: 20px solid #196ea9;
90
+ border-left: 20px solid #196ea9;
45
- -webkit-transform: scale(1, 0);
91
+ -webkit-transform: scale(1, 0);
46
- -ms-transform: scale(1, 0);
92
+ -ms-transform: scale(1, 0);
47
- transform: scale(1, 0);
93
+ transform: scale(1, 0);
48
- }
94
+ }
95
+
49
- a.button:hover::before, a.button:hover::after {
96
+ a.button:hover::before,
97
+ a.button:hover::after {
50
- -webkit-transform: scale(1);
98
+ -webkit-transform: scale(1);
51
- -ms-transform: scale(1);
99
+ -ms-transform: scale(1);
52
- transform: scale(1);
100
+ transform: scale(1);
53
- }
101
+ }
54
102
  ```
55
103
 
56
104
  上記の内容でマウスオーバー時に

1

コードの追記

2017/04/16 15:56

投稿

Yossyu
Yossyu

スコア8

title CHANGED
File without changes
body CHANGED
@@ -13,7 +13,50 @@
13
13
 
14
14
  マウスオーバーが外れたら上記のように表示されたborderが非表示になる
15
15
 
16
+ ##コード
17
+ ```html
18
+ <a href="#" class="button">
19
+ <img src="xxxx">
20
+ </a>
21
+ ```
16
22
 
23
+ ```css
24
+ a.button::before, a.button::after {
25
+ position: absolute;
26
+ top: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ left: 0;
30
+ z-index: 2;
31
+ content: '';
32
+ -webkit-transition: all .5s;
33
+ transition: all .5s;
34
+ }
35
+ a.button::before {
36
+ border-top: 20px solid #196ea9;
37
+ border-bottom: 20px solid #196ea9;
38
+ -webkit-transform: scale(0, 1);
39
+ -ms-transform: scale(0, 1);
40
+ transform: scale(0, 1);
41
+ }
42
+ a.button::after {
43
+ border-right: 20px solid #196ea9;
44
+ border-left: 20px solid #196ea9;
45
+ -webkit-transform: scale(1, 0);
46
+ -ms-transform: scale(1, 0);
47
+ transform: scale(1, 0);
48
+ }
49
+ a.button:hover::before, a.button:hover::after {
50
+ -webkit-transform: scale(1);
51
+ -ms-transform: scale(1);
52
+ transform: scale(1);
53
+ }
54
+ ```
55
+
56
+ 上記の内容でマウスオーバー時に
57
+ 上下左右のborderがそれぞれ真ん中から上下・左右に表示されるところまではできたのですが
58
+ 表題の通りの動作にしたいです。
59
+
17
60
  ##参考サイト
18
61
  http://www.aim-info.co.jp/recruit/
19
62