Only Bolivian Here
Only Bolivian Here

Reputation: 36753

Using css position to position a dynamically loaded search results box

Here's how it looks like in my machine:

enter image description here

If you visit the site and search for something I'm sure you will see this box misaligned because your monitor/resolution might be different than mine.

My question is, how can I position this so it's always under the search box regardless of the width of the monitor?

Upvotes: 1

Views: 522

Answers (1)

drublic
drublic

Reputation: 993

Add position: relative to #mini-search-wrapper. You can then align the search-results based on the position of the #mini-search-wrapper-element.

position: absolute is bound to the next parent element with a position: relative defined. In this case you did not define a relative position on an element so it's bound to the document-root, which is the html-element.

position: fixed is always bound to the document-root.

The default position in a browser is static.

I hope this helps you understanding how the position-property works in CSS.

Upvotes: 2

Related Questions