请参阅下面的我的编码。当你将鼠标悬停在“商店”上时,我正在努力让我的SubNav出现。我从其他有效的项目中复制了下面的部分代码,但现在什么也没发生。对于SubNav,我只是寻找下拉菜单并显示其他项目。这将在网站的所有页面上进行。有什么建议?谢谢!
='C:\Users\[Filename.xlsx]Sheet1'!$H$1
/* stlyes for body */
body {
font-family: 'Trocchi', serif;
background-color: white;
margin: 0px;
width: 900px;
margin: 0 auto;
border: 3px solid #FEFA91;
}
h1,
h2,
h3,
p {
margin: 0;
padding: 0;
}
a {
font-weight: bold;
color: white;
}
a:link,
a:visited {
color: black;
}
a:hover,
a:focus {
color: #FEFA91;
}
/* Header */
header {
background-color: #FEFA91;
width: 100%;
}
header img {
display: block;
margin-right: auto;
margin-left: auto;
padding-top: 5px;
}
/* the styles for the navigation menu */
#nav_menu {
display: block;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
#nav_menu ul {
list-style-type: none;
margin: 0;
padding: 0;
position: relative;
}
#nav_menu ul li {
float: left;
width: 25%;
}
#nav_menu ul li a {
display: block;
width: 100%;
text-align: center;
padding: 1em 0;
text-decoration: none;
background-color: #FEFA91;
color: black;
}
#nav_menu a.current {
color: white;
}
#nav_menu ul ul {
display: none;
position: absolute;
top: 100%;
}
#nav_menu ul ul li {
float: none;
}
#nav_menu ul li a:hover,
#nav_menu ul li a:focus {
background-color: black;
color: white;
}
#nav_menu ul li:hover>ul {
display: block;
}
#nav_menu>ul:after {
content: "";
clear: both;
display: block;
}
/* Main */
main {
padding: 20px;
max-width: 950px;
height: auto;
}
/* Section */
section {
width: 660px;
margin: 0;
padding: 11px 0 0 0;
}
section img {
padding: 0 15px 10px 15px;
}
section p {
text-align: left;
margin: 10px;
}
section dl {
font-size: 13px;
text-indent: 30px;
padding: 20px 0 0 0;
}
section h1 {
font-size: 35px;
font-family: 'Euphoria Script', cursive;
}
/* Aside 1 */
#aside1 {
width: 150px;
height: 310px;
float: left;
background-color: #FEFA91;
padding: 10px 0 0 0;
text-align: center;
}
#aside1 img {
text-align: center;
}
/* Aside 2 */
#aside2 {
width: 150px;
height: 310px;
float: right;
background-color: #FEFA91;
padding: 10px 0 0 0;
text-align: center;
}
#aside2 img {
text-align: center;
}
#aside2 h2 {
font-size: 15px;
}
#aside2 p {
font-size: 13px;
}
#aside2 hr {
border: 1px #000000 solid;
}
/* Footer */
footer {
clear: both;
padding: 15px;
background-color: #FEFA91;
position: relative;
}
footer p {
font-size: 90%;
text-align: right;
}
答案 0 :(得分:0)
#nav_menu {
display: block;
overflow: hidden; //remove
width: 100%;
margin: 0;
padding: 0;
}
#nav_menu ul ul {
display: none;
position: absolute;
top: 100%;
width: 100%; // added
}
答案 1 :(得分:0)
我在该部分添加了flexbox
属性,Flexbox在同一行对齐left
main
和right
列。关于flexbox btw。
section {
display:flex; // Add flex
width: 660px;
margin: 0;
padding: 11px 0 0 0;
}