CSS - Background Image Tiling
I want the background image to be stationary as the page scrolls. I'm assuming the fixed parameter would do it but it's not. I have tried the following:
Code: body { font-family: Helvetica, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 11px; background: url(images/background.jpg) fixed; and this Code: body { font-family: Helvetica, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 11px; background: url(images/background.jpg); background-attachment: fixed; } And neither worked. I thought well maybe scroll means the text will scroll so I changed them to scroll and still, it is tiling. What do I need to do to get it to stay fixed so the contents will scroll? Thanks in advance! Similar TutorialsHi 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 there. I seem to be having an issue with my backgrounds that I've set to tile in my CSS not tiling (I've tried setting the width by percents, but that skews the entire design). I'm also not seeing the "container" background show up for some reason. Hopefully someone can assist me with this, I'd be forever grateful. You can see the page he http://sttwilightfrontier.co.uk/theme.php Theme.php Code: Code: <html> <head> <link rel="stylesheet" type="text/css" href="styles/theme.css"> <title>Theme Test</title> </head> <div id="container"> <div id="hleftcorner"></div> <div id="headertop"></div> <div id="hrightcorner"></div> <div id="missionName"></div> <div id="missionDesc"></div> <div id="headercb"></div> <div id="contenttlc"></div> <div id="contenttop"></div> <div id="contenttrc"></div> <div id="sidebartop"></div> <div id="contentleft"></div> <div id="contentright"></div> <div id="sidebar"></div> <div id="content"> <div id="emblem"></div> </div> <div id="contentblc"></div> <div id="contentbottom"></div> <div id="contentbrc"></div> <div id="sidebarbottom"> </div> <div id="contentareabottom"></div> </div> </body> </html> theme.css Code Code: @charset "UTF-8"; body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; padding: 0; text-align: center; color: #000000; } #container { width: 100%; margin: 0 auto; border: 1px solid #000000; text-align: left; background: url(../images/theme/stars.png) repeat; } #hleftcorner { background: url(../images/theme/h_leftcorner.png); position:absolute; left:0px; top:0px; width:245px; height:180px; z-index:1; visibility:visible; } #headertop { background: url(../images/theme/header_top.png) repeat-x; position:absolute; left:245px; top:0px; width:510px; height:10px; z-index:2; visibility:visible; } #hrightcorner { background: url(../images/theme/h_rightcorner.png); position:absolute; left:755px; top:0px; width:245px; height:180px; z-index:3; visibility:visible; } #missionName { background: url(../images/theme/missionName.png) repeat-x; position:absolute; left:245px; top:10px; width:510px; height:58px; z-index:4; visibility:visible; } #missionDesc { background: url(../images/theme/missionDesc.png) repeat-x; position:absolute; left:245px; top:68px; width:510px; height:73px; z-index:5; visibility:visible; } #headercb { background: url(../images/theme/header_cb.png) repeat-x; position:absolute; left:245px; top:141px; width:510px; height:39px; z-index:6; visibility:visible; } #contenttlc { background: url(../images/theme/content_tlc.png); position:absolute; left:0px; top:180px; width:45px; height:45px; z-index:7; visibility:visible; } #contenttop { background: url(../images/theme/content_top.png) repeat-x; position:absolute; left:45px; top:180px; width:702px; height:45px; z-index:8; visibility:visible; } #contenttrc { background: url(../images/theme/content_trc.png); position:absolute; left:747px; top:180px; width:45px; height:45px; z-index:9; visibility:visible; } #sidebartop { background: url(../images/theme/sidebar_top.png); position:absolute; left:792px; top:180px; width:208px; height:45px; z-index:10; visibility:visible; } #contentleft { background: url(../images/theme/content_left.png) repeat-y; position:absolute; left:0px; top:225px; width:45px; height:521px; z-index:11; visibility:visible; } #content { background: url(../images/theme/content.png) repeat; position:absolute; left:45px; top:225px; width:702px; height:521px; z-index:12; visibility:visible; } #contentright { background: url(../images/theme/content_right.png) repeat-y; position:absolute; left:747px; top:225px; width:45px; height:521px; z-index:13; visibility:visible; } #sidebar { background: url(../images/theme/sidebar.png) repeat-y; position:absolute; left:792px; top:225px; width:208px; height:521px; z-index:14; visibility:visible; } #emblem { background: url(../images/theme/SanctuaryEmblem.png); position:absolute; width:500px; height:500px; visibility:visible; left: 110px; top: 10px; } #contentblc { background: url(../images/theme/content_blc.png); position:absolute; left:0px; top:746px; width:45px; height:45px; z-index:19; visibility:visible; } #contentbottom { background: url(../images/theme/content_bottom.png) repeat-x; position:absolute; left:45px; top:746px; width:702px; height:45px; z-index:20; visibility:visible; } #contentbrc { background: url(../images/theme/content_brc.png); position:absolute; left:747px; top:746px; width:45px; height:45px; z-index:21; visibility:visible; } #sidebarbottom { background: url(../images/theme/sidebar_bottom.png); position:absolute; left:792px; top:746px; width:208px; height:54px; z-index:22; visibility:visible; } #contentareabottom { background: url(../images/theme/ca_bottom.png); position:absolute; left:0px; top:791px; width:792px; height:9px; z-index:23; visibility:visible; } I'm basically trying to get some of the areas to scale with the browser window, as it is resized. (Content area, sidebar, header, etc.) You can see which ones I tried to do so with the repeat tags in the CSS Code. Thanks a bunch in advance for any help that comes! Hi, I have some simple CSS for a div tag, inwhich there should be a tiling background image. Here is the CSS code: Code: #mainContent{ z-index:5; padding:0; margin: 2px; background-image: url(images/common/bodybg.gif); background-repeat:repeat-y; height:100%; } Then I have my div tag: <div id="mainContent"> which holds 2 other divs, both without backgrounds. Yet my tiling background doesn't show. Is there anything wrong with my code? I have checked the image path etc, but can't figure it out. Here is the site: http://www.caillouette.com/SouthernLiving/ thanks Site: project-jericho.com An organization recently hired me to give their web site a "face lift". Everything was working fine until I tried to tile a background within the main content div. If you go to the page in internet explorer, you'll see how it's supposed to look. In firefox, however, the background does not show up. If I set the min-height value to a certain number of pixels in #main, the background stops tiling after that many pixels (in firefox.) min-height: 100%; does not work. The css (if necessary): (this is the css for everything under /* content */ which I'm fairly sure is where I've isolated the problem to. Code: /* content */ #main { color: #333; margin: auto; padding: 0px; text-align: left; width: 680px; background-image: url('img/bgx2.jpg'); background-repeat: repeat-y; } #content{ width: 440px; float: left; padding: 10px 10px 20px 10px; } * html #content{ padding-top:20px; } #content .post { margin:0 0 3em 0; } #content .cat { margin:0; padding:0; color:#999; } #content .post-info { color:#777; text-align:right; } #content .post-info em { font-style:normal; float:left; margin:0 5px 0 0; } em.user { padding-left:12px; background:url(img/user.png) no-repeat left center; } em.date { padding-left:15px; background:url(img/date.gif) no-repeat left center; } #main .post-comments { background:url(img/comments.gif) no-repeat left center; padding-left:12px; } All I need for this code to do is to tile vertically in both Firefox and Internet Explorer. I've been wasting hours in this office on this and any help would greatly greatly appreciated. Thank you so much in advance. -Josh Hey people. I've been desperatly searching for a fix for the bug in my CSS, but I don't know what I'm doing wrong. Here is a link to the the testfile: http://users.skynet.be/bert_fonteyn...iek/index.html. The page validates as valid XHTML. Now here is the bug in Windows (I have not tested it in Mac yet), both in Netscape 7 as in IE 6. Shrink your window, so you have a horizontal scrollbar. Scroll to the right, and you will notice there is a white area which can 't show the backgroundtile for some 60 px wide. The content (which is white) is there however... Can someone please tell me what I'm doing wrong? Greetz, Bert The layout I have going is a bit difficult to explain. Here's a diagram.. The area of importance is the header. The content and main head area are centered. The area to the left and right of the header are a <div>. However, as you can see, the background image on the left is different than the one on the right. I'm having difficulty making this work. the images can be stretched horizontally without a problem, but the two sides must meet in the middle beneath the header. I hope this makes sense. What I've got to do, I think, is tell the background image of the underlying <div> to stretch to 100%, and make this image 300px wide or so including both sides of the image and a split. The split would hide behind the header. I can't find a method to stretch the background image, though. Does anybody know of a better way, or a way to achieve this method at all without getting into completely different layouts? Thanks in advance for any assistance/suggestions. I'm trying to tile a background image horizontally with a vertically tiled background image centered on the page. Being new to css and not particularly fluent in html (although more so than css), I have no idea how to go about doing this or if it is even possible. I do have both images working separately though. Help would be appreciated. -alexa In short, I'm trying to get this one image to tile down the page to the bottom, underneath a static background image. Basically, it's a 2pixel high image that's ready to tile vertically, just having a tough time getting it to work. You can clearly see the problem here, a gap at the bottom: http://www.groundedgroup.com/clients/NWR/ Here's the relevant css: http://www.groundedgroup.com/client...WR-GG/style.css I've googled and subsequently tried out some solutions, but no luck. Got any ideas? Thanks in advance. PS - Is there a way to keep the spiders from indexing my links above? The site is on a test server, so I don't want the url indexed. I have a titlebar for an article for my site and i'm trying to achieve rounded corners with transparency. The problem is that my transparent images (toprightcorner and blobs) are showing the background of the div i've used to tile the background image across the bar (it's variable width). How can I prevent this? i know there is background-position but i need a fixed size that the background won't tile across at either end while the width is variable. Is the only solution to make 3 divs and use 2 as columns to hold the corner images and have the background tile across it or is there an easier way? Here is the relevant code Thanks --James Code: <div class="articlebox"> <div class="articletitle"><img class="left" src="blobs.jpg" border="0" /></div> </div> css Code: Original - css Code div.articlebox{ width:100%; /*attach it to the top of the box so we can layer the corner on top of it*/ background:rgb(249,249,249) url('topbg2.png') repeat-x fixed; padding:0px; margin:0px; } div.articletitle{ text-align:left; width:100%; height:21px; background:url('toprightcorner2.png') no-repeat right top; border-bottom:1px solid #888; padding:0px; margin:0px; } div.articletitle img{ float:left; } * html div.articletitle img{ margin-left:-3px; }
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(!) Hi, I have a question about setting up the Body background-image via a linked external stylesheet. I have a index.html file and a myStyle.css file. I want to setup the background to load an image file, test.JPG. When I embed the following in my index.html, I see the background show up: ** inside index.html file ** <BODY STYLE="background-image: url(test.JPG);"> blah </BODY> BUT, when I define my background in the externally linked myStyle.css file, the background does not load: ** inside myStyle.css file ** BODY { background-image: url(test.JPG); } ** inside index.html file ** <LINK REL="stylesheet" TYPE="text/css" HREF="myStyle.css"> <BODY> blah </BODY> </LINK> Please help. 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? Code: div.top { border: 10px solid #CCCCCC; border-bottom-width: 0px; padding: 0px; background-image: url(menutile.jpg); } The code above yields this . It is uneven with the normal image, though both are the same size. I simply want to tile the bg image to the border even with the normal menu images. What am I doing wrong? I'm trying to create a little background image for each image on this page. A kind of crappy looking polaroid type background image. It works fine in Firefox, but not in IE. Any ideas? http://www.rhizaowns.com/holly/index.php I am trying to put labels below images on my new site design. See: www.jwsuretybonds*com/jw09 I figured out how to get them vertically aligned, but I am having problems with the horizontal, as when I change the browser size, they move. Here is one of the examples: Code: #homepage-bar h2.construction { position:fixed; top:225px; left:505px; } I tried changing to position: absolute; I also tried to use percentages on the left: I know this is easy, but I can't find the fix after googling for 30 minutes. Help! I want to use php to get images from a database and display them as css background-image attributes I know that the css Code: #id { background-image: url ('path/file'); } works (obviously) and the html Code: <img src='image-generator-script.php'> also works but the css Code: #id { background-image: url ('image-generator-script.php'); } doesn't work for me. It seems as though it should work. Why place such a seemingly arbitrary limitation on CSS as only being able to display images from existing files? I've done lots of searching through documentation and on forums, but not found anything conclusive either way. A couple of people have said it works. But it doesn't for me. Is there some extra configuration step I'm missing? Does anyone know for a fact that it works? -- so I can know for sure that somewhere I'm making a blunder in my code. But the code is simple, and I don't see where it could go wrong. (As is always the case!!) I can see the image in the browser just by pasting in the script link to the address bar. I know that url() specifiers are relative to the location of the stylesheet, not the html document, but in this case the html, the css, and the php are all in the same directory. I can't see what I could be doing wrong, so it really looks like you can't do it. But why?? And why isn't it mentioned in the documentation? (At least in the placers I've looked.) If you store all your images in a database, how on earth can you display any of them in CSS except by using a script in the url() specifier? I've seen plenty of tips about generating css files from php (I already do it), but that won't help in this case. All I can think of is to have php write the image data from the database into a temporary file, and put that file name into the url() specifier. But what a horrible kludge!! I will be very grateful to anyone who can give me solid facts on this question. Andrew Blake I'm wondering is is it possible to have a background-image for the <p>?? I tried this and nothing happen. The filepath for the image is correct. I saw at http://www.w3.org/TR/REC-CSS2/colors.html that this is possible. Code: p.pBullet1 { COLOR: #FFFF00; BACKGROUND-COLOR: #FF0000; BACKGROUND-IMAGE: url("image/ul_li_bullet.gif"); } So, what did I do wrong? THanks, FletchSOD I'm having a lot of trouble with a background image that I want to cover my middle column. It fits perfectly in IE, but in FF, it repeats horizontally, so I put a repeat for only the y, and it's way too thin... Here's my code: Code: body { background-color: #000000; font-family: Verdana, Tahoma, Arial; font-size: 11px; margin:0px 0px 0px 0px; height: 100%; } #header { background-color:#000000; height: 150px; } #leftbox { float:left; width:15%; font-color: black; background-image: url('/images/dkredblk.gif'); } #rightbox { float:right; width:16%; background-color:#000000; } #middlebox { margin-right:16.5%; margin-left:15.5%; margin-bottom: -18px; margin-top: -18px; font-color: brown; background-image: url('../images/membersbackground.gif'); background-repeat: repeat-y; } #footer { position: static; clear: both; background-size: 100%; background-color:#000000; color: red; } Now I've been told that you can't stretch background images in CSS at the moment, so how could I make this background image go in my middle column without repeating on teh x axis but repeating as far as the content needs on the y axis? I have a .jpg I am using as a background image. This is the code I am using for it. Code: <style type="text/css"> span.blacktext12{display:none} body{background-image:url(MY.JPG); background-attachment:fixed; background-repeat: no-repeat; background-color:FFFFFF;} table, td, a, body, input{background-color:transparent;border:none;border-width:0} </style> So I have it set up as a image that floats with you as you scroll. I also wanted to set up another image to float with the user while they scroll but HYPERLINK it and have it float in the bottom right corner. I do not want to achieve this by removing the first background but by adding it on top... Does anyone know how to accomplish this? Bottom right corner of the screen and float with the user as they scroll? |