1
But as you can see, the div#results is misaligned with the input#search. Code:
<div class="container-fluid primary-bgcolor p-3">
<div class="row align-items-center">
<div class="col-2">
<a class="text-white mb-0">
<span class="ml-2 d-none d-sm-inline d-xl-none">Nome do Site</span>
</a>
</div>
<div class="col-4" style="width: 100%;">
<input class="form-control primary-fontcolor" type="text" name="pesquisa" id="pesquisa" placeholder="Pesquisar">
<div id="resultados" class="primary-bgcolor" style="position: absolute; z-index: 2; width: 100%; margin-top: 20px;"></div>
</div>
</div>
</div>
How can I solve this CSS problem?
tried to use
margin-top
?– Ricardo Pontual
misaligned in what sense? Greater?
– Anderson Henrique
What do you mean by misaligned? What do you want to change?
– hugocsl
By misaligned I mean the width of the div#results relative to the input, I wanted both to have the same width, but even setting a width for the parent element and for the children they do not respect this new configuration.
– Higor Cardoso
The result I expected was something similar to the one used in datalist, but the use of this tag does not apply to my case, since the user click on the result it will be redirected by a link
– Higor Cardoso
Face since the problem is with CSS edit your question and include CSS as well
– hugocsl
The CSS I’m using is exactly what’s in the style attribute inside the tags, I did it just to improve the visualization of the code
– Higor Cardoso
Guys, the result I want to achieve is exactly the one used on Youtube, when writing something is given the results under the search input and, precisely, the same size of it and when clicking on one of them the user is redirected to another page.
– Higor Cardoso