Overlapping dynamic fixed header

xuma202

My fixed header is overlapping my content. Much like here (Position fixed content overlapping problem)

but my header is dynamic so not always 50px in height sometimes 52, 100 ...

Daniel Andrei Mincă

Try to position it in your box better.

When you create a fixed element, it requires an exact position:

Example:

#header{ 
    height: 95px;
    width: 640px;
    position: fixed;
    top: 30px;
    right: 30px;
}

So, this is how your browser will read this: I will place a fixed element in the top-right corner of the screen: 30 pixels from the top, and 30 pixels from the right of my screen.

THE REASON those fixed elements are one on top of another it's because he didn't define a top/bottom and left/right position correctly. Add more text and you will see if you can scroll on the fixed elements (you can't..).

Put everything in a div and ID'it #bigBody. Give the #bigBody an exact width and height, let's say 1000 width and 600 height. Now add these:

#header {
    height: 50px;
    width: 600px;
    position: fixed;
    top: 30px;
    right: 30px;
}

#footer {
    background: #fff;
    bottom: 0;
    right: 0;
    height: 30px;
    width: 600px;
    position: fixed;
}

min-width is irrelevant here... you use this only if you design big websites that require multiple devices access like iPhones, Tablets etc... if your just playing with the code just stick with the basics.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

fixed position header overlapping

From Dev

Keeping fixed footer and header from overlapping

From Dev

Prevent images from overlapping a fixed header

From Dev

Fixed a header with a FragmentList and with dynamic contents

From Dev

Fixed header, fixed footer dynamic content

From Dev

Header in fixed position is overlapping with container div when the window is reduced in width

From Dev

Fixed table header WITH dynamic width table?

From Dev

dynamic bootstrap 3 navbar fixed top overlapping content

From Dev

position:fixed navigation header overlapping browser scroll bar when using overflow-x

From Dev

position: fixed overlapping page

From Dev

Position fixed overlapping issue?

From Dev

Fixed notifications overlapping

From Dev

Avoiding overlapping with fixed element

From Dev

Overlapping header inclusions

From Dev

header overlapping when minimized

From Dev

dgrid header and contents overlapping

From Dev

Regex for overlapping fixed width matches

From Dev

position relative overlapping position fixed

From Dev

Fixed image overlapping another div

From Dev

Bootstrap Fixed Navbar Overlapping Content

From Dev

A fixed size row with overlapping elements

From Dev

position fixed element is overlapping into footer

From Dev

fixed header above not fixed navbar

From Dev

Fixed header that snaps underneath main fixed header

From Dev

sticky footer and fixed header

From Dev

Fixed Header not properly working

From Dev

Fixed header and scrollable body

From Dev

Fixed Header Disappears

From Dev

Fixed header in Hub control