0
我理解使用我当前的HTML制作下拉菜单的基础知识,但不明白我如何对当前的CSS做同样的处理。我也很新的HTML和CSS非常感谢谢谢谢谢! 这里是我的HTML编码:如何使用我当前的CSS添加下拉菜单?
/*The overflow:hidden hides the scroller that appears on page*/
body {
overflow: hidden;
}
html {
\t background: url('http://pre15.deviantart.net/5686/th/pre/i/2016/338/6/2/living_tree_by_tacosauceninja-daqj4zz.jpg') no-repeat center center fixed;
\t background-size: cover;
}
h1 {
\t position: absolute;
\t left: 50%;
\t top: 50%;
\t transform: translateX(-50%) translateY(-50%);
}
/* The code below is what makes the bar invisible*/
#navdiv{
\t opacity: 0.7;
\t filter: (opacity=70);
}
#navdiv ul {
\t width:100%;
\t height: 80px;
\t background:#648DA0;
\t line-height:80px;
\t color: white;
\t text-align: center;
}
#navdiv ul a{
\t text-decoration: none;
\t color: white;
}
/*The padding left and right allows you to choose the spacing between each page on your navigation bar*/
#navdiv ul li {
\t list-style-type: none;
\t padding-left: 50px;
\t padding-right: 50px;
\t display: inline-block;
\t float: center;
}
#navdiv ul li:hover{
\t background: #8FB0BF;
\t text-align: center;
\t transition:all 0.40s;
\t
}
#navdiv h1{
\t width: 300px;
\t float:center;
\t cursor: pointer;
\t margin-left: 15px;
}
<!DOCTYPE>
<html>
<head>
\t \t \t \t <title>Homepage</title>
\t <link type="text/css" rel="stylesheet" href="stylesheet.css">
</head>
\t <body>
\t
\t \t <div id="Maindiv">
\t \t \t <div id="navdiv">
\t \t \t \t \t <h1> Hello World... </h1>
\t \t \t \t <ul>
\t \t \t \t \t <li><a href="relax.html" class="btn-default"> Relax </a></li>
\t \t \t \t \t <li><a href="motivation.html" class="btn-default"> Motivation </a></li>
\t \t \t \t \t <li><a href="homepage.html" class="btn-default">HomePage</a></li>
\t \t \t \t \t <li><a href="#">Info</a></li>
\t \t \t \t \t <li><a href="healing.html" class="btn-default"> Healing </a></li>
\t \t \t \t </ul>
\t \t \t \t
\t \t \t </div>
\t \t </div>
\t
\t </body>
</html>
谢谢!你的回复有很多帮助。 – kevin