0

My sticky header covers the vertical scrollbar, is there a way to fix this?

URL: http://jlwebdesigns.co.uk/

Header code (using a HTML5 tag)

header {
    background: none repeat scroll 0 0 #283744;
    border-bottom: 4px solid #4F5B66;
    height: 97px;
    margin-top: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 999;
}
Lysergix
  • 23
  • 1
  • 5

4 Answers4

0

solution is not very neat but give margin-top: 97px; to the below div....based on ruddy's fiddle :

here is a demo

NoobEditor
  • 15,563
  • 19
  • 81
  • 112
  • You didn't got his question bro :) – Mr. Alien Jan 20 '14 at 10:49
  • Im just going to comment because you both did. **Rawr!** Also not sure what your doing in your answer. – Ruddy Jan 20 '14 at 10:51
  • See the `width`, it is overlapping the scrollbar – Mr. Alien Jan 20 '14 at 10:51
  • No, no! Its the fixed header sitting on top if the `div` (content) below it. The OP most probs has the `div` below the header set to `height: 100%;` with `overflow: scroll;`. – Ruddy Jan 20 '14 at 10:52
  • @NoobEditor yap, but am feeling lazy to make one, if he provides a fiddle I will answer – Mr. Alien Jan 20 '14 at 10:54
  • @NoobEditor Im going to guess this is the problem. Fix this and I think it will be right. [**DEMO**](http://jsfiddle.net/md9c8/) Note how the text isn't there, because its under the header. – Ruddy Jan 20 '14 at 10:55
  • @Mr.Alien : okay lazy man...now i got that...damn..thought that its overlap at the edges!!! :) – NoobEditor Jan 20 '14 at 10:56
  • @Ruddy : yeah..got it mate....u dont need to make me feel like a *even lesser than noob* !! :) – NoobEditor Jan 20 '14 at 10:58
  • @Mr.Alien : `margin-top` is a solution...coz OP has fix height `header`...ur thoughts???? – NoobEditor Jan 20 '14 at 11:05
0

Yeah make that element have a higher z-index and make sure you set a positioning such as relative or what not to that element.

header {
    background: none repeat scroll 0 0 #283744;
    border-bottom: 4px solid #4F5B66;
    height: 97px;
    margin-top: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 999;
}

Underlying element

#underlyingelementwithscrolls{
position:relative;
z-index:1000;/*higher than 999 since header has it*/
}

in your case you have overlayed the bodies scroller do this and it should get fixed

body{
overflow:hidden;}
html{
overflow-y:scroll;}
Breezer
  • 10,410
  • 6
  • 29
  • 50
0

After reviewing your page you can change a couple of things...

Your banner is at 100% but it also has a padding which makes your banner to exeed the 100%. You try to avoid this by putting the overflow hidden in the html, body but that makes your header to overlap the scroll bar.

Solution:

html, body {
width:100%; 
overflow:hidden;  //remove this
}

#homeBanner {
width: 100%;
background: url(../img/bannerHolder.jpg) center no-repeat #558582;
text-align: center;
margin-top: 100px;
padding: 13% 2%;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box;    /* Firefox, other Gecko */
box-sizing: border-box;         /* Opera/IE 8+ */
}
Mario Sanchez Maselli
  • 1,021
  • 1
  • 12
  • 25
-1

I looked at the site and a simple fix is to put:

margin-top: 97px; // if header has some padding so count that too.

Put that margin on the section in the CSS. This will fix the scrollbar but will break the logo. You will have to replace some stuff because of the new margin.

Here is a demo using the margin-top. You can see the text under the header. Take the margin away and it will hide behind the header.

DEMO

Note: Just seen there's more then 1 section. You could just wrap them all in a div and give that the margin. Or use :first-of-type.

Ruddy
  • 9,795
  • 5
  • 45
  • 66