views:

57

answers:

2

Greetings,

I have a php site that was working fine as of the start of the year. Then a patch came out for IE8 which caused the CSS I had to malfunction.

Is this a know problem or an isolated issue?

My main problem stems from trying to lock a header into place while allowing the body to be scrollable with:

position: fixed;
overflow: scroll;
top: 135px;
left: 0px;

One of my colleagues has also encountered the same issue as I have.

Any assistance would be greatly appreciated.

Thank you,

Jordan Trulen

.belt
{
    position:fixed;
    top: 0px;
    left:0px;
}
.header-table
{
    position:fixed;
    top:65px;
    width:100%;
}
.header
{
    position:fixed;
    height:40px;
    width:98%;
    top:95px;
}
.body
{
    position:fixed;
    overflow:scroll;
    height:74%;
    width:99%;
    top:135px;
}
+1  A: 

Why are you using position fixed on the "content" area (i assume thats the "content" area as scroll on a header doesnt make much sense)? Apply position: fixed; to the header instead.

prodigitalson
Whenever I use fixed on the header, IE messes up as well. I will try your suggestion again and report back soon.
Jordan Trulen
Well IE < 7 doesnt like `position: fixed;` much however given that you were using it before i dont think thats much of an issue :-) What do you mean it messes up can you give us more detail or through upa demo page.
prodigitalson
I have 3 tables in my header that are positioned with absolute. They show perfectly, however when the page finishes loading, the content block, the one that is positioned with fixed, falls into the top right most location on top of everything else.The part that confuses me is that this was working wonderfully a mere two weeks ago.
Jordan Trulen
Well i dunno as Tor says doing it this way doesnt make much sense regardless of it was previously working or not. I would make the header `fixed` and then make the content in normal flow with a padding or margin top to match the height of the fixed header (repeat for footer if it is positioned in the same manner).
prodigitalson
+2  A: 

You're not giving us any html or a link to see what's up.

But there's a key difference in using position:fixed and position:absolute.

  • Fixed is used when you don't want the container to scroll with the page, but remain at that position no matter how much you scroll the remaining page. This is good for headers that should always be visible.
  • Absolute should be used when you just want it to be fixed in relation to the surrounding content.

And you're using overflow:scroll; in a fixed container, which only in extremely rare cases makes sense. I think you problem is with the overflow:scroll; being on the wrong tag. It only has to do with the content of that tag being limited to the width and height (which you haven't even specified!) of the container. If the content overflows that width and height, scrollbars are inserted ON the container.

Tor Valamo
I have the height specified height: 74%; and width: 100%;
Jordan Trulen
Based on your comments from the other answer, your problem is that you're using fixed for something that shouldn't be fixed.
Tor Valamo
It does appear that way. One more question then in order to solve the problem. I am trying to make the different parts of the header fall in the correct order, however top is not changing the position of my fixed elements even though it should be. What am I doing wrong? position:fixed; top:65px; width:100%;
Jordan Trulen
you're still not giving us any complete code to see the interactions between elements, so until then you're on your own.
Tor Valamo
.belt{ position:fixed; top: 0px; left:0px;}.header-table{ position:fixed; top:65px; width:100%;}.header{ position:fixed; height:40px; width:98%; top:95px;}.body{ position:absolute; overflow:scroll; height:74%; width:99%; top:135px;}This is in order of how they should be displayed out one the page.
Jordan Trulen
@Jordan:Can you please update your actual question and format things in code blocks :-)
prodigitalson
If you just want the complete content frozen (like a frameset) just use absolute on all. Fixed still doesn't make sense here. Fixed should be used on single elements that should float on top of all other content. That's obviously not the case here.
Tor Valamo
I only want the header frozen, that way I can see the header as I scroll through the different lines in the body. I have thousands of lines in the body that will be looked at, however without a header farther down, it will be difficult to see what each column is.
Jordan Trulen
Then why is .body fixed?
Tor Valamo
Typo. I managed to get it fixed when I included clear: both;Thanks for the help.
Jordan Trulen