Zubrag.com
May 20, 2012, 11:37:20 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Firefox: background image stretch  (Read 6891 times)
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« on: October 03, 2007, 08:09:04 am »

Background image stretching can be easily accomplished if your browser supports the background-size property of CSS 3.
But this property does not work on Firefox 2.0.0.7. In order to emulate similar feature use following code. It will work with short text pages as well as with long pages. Gets automatically resized when window is resized.

It will also work on IE, but background image will not stick (i.e. position: fixed would not work).

<html>
<head>
<title>Background stretch on Firefox browser</title>
</head>
<body>
<div style="position:fixed; z-index:0; top:0; left:0; width:100%; height:100%;" >
<img src="background.jpg" width="100%" height="100%">
</div>
<div style="z-index:1; position:absolute; top: 0; left: 0">
This is a text over background image. This is a text over background image. This is a text over background image. This is a text over background image.
</div>
</body>
</html>

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC