CSS - Background Image Stretch With Text In Firefox
I'm trying to go through examples out there and get a handle on stretching background images with an opacity text box overlaying the image. I have it working in IE7, IE6, and Firefox 2.0.0.16 with one weird little thing. In Firefox only, if I have the page designated as the home page or I hit refresh, the background image doesn't appear - just a completely white page. If I have it as a link or highlight the url itself and hit enter, the background appears. Any ideas?
It's pretty hideous - it's a test, but here's the url: http://www.mahec.net/default3.aspx Here's the code: Code: <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <style type="text/css"> html, body { height: 100%; margin: 0; padding: 0; color: #fff;} a { color: #fff; } #bg {position:fixed; top:0; left:0; width:100%; height:100%;} #content { position:relative; width:90%; padding:25px 25px 25px 25px; z-index:1; background-color:#ffffff; color:#000000; opacity:0.6; filter: alpha(opacity=60); } </style> <!--[if IE 6]> <style type="text/css"> /* some css fixes for IE browsers */ html {overflow-y:hidden;} body {overflow-y:auto;} #bg {position:absolute; z-index:-1;} #content {position:static;} </style> <![endif]--> </head> <body> <form id="form1" runat="server"> <div> <img src="http://flounder2.mahec.net/images/rhodo.jpg" alt="my 2 cats" id="bg" /> <div id="content"> <h1>Faking a Stretched Background Image</h1> <h2>Across the Whole Page</h2> <p><a href="/od/css3/f/blfaqbgsize.htm">Learn how to stretch a background image.</a></p> <p>paragraph text</p> </div> </form> </body> </html> Similar TutorialsHi, Just wondering if anyone can tell me how i would go about stretching a background image for my website so as it stretches with different page sizes and resolutions an all the rest Hi there, I'm making a CakePHP application to display my friend's artwork. I'm having trouble with the style sheet though. The header and footer are made of two fading images. I've used the background image property to stretch these images to fill the divs and have made the divs stretch to fill the width of the page. At this point it's probably easiest to see what I mean by taking a look for yourself- http://www.seb.webege.com/paintings/gallery If you view this page in Chrome or Firefox then you'll see the desired effect with the image filling the width of the page. The problem comes with Safari and IE. In these browsers the image does not stretch to fill the screen. I am not an expert at HTML/CSS and can't for the life of me work out what has gone wrong or what I can do to fix it, after numerous google searches I'm still none the wiser and I'm just not seeing the problem. Can anyone advise me how to get the images to stretch to the browser width in Safari and Explorer? Any help would really be appreciated. Many thanks, Nick Hello... I'm having some trouble. I have a container div set to 100% width. I have 2 small fixed width divs floated right and left and then a div between them that needs to stretch to fufill the 100% width while showing the background image of the container div. Works in Firefox, IE7... not so much. Any help is appreciated in advance CSS #container { width: 100%; background: url('images/topM.gif') repeat; } #leftFloat { width: 30px; float: left; } #rightFloat { #width: 30px; float: right; } #middleStretch { height: 25px; } --------------------------- XHTML <div id="container"> <div id="leftFloat"/>image goes here</div> <div id="rightFloat">image goes here</div> <div id="middleStretch">this div should stretch to fill the space between the left & right floats showing while repeating container background image</div> <!--end #container--></div> Hi. Really hoping someone can help me with this... I'll try and explain this as best I can(!) Basically I've got a page containing a block of 9 images, with each linking to a video clip. At the moment I've got the CSS coded so that whenever the mouse is hovered over the 'infobar' (at the bottom of each image) it goes from having a transparent background with black text to having a grey background with white text. What I'm trying to achieve is that same effect whenever the mouse is hovered over any part of the image and infobar. The live online link can be found at: www.markmcm.co.uk/test/test.html The CSS is as as follows: Code: /* * Page Stylesheet */ body { font-family: Arial, Helvetica, sans-serif; background-color: #eaeaea; border:0; margin:0; padding:0; height: 100%; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } #container { margin-left: auto; margin-right: auto; min-height: 100%; width: 936px; } * html #container { height: 100%; } #content { float:left; position: relative; height: 528px; width: 936px; z-index: 0; } .miniscreen1, .miniscreen2, .miniscreen3, .miniscreen4, .miniscreen5, .miniscreen6, .miniscreen7, .miniscreen8, .miniscreen9 { position: absolute; float: left; display: block; width: 312px; height: 176px; } .miniscreen1 { top: 0; left: 0; } .miniscreen2 { top:0; left: 312px; } .miniscreen3 { top: 0; left: 624px; } .miniscreen4 { left: 0; top:176px; } .miniscreen5 { left: 312px; top:176px; } .miniscreen6 { left: 624px; top:176px; } .miniscreen7 { left: 0; top:352px; } .miniscreen8 { left: 312px; top:352px; } .miniscreen9 { left: 624px; top:352px; } .info { height: 30px; top:3px; left: 40px; width: 265px; float: left; position: absolute; } .infobar { left:0px; position: absolute; top: 140px; width: 312px; height: 36px; outline: none; color:#000; background: url("data/infobar.png") no-repeat 0 0; z-index: 650; } .infobar:hover { background-position: 0 -36px; outline: none; color:#fff; } #infobar span { display: none; outline: none; } .clip_title { outline: none; font-size: 85%; font-weight: 700; vertical-align: top; text-align: left; } .clip_sub { outline: none; height: 13px; font-size: 80%; line-height: 13px; font-weight: 700; vertical-align: top; text-align: left; } And the HTML is: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Page</title> <meta name="description" content=" " /> <meta name="keywords" content=" " /> <meta name="generator" content=" " /> <link rel="stylesheet" type="text/css" href="page.css" media="screen" /> </head> <body> <div id="container"> <div id="content"> <span class="miniscreen1"> <a href="#"> <img src="img/clip1.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 1<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen2"> <a href="#"><img src="img/clip2.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 2<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen3"> <a href="#"><img src="img/clip3.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 3<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen4"> <a href="#"><img src="img/clip4.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 4<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen5"> <a href="#"><img src="img/clip5.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 5<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen6"> <a href="#"><img src="img/clip6.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 6<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen7"> <a href="#"><img src="img/clip7.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 7<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen8"> <a href="#"><img src="img/clip8.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 8<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> <span class="miniscreen9"> <a href="#"><img src="img/clip9.jpg" width="312" height="176" border="0"> <span class="infobar"><span class="info clip_title">Test Clip 9<br><span class="clip_sub">123 Productions</span></span></span></a> </span></span> </div> </div> </body> </html> There must be a better (and easier?) way to do this. Any help would be very-much appreciated - and save an old bloke from tearing too much of his hair out(!) hello all, I am not very well experienced with CSS, so, please, bear with me. this question may sound stupid. I have a web page that is comprised of one main table. Except for the banner on top (1 column), the main row has two columns. These columns will comprise of: 1) left column: Menu 2) right column: page content. In the left column, the menu, I would like to have a background image sitting behind the menu. I have attempted to use CSS to put an image behind the menu: Code: .menu_back {background: url('Pics/Web/menu_background.jpg') no-repeat #ffffff;} And my html looks like this: Code: <table width = "100%" class = "menu_back"> This does not work. After scouring the web without any real success , I humbly ask for ur help. I am designing for Firefox hoping it will work fine under IE. Thanking u in advance. I have two bits of code that work in IE, but not in Firefox, and I have no idea why! They both use the background-image property Here is the first: Code: a.bio { display: block; width: 150px; height: 26px; background-image:url(C:\Apache 2.2\htdocs\_empaudio\test\images\btn_bio.jpg); background-repeat: no-repeat; } a.bio:hover { background-image:url(C:\Apache 2.2\htdocs\_empaudio\test\images\btn_bio_h.jpg); } Code: <a class="bio" href=""></a> And the second: Code: td.window { width:670; height:31px; background-image:url(C:\Apache 2.2\htdocs\_empaudio\test\images\window_nav_repeat.jpg); background-repeat:repeat-x; padding:0px; margin:0px; border-spacing:0px; border:0px; } Code: <td class="window"></td> Does ANYONE know why this is happening?? Hi there, First time posting here so dont bite my head off! First up allow me to say, that i've done a search for previous posts and although i found topics similiar to what im asking none of the answers within helped me. Second, i've run my CSS and XHTML through the validation service over at w3c. - XHTML transitional - is valid on all pages apart from the main page this is due to me running cutenews on that page and the markup isnt valid. - CSS is valid. Okay to business, im hoping someone out there can help me, i've recently just updated my website with a new layout. It works perfectly in IE-6 but not in firefox, or any other browser for that matter (i used browsercam). I have issues with the background images not displaying as they should do. And not only that, my flash animation at the top of the page isnt displaying in FF either! Heres a link to my website And heres a link to the CSS file someone help please! hello. this has us stumped. here is the page: http://www.praxishosting.com/dev/csstest/testindex.htm it looks fine in IE, but in firefox, the div tag containing the background image does not appear to be expanding as the content grows. thus in firefox, you cannot see the background image in the bottom left hand cell (the only place it shows through). any suggestions? the style code for the background container is rather simple: Code: #container { width: 750px; background: url(../media/bkgrd.gif) repeat fixed center top; margin-right: auto; margin-left: auto; height: 100%; } Hello, I was wondering if anyone could help me get this background image to show up in firefox. It shows up in IE. It's the first #header image. I included the other code in case something is conflicting. *edit... nvm. I'm trying to get a repeating background image to show up in my Firefox browser but can't get it to work. Grateful if somebody can tell me what is wrong with this code? Code: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css" media="all"> #header { background:#A31135 url(images/fill.gif) repeat-x fixed; height:100px; } </style> </head> <body> <div id="header"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </div> </body> </html> Many thanks. Hi I am redesigning my blog and took it down completely. I want to place the day's text post on the day's photo post on top of the latter, while graying out the photo. Is that possible without using flash? Hi I'm putting a page together with a vertical tiling background. It's ok in Safari, but the tiling image seems to stop before the bottom of the page. It should be held by the #container div, but the developer toolbar shows this ending way before the end of the page - even though I have contained content still appearing down to the page edge. The site is at bringmyshuttle.com As far as I can see my code makes sense... Any ideas? Thanks Hi, okay I am working on a website for a friend, and it is peak-performance.biz I want the background image to fill up the page and be unscrollable. I made it work and look very good in chrome but it only takes up half the page in firefox. I was wondering if anyone have any ideas how to fix this. Thanks for your advice in advance. I have used html{ background-color:#000000; background-image:url(images/background.jpg); background-repeat:no-repeat; background-size:1300px; height:1000px; background-attachment:fixed; } and html{ background-color:#000000; background-image:url(images/background.jpg); background-repeat:no-repeat; background-size:100%; background-attachment:fixed; } I have just started writing a page and the first thing I did was establish a body background color and image. It works in IE but not FF. Can someone please give me a clue what is wrong. I have searched all the CSS books and the internet but I cannot find an answer. Thanks in advance. The URL is http://www.childrens-stories.me.uk/ I have a problem that I have never seen before. I am using css to set the background properties of the body tag. Works just fine in IE but no background at all shows up in Firefox. css code for the body tag is: body { background-color: #0d005e; background-image: url('images/bgmain.jpg'); background-repeat: repeat-x; } Any thoughts? Okay the backgroundimage "content-header" does not display in firefox for the <div id="contentWrapper"> tag. In internet explorer it displays. Not sure what the hell is going on with it. I hate css http://www.mgan.net/work/10-06-04/layout1.html There is the link, I have my styles in the header section of the html file. I am trying to set background of my divs with: background:#FFFFFF url(images/nheadlines_bg.gif) top no-repeat; It works fine with IE but at Firefox there is only a white background. You can check this out at: http://www.pearl.ru/isdunyasi Hi, I want to put a background image for a div section of my site. It works fine in i.e. but i can't get it to show up in firefox. Does anyone know why? CSS: Code: body { font-family : Arial, Helvetica, sans-serif; font-size: 16px; background: #330000; text-align:center; margin: 0; padding: 0 } #mainarea { background-image: url('alexandertea_bg_v03.jpg'); width: 719px; height: 650px; } HTML: Code: <body> <div class="topbar"> <img src="images/lemonreghome.gif" id="home"> <img src="images/lemonregstory.gif" id="story"> <img src="images/lemonregwheretobuy.gif" id="wheretobuy"> </div> <div id="mainarea"> Hellow </div> </body> Hey everyone, I'm redesigning a site and I'm running into some problems in firefox with the placement of the header-background image. The problem is that firefox places the image about 15 pixels below the intended area. When I add a border of 1 pixel to the header div firefox places the image correctly. I don't have this problem when viewing the site in IE. I've coded the following XHTML and css: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>ParaCentrumEeldeHoogeveen</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="Content-Language" content="nl" /> <link rel="stylesheet" href="css/layout.css" type="text/css" /> </head> <body> <div id="container"> <div id="header"> </div> </div> </body> </html> And the css file: Code: html { padding: 0px; margin: 0px; } body { background: #3a60db url('../gfx/background.jpg') repeat-x; font-family: arial, "lucida console", sans-serif; font-size: 12px; color: #000000; text-align: center; margin: 0px; margin-top: 0px; padding: 0px; } #container { border: 0px solid #ff0000; width: 760px; margin: 0px auto; padding: 0px; text-align: left; } #header { background: url('../gfx/header.jpg') no-repeat; height: 238px; width: 760px; padding: 0px; margin: 0px; } Screenshot of the problem Does anybody know what the problem is? Thanks in advance. Grtz. Arjen Hi all, I use an background image for a menu. Code: #menu a, #menu a:hover { height: 20px; width: 150px; text-decoration: none; padding-left: 40px; padding-top: 3px; padding-right: 3px; font-weight: bold; font-family: Arial, Helvetica, sans-serif; font-size: 11px; margin-bottom: 10px; background-position: 0px; vertical-align: middle; } #menu a { color: #9E007F; background-image: url(../imgs/nav/subNav/subNav_bg.gif); background-repeat: no-repeat; } #menu a:hover { color: #FFF; background-image: url(../imgs/nav/subNav/subNav_bg_over.gif); background-repeat: no-repeat; } It works fine in IE but not in firefox. Somehow the background image is not completely shown. It stops after the last letter. Any suggestions?? Grtz, |