下記のコードの「中身を表示」の部分でhoverで表示するように設定し、指定した部分の上にカーソルを置けば、中身が表示されるのですが、その表示された中身の位置にカーソルを移動させると中身が非表示になってしまいます。
中身にはURLが貼ってあるので、カーソルを中身の部分に動かしたときも表示したままにしたいのですが、どうすればよいでしょうか?
当方、CSSは初心者で以下のコードはググって調べたものをコピペしたものです。
HTML
<link rel="stylesheet" type="text/css" href="tesss.css"> <div id="contents"> <div class="accbox"> <div style="position:absolute; top:40px; left:30px"> <label for="label1">一覧</label> <input type="checkbox" id="label1" class="cssacc" /> <div class="accshow"> <!--ここに隠す中身--> <p> URL </p> </div></div> </div>
css
/*ラベル*/ .accbox label { display: block; margin: 1.5px 0; padding : 11px 12px; color :#2f8fcf; font-weight: bold; background :#a4cbf3; cursor :pointer; transition: all 0.5s; } /*ラベルホバー時*/ .accbox label:hover { background :#85baef; } /*チェックは隠す*/ .accbox input { display: none; } /*中身を非表示にしておく*/ .accbox .accshow { height: 0; padding: 0; overflow: hidden; opacity: 0; transition: 0.8s; } /*中身表示*/ .cssacc:hover + .accshow { height: auto; padding: 5px; background: #eaeaea; opacity: 1; }
回答1件
あなたの回答
tips
プレビュー