所以這裏是我的代碼到目前爲止。想要3個div出現時,懸停在另一個
<!DOCTYPE html>
<head>
<title>An MSU Soiree</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<html>
<body>
<div id="one"> <h2 id="h1"> An MSU Soiree</h2> </div>
<div id="two"> <h2 id="2h"> Campus</h2>
<div id="a"> </div>
<div id="b"> </div>
<div id="c"> </div>
</div>
</body>
</html>
和我的一些CSS ....它重複所以沒關係。
#2h
{
font-family:Courier;
text color:white;
text-align: center;
}
#two
{
width:100%;
height:80px;
background-color:#FF0056;
}
#a
{
width:50px;
height:50px;
background-color: white;
}
#b
{
width:50px;
height:50px;
background-color: white;
}
#c
{
width:50px;
height:50px;
background-color: white;
}
#two:hover
{
height:225px;
background-color:#FF0056;
}
#two: hover div #a, #b, #c
{
display:inline-block;
}
,從而可以看到,而不被徘徊,盒子寬度是100%,80高度盤旋時,它是225的高度,100%的寬度。 但是當徘徊時,我想讓3個div出現在hovered div中,水平分割均勻,並且以高度爲中心。
需要什麼調整來創造這個幻想哈哈?
另外,當我嘗試將一個標頭居中放置這樣一個#2h時,文本仍然停留在左側。我的另一個小難題。
第一件事 - 把你的HTML標籤放在'
'上面。 – cardern