I am trying to teach myself to use the Skrollr plugin properly, I am mainly interested in the classic example listed in the documentation. (http://prinzhorn.github.io/skrollr/examples/classic.html).
My problem is that my footer doesn't appear at the bottom of the page, instead it appears below the first image in my Skrollr gallery. I want to keep the footer separate from #skrollr-body as this gallery would only appears on a specific page.
This is my code, it's essentially a slightly simplified version of the example.
html:
<div
class="parallax-image-wrapper parallax-image-wrapper-100"
data-anchor-target="#dragons + .gap"
data-bottom-top="transform:translate3d(0px, 200%, 0px)"
data-top-bottom="transform:translate3d(0px, 0%, 0px)">
<div
class="parallax-image parallax-image-100"
style="background-image:url(/assets/img/rocks.jpg)"
data-anchor-target="#dragons + .gap"
data-bottom-top="transform: translate3d(0px, -50%, 0px);"
data-top-bottom="transform: translate3d(0px, 50%, 0px);">
</div>
</div>
<div
class="parallax-image-wrapper parallax-image-wrapper-100"
data-anchor-target="#bacons + .gap"
data-bottom-top="transform:translate3d(0px, 200%, 0px)"
data-top-bottom="transform:translate3d(0px, 0%, 0px)">
<div
class="parallax-image parallax-image-100"
style="background-image:url(/assets/img/tiles.jpg)"
data-anchor-target="#bacons + .gap"
data-bottom-top="transform: translate3d(0px, -50%, 0px);"
data-top-bottom="transform: translate3d(0px, 50%, 0px);">
</div>
</div>
<div
class="parallax-image-wrapper parallax-image-wrapper-100"
data-anchor-target="#kittens + .gap"
data-bottom-top="transform:translate3d(0px, 200%, 0px)"
data-top-bottom="transform:translate3d(0px, 0%, 0px)">
<div
class="parallax-image parallax-image-100"
style="background-image:url(/assets/img/sky.jpg)"
data-anchor-target="#kittens + .gap"
data-bottom-top="transform: translate3d(0px, -50%, 0px);"
data-top-bottom="transform: translate3d(0px, 50%, 0px);">
</div>
</div>
<div id="skrollr-body">
<div id="dragons"></div>
<div class="gap gap-100"></div>
<div id="bacons"></div>
<div class="gap gap-100"></div>
<div id="kittens"></div>
<div class="gap gap-100"></div>
</div>
<div id="footer">
some footer stuff
</div>
and css:
* {
padding:0;
margin:0;
}
html, body {
height:100%;
}
#content {
height:100%;
position: relative;
}
.skrollr-desktop body {
height:100% !important;
}
.parallax-image-wrapper {
position:fixed;
left:0;
width:100%;
overflow:hidden;
}
.parallax-image-wrapper-50 {
height:50%;
top:-50%;
}
.parallax-image-wrapper-100 {
height:100%;
top:-100%;
}
.parallax-image {
display:none;
position:absolute;
bottom:0;
left:0;
width:100%;
background-repeat:no-repeat;
background-position:center;
background-size:cover;
}
.parallax-image-50 {
height:200%;
top:-50%;
}
.parallax-image-100 {
height:100%;
top:0;
}
.parallax-image.skrollable-between {
display:block;
}
.no-skrollr .parallax-image-wrapper {
display:none !important;
}
#skrollr-body {
height:100%;
overflow:visible;
position:relative;
}
.gap {
background:transparent center no-repeat;
background-size:cover;
}
.skrollr .gap {
background:transparent !important;
}
.gap-50 {
height:50%;
}
.gap-100 {
height:100%;
}
#footer {
clear: both;
height: 100px;
background-color: red;
}
Put the footer element inside #skrollr-body. To make everything work on desktop/mobile, the only body content that will reside outside of #skrollr-body are your fixed position controls and attributes for the parallax-image-wrapper & parallax-image sets.
If you require additional "fixed" positioned elements in your layout, you'll need to list those outside #skrollr-body setting a data-anchor-target attribute for the div, and then call that target #id you created down in the #skrollr-body wherever you need it to display.
Like how they do with #dragons, #bacons, & #kittens targets in the classic example docs.
Related
I have a responsive site with a slideshow. I have set the slideshow to be 100% the width of the browser window, and that is working fine. The problem is, the slideshow is shifted a bit to the right, almost as if there is padding to the left of the image. The result is the user having to scroll to the right to see the entire slideshow. I have tried playing around with the attributes of the div and the slideshow itself, but with no luck. Any help with this issue is appreciated. Here is my CSS and HTML code:
CSS
html
{
background-color:#000000;
}
body
{
margin:0auto;
padding:0;
width:100%;
}
#header
{
margin:0auto;
padding-top:0.5%;
text-align:center;
}
#logo
{
margin:0auto;
max-width:186px;
max-height:123px;
padding-top:1%;
padding-bottom:15%;
text-align:center;
}
#banner
{
width:100%;
}
#home_content
{
width:100%;
padding-top:0.25%;
}
#history_content
{
width:100%;
padding-top:0%;
}
#home_slideshow
{
padding-top:1%;
display:flex;
justify-content:center;
}
#home_slideshow
{
padding-top:1%;
display:flex;
justify-content:center;
}
hr
{
border-color:#1BB7F2;
width:100%;
padding:0%;
}
#home_footer
{
width:100%;
margin-top:60%;
}
#history_footer
{
width:100%;
margin-top:155%;
}
.crossfadeHome>figure
{
animation:imageAnimation24slinearinfinite0s;
backface-visibility:hidden;
color:transparent;
opacity:0;
position:absolute;
text-alin:center;
width:100%;
z-index:0;
margin:0auto;
}
.crossfadeHome>figure:nth-child(1)
{
background-image:url('../photos/img_1.jpg');
background-repeat:no-repeat;
}
.crossfadeHome>figure:nth-child(2)
{
animation-delay:6s;
background-image:url('../photos/img_2.jpg');
background-repeat:no-repeat;
}
.crossfadeHome>figure:nth-child(3)
{
animation-delay:12s;
background-image:url('../photos/img_3.jpg');
background-repeat:no-repeat;
}
.crossfadeHome>figure:nth-child(4)
{
animation-delay:18s;
background-image:url('../photos/img_4.jpg');
background-repeat:no-repeat;
}
#keyframesimageAnimation
{
0%
{
animation-timing-function:ease-in;
opacity:0;
}
8%
{
animation-timing-function:ease-out;
opacity:1;
}
17%
{
opacity:1
}
25%
{
opacity:0
}
100%
{
opacity:0
}
}
.crossfadeHistory>figure
{
backface-visibility:hidden;
color:transparent;
opacity:0;
position:absolute;
text-alin:center;
width:100%;
z-index:0;
margin:0auto;
}
.crossfadeHistory>figure:nth-child(1)
{
background-image:url('../photos/history_1.jpg');
background-repeat:no-repeat;
}
.crossfadeHistory>figure:nth-child(2)
{
animation-delay:7s;
background-image:url('../photos/history_2.jpg');
background-repeat:no-repeat;
}
.crossfadeHistory>figure:nth-child(3)
{
animation-delay:14s;
background-image:url('../photos/history_3.jpg');
background-repeat:no-repeat;
}
.crossfadeHistory>figure:nth-child(4)
{
animation-delay:21s;
background-image:url('../photos/history_4.jpg');
background-repeat:no-repeat;
}
#keyframesimageAnimation
{
0%
{
animation-timing-function:ease-in;
opacity:0;
}
8%
{
animation-timing-function:ease-out;
opacity:1;
}
17%
{
opacity:1
}
25%
{
opacity:0
}
100%
{
opacity:0
}
}
HTML
<!DOCTYPEhtml>
<html>
<head></head>
<body id="body">
<!--HeaderSection-->
<div id="logo">
<img class="logo"src="graphics/logo.jpg"style="display:block;margin:0auto;width:100%;height:auto;max-width:225px;max-height:196px;vertical-align:top;"alt=""title="">
</div>
<div id="header">
<p id="contact_info">
<imgsrc="graphics/icon_phone.png"style="width:11px;height:15px;vertical-align:middle;"alt="PhoneIcon"title="Call Us!!">(518)459-9843
</p>
<pid="contact_info">
 
</p>
<p id="contact_info">
<img src="graphics/icon_clock.png"style="width:17px;height:17px;vertical-align:middle;"alt="ClockIcon"title="Our Hours">
</p>
</div>
<div id="banner">
<hr/>
<p id="page_home_header">
</p>
</div>
<div id="page_home_main">
<p id="home_content">
</p>
<p id="page_home_link">
link
<br/>
<br/>
site
</p>
</div>
<div id="home_slideshow"class="crossfadeHome">
<figure>
<img src="photos/img_1.jpg"style="width:100%;height:auto;"alt=""/>
</figure>
<figure>
<img src="photos/img_2.jpg"style="width:100%;height:auto;"alt=""/>
</figure>
<figure>
<img src="photos/img_3.jpg"style="width:100%;height:auto;"alt=""/>
</figure>
<figure>
<img src="photos/img_4.jpg"style="width:100%;height:auto;"alt=""/>
</figure>
</div>
<!--FooterSection-->
<footer id="home_footer">
<hr/>
<p id="footer_copyright">©<script>document.write(newDate().getFullYear())</script>mysite</p>
</footer>
</body>
</html>
Make sure you check typos in your code.
Change margin:0auto; to margin:0 auto; and text-alin:center; to text-align:center;.
If you want to know more about margin, click here.
To check errors in your css you can visit CSSLint.
I'm trying to reproduce some pieces of CSS from the http://flink.to website, especially the tiles which contains for each article the picture, the title, the author, the link to the author page and the link to the article.
Here is the HTML for one tile :
<div class="block-module">
<a href="http://flink.to/stories/54b6e61de3039db33f00000b" class="article-link">
<span class="button">View Story</span>
</a>
<img src="https://cdn01.flink.to/api/image/54f492ec30323921c9000000/300/300/fill">
<div class="block-about">
<h2 class="block-title">Arch Enemy’s Perpetual Revolution</h2>
<span class="block-stats">
by Andrew Epstein
</span>
</div>
</div>
Here is the CSS for one tile :
.block-module { width: 283px; height: 283px; font-size: 0.9622em; display: block; cursor:pointer; border-radius:0.3125em; overflow:hidden; z-index:4; position:relative; }
.block-about { position:absolute; bottom:0; left:0; right:0; padding:4em 1em 1em 1em; background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); background-image:linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); }
.block-about a { position:relative; z-index:5; }
.block-title { max-width:100%; margin:0 0 0; color: white !important;font-size:1.625em; }
.block-stats { width:100%; margin-top:0.35714em; font-size:0.875em; color:rgba(255,255,255,0.55) !important; }
.button { color:#ffffff; background-color:#337d94; }
.author-link { color:#659dae; }
Everything's OK except that we can't access the article and the "view story" link which is supposed to show up only when we hover the picture, in the middle/center of it.
Edit : Here is a demo : http://jsfiddle.net/5qwejk20/
As the website's CSS sheet of Flink.to is really very complicated, I didn't find how to resolve this. Could you please help me ?
There is a lot of CSS, and obviously it's hard to tell what does what and it will need to be trimmed. But from what I can tell these are the styles making it happen. The button opacity is initially 0 (hidden), so needed to change to 1.
JSFiddle
I added this style to make it show with the cursor
.view-full-module.mod-custom-icon:hover .button.view-full-custom-el {
opacity: 1;
}
By looking at the css the elements are hiding and showing by using the z-index property and CSS Positioning. Try the following code, I use different values of z-index to overlap elements. Remember that the z-index property only is valid for elements with position:absolute,position:relative or position:fixed so you have to scaffold your website having this on mind. I also added an id to the img to select it on the css. http://jsfiddle.net/cfahhmkj/
HTML
<div class="block-module">
<a href="http://flink.to/stories/54b6e61de3039db33f00000b" class="article-link">
<span class="button">View Story</span>
</a>
<img class="albumImage" src="https://cdn01.flink.to/api/image/54f492ec30323921c9000000/300/300/fill">
<div class="block-about" >
<h2 class="block-title">Arch Enemy’s Perpetual Revolution</h2>
<span class="block-stats">
by Andrew Epstein
</span>
</div>
</div>
CSS
.block-module { width: 283px; height: 283px; font-size: 0.9622em; display: block; cursor:pointer; border-radius:0.3125em; overflow:hidden; z-index:4; position:relative; }
.block-about { position:absolute; bottom:0; left:0; right:0; padding:4em 1em 1em 1em; background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); background-image:linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); }
.block-about a { position:relative; z-index:5; }
.block-title { max-width:100%; margin:0 0 0; color: white !important;font-size:1.625em; }
.block-stats { width:100%; margin-top:0.35714em; font-size:0.875em; color:rgba(255,255,255,0.55) !important; }
.button { color:#ffffff; background-color:#337d94; }
.author-link { color:#659dae; }
.article-link {
position:absolute;
left:110px;
top: 120px;
z-index:-1;
}
.albumImage{
position:absolute;
z-index:0;
}
.albumImage:hover{
z-index:-2;
}
I just hit sth that appears to be a bug or at least a really weird feature of CSS/HTML.
Now, the problem is that i got three divs in a row, all inside a parent div.
The first and the second one are supposed to be text containers in a chat-like matter. The last one is supposed to be excluded and be a paging navigation.
On the very first page, that works fine. On every other page, the last text container div expands over the navigation. When using the Chrome developer tools, it shows me that the second div is only having its real size, while the background still expands over the navigation. But if i delete the navigation, the second text container resizes to its real size.
Also, when using
position:absolute;
it doesn't expand. Setting the position to relative explicitly didn't fix the problem and setting the background-color to sth else didn't change the white background.
I made you a quick demonstration under jsfiddle.net.
So the final question is: Why does the second text div expand? Or doesn't it but it looks like it does?
//edit: As suggested in the comments, here is the raw CSS/HTML outside jsfiddle. I still don't think that's a good idea, but if you say so..
<div class="decoded_chat" pagenr="1" style="display: block;">
<div class="decoded_user decoded_user_first" isme="0">
<a href="https://www.facebook.com/4" target="_new" title="Profil aufrufen">
<img class="decoded_user_avatar" src="http://graph.facebook.com/4/picture?type=square">
<div class="decoded_user_name">
Zuckerberg
</div>
</a>
<div class="decoded_msg_date">
02.02.2014, 01:36 Uhr
</div>
<div class="decoded_msg">
I will listen to the songs when I'm not so tired
</div>
<div class="decoded_msg">
I don't know.. Possibly
</div>
<div class="decoded_user decoded_user_last" isme="0">
<a href="https://www.facebook.com/4" target="_new" title="Profil aufrufen">
<img class="decoded_user_avatar" src="http://graph.facebook.com/4/picture?type=square">
<div class="decoded_user_name">
Zuckerberg
</div>
</a>
<div class="decoded_msg_date">
02.02.2014, 01:33 Uhr
</div>
<div class="decoded_msg">
I've been ill all week.. Just haven't had time for much
</div>
<div class="decoded_chat_pager">
<a href="javascript:void(0);" pagenr="0" class="cloudview_msg_prev">
« Vorherige Seite
</a>
<a href="javascript:void(0);" pagenr="2" class="cloudview_msg_next">
Nächste Seite »
</a>
</div>
</div>
a {
text-decoration: none;
color: white;
}
.chat_list {
width:100%;
}
.decoded_chat {
text-align:left;
width:100%;
margin:auto;
background-color:white;
color:black;
border-radius:10px;
}
.cloudview_msg_next {
float:right;
}
.decoded_chat_pager {
margin:auto;
margin-top:5px;
text-align:left;
width:95%;
}
.decoded_msg {
margin-bottom:3px;
}
.decoded_user {
padding:15px 10px;
min-height:50px;
}
.decoded_user_last {
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
}
.decoded_user_first {
border-top-left-radius:10px;
border-top-right-radius:10px;
}
.decoded_user_name {
color:black;
margin-bottom:5px;
}
.mychatmessage {
background-color:#BFF2BF;
}
.decoded_msg_date {
float:right;
color:grey;
margin-top:-30px;
}
.decoded_user_avatar {
position:absolute;
}
.decoded_user_name {
font-weight:bold;
}
.decoded_user_name, .decoded_msg {
margin-left:64px;
}
table {
text-align:center;
}
.flipped-180 {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter:"FlipH";
}
#detailopener, #return_to_msg, #return_to_cloud, #cloudview_delete {
display:none;
}
.chat_list_names {
color:grey;
}
.invi {
position:fixed;
width:1px;
height:1px;
top:-2000px;
left:-2000px;
}
.next_page_chat_list {
text-align:right;
padding-right:5px;
}
.last_page_chat_list {
padding-left:5px;
text-align:left;
}
.loadingtext {
margin-top:7px;
}
#opener {
position:fixed;
left:25px;
bottom:25px;
cursor:pointer;
display:none;
}
.dontdroponme {
opacity:0.3;
}
#dropper {
position:fixed;
right:25px;
bottom:25px;
cursor:pointer;
display:none;
}
.dropinfo {
border-radius:7px;
color:white;
padding:5px 25px;
}
.dorpinfo img {
width:48px;
}
.chatlist_button img, .decoded_user_avatar {
box-shadow:0 0 5px #888;
border-radius:5px;
}
.chatlist_button {
background-color:white;
border-radius:5px;
box-shadow:0 0 5px #888;
padding:5px;
cursor:move;
max-width:200px;
margin:auto;
}
.ui-draggable-dragging {
position:absolute;
z-index:5;
}
body {
height:100%;
margin:0;
background-color:#3B5998;
color:white;
font-size:12px;
font-family:Calibri;
}
#innerbody {
margin:auto;
width:55%;
text-align:center;
}
#innerbody_floater {
height:50%;
width:100%;
margin:0;
}
Copy from http://www.w3schools.com/css/css_positioning.asp
An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is html:
I'm trying to create a group of divs that are to be perfectly fluid squares, resizable with the viewport.
Here's the HTML structure:
<div id="container">
<div id="row">
<div class="cell A1">
<img class="spacer" src="http://imgur.com/t5M1ryQ">
<div id="text">MIKEY
<br/>
<p>SPINDRIFT KIOSK</p>DIGITAL COLLAGE</div>
</div>
<div class="cell A2">
<img class="spacer" src="http://imgur.com/t5M1ryQ">
<div id="text">ERIC
<br/>
<p>LIZ & RYAN HEMSWORTH</p>ALBUM DESIGN</div>
</div>
<div class="cell A3">
<img class="spacer" src="http://imgur.com/t5M1ryQ">
<div id="text">MIKEY
<br/>
<p>EPHEMERA</p>DIGITAL COLLAGE</div>
</div>
<div class="cell A4">
<img class="spacer" src="http://imgur.com/t5M1ryQ">
<div id="text">ERIC
<br/>
<p>REJJIE SNOW</p>SITE DESIGN</div>
</div>
</div>
The img class="spacer" image is a blank square png intended to 'stretch out' a div to prevent it from being 0x0.
Here's some CSS. I've included a little extra because I'm not sure exactly what's causing it.. I believe it's the :before elements.
.A1, .A2, .A3, .A4 {
position:relative;
}
.A1:before, .A2:before, .A3:before, .A4:before {
content:"";
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
transition: opacity .2s ease-in-out;
-moz-transition: opacity .2s ease-in-out;
-webkit-transition: -webkit-filter .2s ease-in-out;
filter: url(filters.svg#grayscale);
/* Firefox 3.5+ */
filter: gray;
/* IE6-9 */
-webkit-filter: grayscale(90%) brightness(30%);
/* Google Chrome, Safari 6+ & Opera 15+ */
z-index: -1;
}
.A1:before {
background-image:url('spindrift.jpg');
background-size:cover;
}
.A2:before {
background-image:url('daynnite.jpg');
background-size:cover;
}
.A3:before {
background-image:url('');
background-size:cover;
}
.A4:before {
background-image:url('');
background-size:cover;
}
.A1:hover:before, .A2:hover:before, .A3:hover:before, .A4:hover:before {
-webkit-filter:none;
}
/* text hover */
div.cell:hover #text {
opacity:0;
}
#text {
opacity:1;
display:table;
position:absolute;
z-index:999;
color:#ffffff;
text-align:center;
width:100%;
top:44%;
left:0;
text-decoration:none;
}
p {
font:16px ProximaNovaBold, sans serif;
margin:0;
padding:1 0 1 0;
}
/* table rules */
#container {
display:table-row;
width:100%;
}
#row {
display:table-row;
width:100%;
}
.cell {
position:relative;
display:table-cell;
width:700px;
height:auto;
}
html {
margin:0;
padding:0;
height:100%;
width:100%;
}
body {
height:100%;
width:100%;
margin:0;
padding:0;
background-color:black;
color:black;
}
/* image SPACER rules */
img {
max-height:600px;
max-width:100%;
height:auto;
width:100%;
z-index:2;
}
I'm using some webkit filters over the background images of these divs, and I don't want these filters affecting the child text so I MUST use the :before indicator. Here's a fiddle
http://jsfiddle.net/QC28s/2/
They are blank(with no background images) right now, it shouldn't matter. If you go into developer tools and look at the divs, the spacer is behaving correctly as it forces each square to 209x209. However if you look at the :before indicator directly before it on the HTML you can see that it(:before) is putting a small 6px margin on the bottom of the squares, making them 209x215. That's what my problem is... Much appreciated.
Explanation :
The :before element has position:absolute; so it can't expand it's parent. The problem doesn't come fro there.
The issue is the whitespace created by the images. Images are inline elements they add white-space just after them (like inline-block elements).
Solution :
Add display:block; to the image tag so they are not inline elements anymore and don't add white-space.
See this FIDDLE
Btw you might be intersted in this question
I'm making a website, in which i need to set bottom and right rules for the absolute position for a text.
But it seems that IE9 only understands position:absolute; but not bottom:xx; or right:xx;.
Here's a pic of what i'm talking about:
IE:
Chrome:
HTML :
<div id="slides_wrapper">
<a href="gallery.aspx">
<div id="gallery_slide">
<p>Gallery</p>
</div>
</a>
<a href="sessions.aspx">
<div id="sessions_slide">
<p>Sessions</p>
</div>
</a>
<a href="offers.aspx">
<div id="offers_slide">
<p>Offers</p>
</div>
</a>
<a href="about.aspx">
<div id="about_slide">
<p>About Us</p>
</div>
</a>
<a href="contact.aspx">
<div id="contact_slide">
<p>Contact Us</p>
</div>
</a>
</div>
And the CSS for that section :
#slides_wrapper
{
text-align:center;
}
#slides_wrapper div
{
border-radius : 5px;
border:1px inset black;
height:500px;
width:120px;
display:inline-block;
cursor:pointer;
position:relative;
}
#slides_wrapper p
{
text-shadow :3px 3px 9px black;
white-space:nowrap;
font-size:28px;
font-family:arial;
font-weight:bold;
color:White;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
position:absolute;
}
#gallery_slide
{
background: url('../img/gallery_slide.jpg') no-repeat -130px -120px;
}
#gallery_slide > p
{
bottom:50;
right:-20;
}
#session_slide
{
background: url('../img/sessions_slide.jpg') no-repeat -240px 0px;
}
#session_slide > p
{
bottom:60;
right:-30;
}
#offers_slide
{
background: url('../img/offers_slide.jpg') no-repeat -300px -135px;
}
#offers_slide > p
{
bottom:45;
right:-20;
}
#about_slide
{
background: url('../img/about_slide.jpg') no-repeat -350px 0px;
}
#about_slide > p
{
bottom:65;
right:-35;
}
#contact_slide
{
background: url('../img/contact_slide.jpg') no-repeat -600px 0px;
}
#contact_slide > p
{
bottom:75;
right:-50;
}
Whenever you're setting styles for a fixed number of pixels, make sure to put 'px' after the number.
#gallery_slide > p
{
bottom: 50px;
right: -20px;
}
I assume that's what you meant to do here. In other cases, you might prefer to use a percentage, so your unit would be '%'. For ems, use 'em', and so on.
Units are required on all non-zero lengths. You have none, so the length is invalid. IE9's behaviour is correct.
Use this and i'm sure you can achieve results.
http://css3pie.com/