所以这是我到目前为止的代码。
<!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 出现在悬停的 div 中,水平均匀分割,并以高度为中心。
创造这个幻想需要什么调整哈哈?
另外,当我尝试将 #2h 这样的标题居中时,文本仍然停留在左侧。我的另一个小困境。