您的位置:首頁技術文章
文章詳情頁

鼠標過導航標簽時,無效果,請問如何查找問題

瀏覽:154日期:2022-10-22 15:03:46

問題描述

<!DOCTYPE html>

<html>

<head>

<meat charset="utf-8">

<title>塊級元素和行內元素相互轉換</title>

<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">

<style type="text/css">

p{display:inline;width:200px;height:200px;backgroud-color:#ccc;}

b{display:block;}

/*div{display:inline-block;height:30px;width:400px;background-color:pink;}*/

.box{width:100px;height:40px;background-color:#ccc;line-height: 40px;text-align: center;}

.main{width:100px;height:100px;background-color:pink;line-height:100px; text-align:center;display:none;}

.box:hover .main{display:block;}

</style>

</head>

<body>

<p>塊級元素轉為行內元素</p><span>123</span>

<b>行內元素主為塊級元素</b>

<div>將標答轉換為行內塊元素</div><span>123</span>

<div class="box">導航</div>

<div class="main">小菜單</div>

</body>

</html>

問題解答

回答1:

<div class="box">導航</div>

<div class="main">小菜單</div>

.box:hover .main {}

說明 .main 在 .box 內部

<div class="box">導航

<div class="main">小菜單</div>

</div>

相關文章:
国产综合久久一区二区三区