前提・実現したいこと
aタグの要素に対してhover時にborderが下がりながら消えるアニメーションをつけようとしているんですが、transitionの値にborderを指定すると、その場から一瞬で消えるようになります。対象(property)を指定せず、値を「.3s」だけにするとアニメーション自体は想定通りの動きをしますが、ボーダー以外もアニメーションが適応されてしまいます。
borderだけにアニメーションを適応できないのはなぜでしょうか?
該当のソースコード
HTML
1<div class="top-image"> 2 <figure> 3 <img src="../images/pickup1.jpg"> 4 <figcaption>タイトルテキストテキストテキストテキストテキストテキストテキスト</figcaption> 5 <div class="top-text"> 6 <p><a href="#">READ MORE</a></p> 7 </div><!-- /top-text --> 8 </figure> 9 <figure> 10 <img src="../images/pickup2.jpg"> 11 <figcaption>タイトルテキストテキストテキストテキストテキストテキストテキスト</figcaption> 12 <div class="top-text"> 13 <p><a href="#">READ MORE</a></p> 14 </div><!-- /top-text --> 15 </figure> 16 <figure> 17 <img src="../images/pickup3.jpg"> 18 <figcaption>タイトルテキストテキストテキストテキストテキストテキストテキスト</figcaption> 19 <div class="top-text"> 20 <p><a href="#">READ MORE</a></p> 21 </div><!-- /top-text --> 22 </figure> 23 </div><!-- /top-image -->
CSS
1@charset "utf-8"; 2 3/* ====== 共通 ====== */ 4html,body { 5 font-size: 16px; 6} 7 8body,div,p,h1,h2,h3,h4,h5,h6,ul,li,figure { 9 margin: 0; 10 padding: 0; 11} 12 13p,td,th,li { 14 line-height: 1.8; 15} 16 17a { 18 text-decoration: none; 19} 20 21li { 22 list-style: none; 23} 24 25.container { 26 max-width: 1000px; 27 margin: 0 auto; 28} 29 30 31/* ====== main ====== */ 32.top-image { 33 display: flex; 34 justify-content: space-between; 35 padding: 150px 0 35px 0; 36} 37 38.top-image figure { 39 width: 31%; 40} 41 42.top-image figcaption { 43 font-weight: bold; 44 padding-top: 10px; 45 font-size: 14px; 46 line-height: 1.7; 47 letter-spacing: 1px; 48} 49 50.top-image img { 51 width: 100%; 52} 53 54.top-text { 55 text-align: center; 56 padding-top: 20px; 57} 58 59.top-text p { 60 display: inline-block; 61 font-size: 13px; 62 line-height: 1; 63} 64 65.top-text a { 66 position: relative; 67 border-bottom: 1px solid #333; 68 display: inline-block; 69 transition: border .3s; /* 問題のプロパティ */ 70 bottom: 2px; 71 color: black; 72} 73 74.top-text a:hover { 75 opacity: 0; 76 bottom: -4px; 77}
試したこと
transition-duration: .3s;
transition-property: border;
としても同じようにdurationの方を無視して一瞬で消えました。
補足情報(FW/ツールのバージョンなど)
dynabook V72/JLE
型番:PV82JLECNRDQE

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/15 13:38
2022/04/15 23:05 編集
2022/04/16 02:15
2022/04/16 09:04
2022/04/16 12:22
2022/04/16 13:58
2022/04/16 15:00