Question about the layout of my website

Hi, how can i make the search results not push down the main hero? and also is centering the main hero with an height using VH ok? codepen: https://codepen.io/Gabriele888/pen/MYKZjYY
9 Replies
ἔρως
ἔρως3w ago
you can stop it by adding position: absolute to the parent with the results you might have to manually set the width to 100% and to the parent of the results and the search input, add position: relative
Gabriele
GabrieleOP3w ago
is this the only way? because someone told me its bad practice to use absolute and relative but maybe he meant just in another context so im just asking you
ἔρως
ἔρως3w ago
using floats for layouts is a very bad practice, but using floats to make the text surround an image isnt each tool has it's correct use and this is, in my opinion, the currect use for `position: absolute
Gabriele
GabrieleOP3w ago
ok and what about how the hero is centered, is setting an height with VH ok?
ἔρως
ἔρως3w ago
i wouldnt if i rotate my phone, the height may go below 0
Gabriele
GabrieleOP3w ago
so margin top and setting it manually is better?
ἔρως
ἔρως3w ago
have you considered other options, like setting a min-height and margin auto?
Gabriele
GabrieleOP3w ago
not at all, which one would you use? i thought min height is mostly for containers and margin no idea container i mean you have something inside
ἔρως
ἔρως3w ago
try it, it should work

Did you find this page helpful?