我很難將下拉菜單添加到我的導航欄中,而無需過多地更改CSS。我正在試圖做幾個小時,現在我失敗了。將下拉菜單添加到導航欄中
當我更改HTMl或在CSS中添加塊時,導航欄已損壞,請指導我如何在將鼠標懸停在nabar上時添加滑動條的最佳或最簡單的方法是什麼?
html, body {
margin: 0;
padding: 0;
}
.container {
max-width: 940px;
margin: 0 auto;
padding: 5px;
}
.jumbotron {
background: url(http://www.mathiasgerlach.com/data/files/2013/09/Vaillant_02.jpg) center;
background-size: cover;
height: 300px;
}
.header {
background-color: #333;
}
.nav {
list-style-type: none;
margin: 0;
padding: 20px 0;
letter-spacing: 1.6px;
}
.nav li {
transition: 0.4s;
color: #fff;
display: inline;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 12px;
margin-right: 25px;
text-transform: uppercase;
}
.nav li:hover {
background-color: #ffffff;
color: #333;
font-weight: 900;
padding: 24px 10px;
font-size: 12px;
cursor: pointer;
}
.activeBold {
font-weight: bold;
}
.main {
position: relative;
top: 180px;
text-align: center;
}
.main h1 {
color: #333;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 70px;
margin-top: 0;
margin-bottom: 80px;
text-transform: uppercase;
}
.btn-main {
background-color: #333;
color: #fff;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 18px;
letter-spacing: 1.3px;
padding: 16px 40px;
text-decoration: none;
text-transform: uppercase;
}
.btn-second {
border: 1px solid #333;
color: #000;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 10px;
letter-spacing: 1.3px;
padding: 10px 20px;
text-decoration: none;
text-transform: uppercase;
display: inline-block;
margin-bottom: 20px;
}
.supporting {
padding-top: 80px;
padding-bottom: 100px;
}
.supporting .col {
float: left;
width: 33%;
font-family: 'Raleway', sans-serif;
text-align: center;
}
.supporting img {
height: 32px;
}
.supporting h2 {
font-weight: 600;
font-size: 23px;
text-transform: uppercase;
}
.supporting p {
font-weight: 400;
font-size: 14px;
line-height: 20px;
padding: 0 50px;
margin-bottom: 40px;
}
.clearfix {
clear: both;
}
.footer {
background-color: #333;
color: #fff;
padding: 30px 0;
}
.footer p {
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
font-size: 11px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Raleway:400, 600" rel="stylesheet">
<link href="stylesheet.css" type="text/css" rel="stylesheet">
<script type='text/javascript' src='script.js'></script>
<script src="jquery-3.1.1.min.js"></script>
<title>Smart-Home</title>
</head>
<body>
<div class="header">
<div class="container">
<ul class="nav">
<li>O firmie</li>
<li>Produkty</li>
<li>Nasi partnerzy</li>
<li>Kontakt</li>
</ul>
</div>
</div>
<div class="jumbotron">
<div class="container">
<div class="main">
<h1>Smart Home</h1>
<a class="btn-main" href="#">ZŁÓŻ ZAMÓWIENIE</a>
</div>
</div>
</div>
<div class="supporting">
<div class="container">
<div class="col">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQY1_mc6oM6PXGx6CW5qKsq_fmJqUjlqf_l37QSqQOTK5CLSv78">
<h2>Realizacje</h2>
<p> Specjalizujemy się w Opis opis Opis opis Opis opis Opis opis Opis opis .</p>
<a class="btn-second" href="#">dowiedz się więcej</a>
</div>
<div class="col">
<img src="https://www.iconexperience.com/_img/i_collection_png/512x512/plain/notebook.png">
<h2>Oferta</h2>
<p>Opis opis Opis opis Opis opis Opis opis Opis opis </p>
<a class="btn-second" href="#">dowiedz się więcej</a>
</div>
<div class="col">
<img src="https://www.iconexperience.com/_img/i_collection_png/256x256/plain/tools.png">
<h2>Serwis</h2>
<p>Opis opis Opis opis Opis opis Opis opis Opis opis </p>
<a class="btn-second" href="#">dowiedz się więcej</a>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="footer">
<div class="container">
<p>© Smart home 2017</p>
</div>
</div>
</body>
</html>
你的代碼的一部分是故意要下拉 –
我想有下拉的: