Can you please check the below code? Hope it will work for you. We removed unnecessary bootstrap classes from the input
, button
, and li
tag. Then we gave position: absolute;
and width: 100%;
in .autocom-box
instead of position fixed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
main {
padding: 15px;
background: #000;
}
.navbar-search {
position: relative;
padding: 0px 15px;
}
.navbar-input {
width: calc(100% - 80px);
}
.navbar-button {
width: 75px;
}
.autocom-box ul {
background: #fff;
}
.autocom-box li {
background-color: white;
color: black;
padding: 10px 20px;
}
.autocom-box {
position: absolute;
z-index: 9999;
border-top: 1px solid black;
box-shadow: 4px 4px 8px -1px black;
width: 100%;
}
</style>
</head>
<body>
<main>
<div id="buscqueda" class="navbar-search smallsearch">
<div class="col-sm-8 col-xs-11">
<div class="row">
<input class="navbar-input" type="" placeholder="Buscar productos" name="">
<button class="navbar-button"> <svg width="15px" height="15px">
<path
d="M11.618 9.897l4.224 4.212c.092.09.1.23.02.312l-1.464 1.46c-.08.08-.222.072-.314-.02L9.868 11.66M6.486 10.9c-2.42 0-4.38-1.955-4.38-4.367 0-2.413 1.96-4.37 4.38-4.37s4.38 1.957 4.38 4.37c0 2.412-1.96 4.368-4.38 4.368m0-10.834C2.904.066 0 2.96 0 6.533 0 10.105 2.904 13 6.486 13s6.487-2.895 6.487-6.467c0-3.572-2.905-6.467-6.487-6.467 ">
</path>
</svg> </button>
</div>
<div class="autocom-box row">
<ul>
<li>producto 1</li>
<li>producto 2</li>
<li>producto 3</li>
<li>producto 4</li>
</ul>
</div>
</div>
<div class="clearfix"></div>
</div>
</main>
</body>
</html>