gpt4 book ai didi

html - optgroup 与我的网站联系人一起使用时出现问题,optgroup 是否有效?我应该用什么?

转载 作者:太空宇宙 更新时间:2023-11-04 06:58:11 25 4
gpt4 key购买 nike

我有一个由“主页”、“关于”、“联系方式”、“个人资料”组成的菜单。将鼠标悬停在“个人资料”上时,我希望可以显示一个子菜单,其中包含指向我的 Github/Facebook 帐户等的链接。我该怎么做?

如果有人已经回答了这个问题,我很抱歉,但我尝试寻找一些信息,但找不到任何有用的信息。

body {
margin: 0;
font-family: Andale Mono, monospace;
}

.top {
overflow: hidden;
background-color: #dfe3ee;
}

.top a {
float: left;
display: block;
color: black;
text-align: center;
padding: 15px 15px;
text-decoration: none;
font-size: 20px;
}

.top a:hover {
background-color: lightgrey;
color: darkred;
}

.active {
background-color: #44E6F2;
color: Ivory;
}

.top input[type=text] {
float: right;
padding: 4px;
margin-top: 10px;
margin-right: 16px;
border: none;
font-size: 18px;
width: 250px;
border-style: solid;
}

#sub1 {
color: black;
font-size: 12px;
font-family: "Arial Black", Gadget, sans-serif;
}

#sub2 {
color: black;
font-size: 12px;
font-family: "Arial Black", Gadget, sans-serif;
}
<!DOCTYPE html>
<html>

<head>
<title>Page Title</title>
</head>

<body>
<header>
<div class="Top">
<a class="active" href="#home">Home</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
<a href="#profile">Profile</a>
<input type="text" placeholder="Search..">
</div>
<div style="padding-left:16px">
</div>
</header>
<nav>
</nav>
<main>
</main>
<aside>
</aside>
<footer>
<center><sub id="sub2">Contact Me:</sub></center>
<center><sub id="sub1">foo@example.com</sub></center>
</footer>
</body>

</html>

最佳答案

如果我理解正确的话,当您将鼠标悬停在菜单中的“个人资料”上时,您希望出现一个带有社交媒体平台链接的子菜单。有几种方法可以做到这一点,其中大部分涉及一点 Javascript,但您可以使用纯 CSS 来完成,这是一个示例:

/* Hide Dropdowns by Default */

nav ul ul {
display: none;
position: absolute;
top: 60px;
/* the height of the main nav */
}


/* Display Dropdowns on Hover */

nav ul li:hover>ul {
display: inherit;
}


/* Fisrt Tier Dropdown */

nav ul ul li {
width: 170px;
float: none;
display: list-item;
position: relative;
}
<nav>
<ul>
<li>
<a href="#">WordPress</a>
<!-- First Tier Drop Down -->
<ul>
<li><a href="#">Themes</a></li>
<li><a href="#">Plugins</a></li>
<li><a href="#">Tutorials</a></li>
</ul>
</li>
</ul>
</nav>

另见 https://codepen.io/andornagy/pen/xhiJH .

关于html - optgroup 与我的网站联系人一起使用时出现问题,optgroup 是否有效?我应该用什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52287087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com