当我缩小屏幕时,导航栏中的搜索栏会在导航栏上滑动。
如何使其停止在导航链接上滑动?
.topnav {
width: 100%;
opacity: 1;
background-color: rgba(255, 255, 255, 0.6);
margin-bottom: 10px;
padding: 5px 0px 5px 0;
border-bottom: dotted #66A761;
border-top: dotted #66A761;
position: relative;
text-align: center;
}
.topnav ul {
display: inline;
text-align: left;
}
.topnav ul li {
display: inline-block;
margin: 0 30px;
padding: 0;
text-indent: 0;
position: relative;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.topnav a {
font-size: 20px;
font-weight: bold;
text-decoration: none;
}
.topnav a:link {
color: #9F257D;
}
.topnav a:hover {
color: #66A761;
}
.topnav input {
float: right;
padding: 3px;
margin: 0 5px;
position: absolute;
right: 20px;
}
.topnav ul li ul {
display: block;
position: absolute;
background-color: rgba(255, 255, 255, 0.6);
padding: 5px 5px;
}
.topnav ul li:hover ul li {
display: block;
z-index: 1;
}
.topnav ul li ul li {
display: none;
}
<div class="topnav">
<nav>
<ul>
<li><a href="recepten.html">recepten</a>
<ul>
<li><a href="lactosevrij.html">lactosevrij</a></li>
<li><a href="suikervrij.html">suikervrij</a></li>
<li><a href="glutenvrij.html">glutenvrij</a></li>
</ul>
</li>
<li><a href="varianten.html">varianten</a>
<ul>
<li><a href="basis1.html">basis</a></li>
<li><a href="standaard1.html">standaard</a></li>
<li><a href="luxe1.html">luxe</a></li>
</ul>
</li>
<li><a href="contact.html">contact</a></li>
<li><a href="overons.html">over ons</a></li>
<input type="text" style="right:0" placeholder="Search..">
</ul>
</nav>
</div>