IE6 Fixed Positioning - css

I need to fix a footer to the bottom of the viewport. IE 6 is the problem--and yes, it must work in IE 6. That much, is not my call.
Using this:
div#footer {
width:1020px;
position: absolute;
top: expression(0+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+'px');
left: expression(50%+((e=document.documentElement.scrollLeft)?e:document.body.scrollLeft)+'px');}
}
In my IE6.css I can fix the footer to the top of the page. But if I switch it to this:
div#footer {
width:1020px;
position: absolute;
bottom: expression(0+((e=document.documentElement.scrollBottom)?e:document.body.scrollBottom)+'px');
left: expression(50%+((e=document.documentElement.scrollLeft)?e:document.body.scrollLeft)+'px');}
}
It goes haywire. Am I implementing the expression function wrong for fixing it to the bottom of the viewport?
Thanks!

Don't use the expression clause. From my experience it can render the page a little on the slow side and behaves oddly. Some times it'll work and others it'll simply fail not gracefully.
I've had good success with these methods.
http://matthewjamestaylor.com/blog/bottom-footer-demo.htm
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
But without seeing your entire page it's a little harder to see if any of the links I provided will get in the way of your current stylesheet.

Try using this instead of expressions:
* {
margin: 0;
}
html, body {
height: 100%;
overflow: auto;
}
.wrapper {
position: relative;
width: 100%;
height: 100%;
overflow: auto;
}
.box {
position: fixed;
left: 50%;
top: 180px;
margin: 0 0 0 -370px;
}
* html .box {
position: absolute;
}
/*
Fixed Positioning in IE6
http://ryanfait.com/
*/

Related

Prevent CSS footer from scrolling

#bottom_fade {
position: absolute;
bottom: 0;
width: 100%;
background: url("bottom-fade.png");
background-repeat:repeat-x;
height: 400px;
z-index: 2;
}
.categories {
position: absolute;
left: 50%;
color:black;
word-wrap: break-word;
font-family: 15px 'Libre Baskerville', serif;
margin-left: -200px;
z-index: 1;
}
.categories td {
width: 200px;
}
you may see the result of the above code here.
Try to resize your browser window so that you're forced to scroll to see the whole text in the table.
As you scroll, you may see that #bottom_fade will not remain sticked to the bottom of the page but will follow your scrolling. I don't want that to happen: how can I say to bottom_fade to ALWAYS stays attached to the bottom of the browser window, no matter what happens to the scrollbar?
Many thanks!
Change
#bottom_fade {
position: absolute;
}
to
#bottom_fade {
position: fixed;
};
and it should work like a charm.
(nice effect by the way!)

CSS not properly displayed on page

So I've set up some div's on my page and while they look fine to me other people log on and the div will be improperly placed. I've looked and looked but can't find out why it's not loading the same for me, so if anyone can help in this it'd be appreciated. The div not showing correctly is
div.head-content
{
display: block;
position: absolute;
top: -64px;
left: 92.7%;
margin-left: -360px;
width: 131px;
height: 46px;
}
The reason for this is either browser comparability or some alignment mistake.
if you are using wrapper make
#wrapper
{
position:relative;
}
and it will do the job.
Unless you show us the entire code this is the most I can help.
#vivek is correct try this
#wrapper
{
position:relative;
width:100%;
height:100%;
}
.head-content
{
display: block;
position: absolute;
top: -64px;
left: 92.7%;
margin-left: -360px;
width: 131px;
height: 46px;
}

CSS property width: 100%; make a page longer

I have a totally simple layout, in the page is only a silver background and the red DIV, as is possible to see on the image below. My problem is, that when I add the red DIV into my layout page, the page is longer on the length than 100% (bottom on the right corner - slider). Where could be a problem that caused this?
The CSS properties of the red DIV are:
html, body {
background-color: silver;
margin: 0;
padding: 0;
}
.red-div {
overflow: hidden;
width: 100%;
position: absolute;
top: 0;
left: 0;
}
.red-div {
overflow: hidden;
position: absolute;
top: 0;
left: 0;
right:0; /* This is what you need */
}
That way, you can force it to go to the end of the browser. When you do 100%, you do not account for the scrollbars. Which add the extra space and thus the annoying side-scroll

div set to 100% wont work

here is my site
http://iadprint.com/about
i am trying to make the menu tag and the colright div to have a height of 100% and stick to the footer div pushing down to the bottom. but no matter what i try nothing works. i have tried validating the html but only 3 errors exist which arent that important to fix. what ami doing wrong?
You need to use faux background technique, CSS (possibly with table-cell) or JavaScript.
I'm a fan of fixed layouts for this sort of scenario where you want a footer to always appear at the bottom of the window:
header
{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 130px;
}
nav
{
width: 960px;
margin: 0 auto;
}
article
{
top: 130px;
bottom: 120px;
left: 0;
width: 100%;
position: fixed;
overflow: auto;
}
footer
{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 120px;
}

Help, IE7 mugged my divs and now they're running off the screen!

My site, http://hivechatter.com/, is super sexy for Firefox, Chrome, IE8, you name it:
But then along comes IE7, who mauls her divs so bad that they nearly run off the screen! And for whatever reason the content within the divs is centered. What the heck is going on here? It seems to be something to do with the way IE7 interprets the left: percentage margins, but I can't figure it out.
For convenience and posterity's sake, below are the relevant portions of my css, with text formatting and other nonsense removed. #container is the overall page container, #blue_box is the main content box, #left and #right are the columns in the blue box, #divider is the white line that separates them, #links is the light blue nav hovering below #blue_box.
#background {
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -9999;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
}
body {
background: no-repeat #222933;
overflow: hidden;
}
#container {
position: relative;
left: 34%;
top: 10%;
width: 50%;
min-width: 450px;
max-width: 700px;
overflow: auto;
padding: 0;
}
#blue_box {
position: relative; /* so that divider has appropriate height */
width: 94%;
padding: 3%;
overflow: auto; /*needed so that div stretches with child divs*/
}
#left {
position: relative;
float: left;
width: 44%;
margin: 0;
padding: 0;
}
#right {
position: relative;
float: right;
width: 49%;
margin: 0;
padding: 0;
}
#divider{
position:absolute;
left:49%;
top:6%;
bottom:6%;
border-left:1px solid white;
}
#links {
float: right;
width: 16em;
overflow: auto;
}
Change your position from relative to absolute for the container CSS.
Your problem is your image is just there with the container coming after it with a relative positioning.
IE7 is centering your container because you've set your body to text-align:center, then you're setting your container left:34%. IE is just adding those together for some reason. This is probably why your stuff is being centered in IE. You could do a conditional stylesheet for IE7 and remove the text-align.
Can't test at the moment if this will solve the issue but using margins on the blue box to position it instead of position: relative usually makes things a lot easier in the dark world of ancient Internet Explorers.

Resources