CSS - Background Image For The Main Document (css)
OK not only am I having problems giving a background image to individual cells. I have a problem where I cannot give the whole document the same background.
I mean the background appears but one table (tab2) and one cell (td1) do not show the image that should span their areas too. Ive included the css, I think I may be some suspisious code. If you could please have a look for me. Thanks (see attached) Similar TutorialsIn firefox with a maximised window my main background gets shunted right by 2px. If I de-maximise the window it puts the image centre. It always works in IE. Any ideas? Hello, I just joined the forum, I'm new to web design although I have some experience in video post production. I'm attempting to create a layout for a website using sticky footer technique and an image for the border shadow in the main column. The sticky footer works well until I tweak the css to add the background border image, then I get this empty space in the middle of the body where the border image background should be extending to. It's probably a novice mistake but I can't get to find it. Your help would be much appreciated. The HTML: Code: <body> <div id="nonFooter"> <div id="wrapShadow"> <div id="header"> <div id="linksHead"></div> <div id="mainMenu"></div> </div> <div id="content"> <div id="bannerSlider"> (SWF file) </div> <div id="contentBuscador"> </div> <div id="contentTours"> </div> <div id="contentElite"> </div> <div id="contentTestimonios"> </div> <div id="contentPromos"> </div> </div> </div> </div> <div id="footer"> <div id="wrapShadowFooter"> </div> </div> <script type="text/javascript"> swfobject.registerObject("FlashID"); </script> </body> The CSS: Code: html,body { padding: 0; margin: 0; } html { height: 100%; } body { height: 100%; background-color: #3399cc; } #nonFooter { position: relative; min-height: 100%; background-image: url(_images/shadow920x1ver3.gif); width: 920px; padding: 0px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; } * html #nonFooter { height: 100%; } #content { padding-bottom: 7em; width: 900px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-left: 0px; clear: both; border-top-width: medium; border-top-style: solid; border-top-color: #336; } #header { width: 900px; height: 100px; position: relative; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; } #footer { position: relative; margin-top: -6em; height: auto; background-image: url(_images/shadow920x1ver3.gif); width: 920px; margin-right: auto; margin-bottom: 0px; margin-left: auto; } #wrapShadow { width: 920px; margin: 0px; padding: 0px; height: auto; } #wrapShadowFooter { width: 900px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; padding: 0px; background-image: url(_images/footerCruiseship.jpg); background-repeat: no-repeat; float: left; height: 100px; } All #content(area) Divs in content have the same code as this: #contentBuscador { float: left; height: 100px; width: 880px; padding: 0px; margin-top: 5px; margin-right: 10px; margin-bottom: 5px; margin-left: 10px; } Thank you, pixelMason. Edit: Problem Solved thanks to f_nietzsche Hi, I guess I can't post the URL of my test page with the problem which would make it a lot easier to explain. I don't quite see why anyone would want to re-create the page from pasted code when they could just look at the actual page but oh well. Anyway, I'm working on a website that is supposed to look like a folder -- it is composed of a top graphic, content area, bottom graphic, all wrapped in an outer div. It looks like it ought to in Firefox. In IE there is a gap between the top graphic and the main content div. I've tried making sure all relevant margins, padding etc are set to 0. I can't put the top graphic inside the content div (fixed a similar problem this way on another project) as it is wider! Here is the page code: Code: <%@ LANGUAGE=JScript %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <link rel=stylesheet type="text/css" HREF="kahn.css"> <title>Crollard Kahn</title> </head> <body> <div class="Outer"> <img src="images/top2h.png" style="border: none; margin: 0; padding: 0;"> <div class="Main"> <div class="InnerMain"> <div style="text-align: left; padding: 10px; margin: 0 0 10px 0; background-color: #5C0D10; color: ffffc2; font-size: medium;"> <!--<img src="home_selected.png" border="0"><img src="home1.png" border="0"><img src="home1.png" border="0"><img src="home1.png" border="0"><img src="home1.png" border="0">--> Top navigation bar here... </div> <div class="Left"> <div class="InnerLeft"> Left navbar<br>here<br>...<br>...<br>...<br>... </div> </div> <div class="Right"> <div class="InnerRight"> <h1 class="Header1 Top">Header</h1> <p>Text.</p> <p>More Text.</p> <p>More Text.</p> <p>More Text.</p> </div> </div> <div style="clear: both; margin: 0; padding: 0;"></div> </div> <!-- InnerMain --> </div> <!-- Main --> <img src="images/footer2.png" style="border: none; margin: 0; padding: 0;"> </div> <!-- Outer --> </body> </html> Here is the stylesheet: Code: BODY { background: #868B6B; margin: 0; padding: 0; text-align: center; font-family: MS Sans Serif; color: black;} DIV.Outer { width: 980px; background-color: #868B6B; margin-left:auto; margin-right:auto; margin-top: 0;} DIV.Main { width: 950px; background-color: #ffffc2; padding: 0 0 10px 0; margin-left:auto; margin-right:auto; margin-top: 0;} DIV.InnerMain { width: 918px; background-color: #ffffd9; padding: 0 0 10px 0; margin-left:auto; margin-right:auto;} DIV.Left {float: left; width: 220px; text-align: center; padding: 0 0 0 0; } DIV.InnerLeft {width: 212px; margin-left: auto; margin-right: auto; padding: 0 0 0 0;} DIV.Right {float: right; width: 696px; padding: 0 0 0 0; text-align: center; border-left: 1px solid #5C0D10;} DIV.InnerRight {width: 668px; margin-left: auto; margin-right: auto; padding: 0 0 0 0; text-align: left;} .Header1 { font-weight: bold; font-size: x-large; font-family: Times New Roman; color: #5B0D0F; font-variant: small-caps; } .Header2 { font-weight: bold; font-size: large; font-family: Times New Roman; color: #5B0D0F; font-variant: small-caps; } .Question { font-weight: normal; font-style: italic; color: black; font-variant: small-caps;} .Answer { color: black; } .CK { font-variant: small-caps; } .Topic { font-weight: bold; color: black; } .TopicLink { font-weight: bold; color: black; text-decoration: underline; } P.List { margin-bottom: 2em; } .Top { margin: 0; } /* weird firefox blank space otherwise */ I'm fairly new to CSS, but am trying to leave tables behind as much as possible. Can anybody please tell me how to fix this? Regards, Elisabeth Hi All.. I am working on my first real website for a friend and I am having trouble getting the top image where I want it. I will post a link in a sec. What I am trying to do is set a top, middle and bottom image in the Main Content part of the site. It looks like a picture frame but can expand without breaking when I add new content. I had no problem putting the middle image in and I finally got the bottom image set, though I had to do some strange things to get it to work. Now I am stuck on the top image. I can not get it set where I want it. I am still learning CSS/HTML and am trying to do this on my own and with Google . but this has me stumped. Could someone tell me what I should do. Here is the link http://http://www.jamkastin.com/New..._Dreams/dd.html Here is my CSS that I did for the middle and bottom image. Code: <style type="text/css"> #html, body { top: 0px; right: 0px; bottom: 0px; left: 0px; width:800px; height: 100%; background: url(images/bg.png); margin: 0 auto; text-align: center; font-family: Verdana, Helvetica, sans-serif; } #container { width: 780px; background: url(images/wood_back.jpg); margin: 0 auto; overflow: hidden; } #navigation { margin-top: -4px; width:780px; background: #B6C5A4; font-family:Trebuchet MS, Helvetica, sans-serif; text-align:center; overflow:hidden; } #navigation ul { float:left; list-style:none; margin: 0; padding:0; position:relative; left:50%; text-align:center; } #navigation ul li { display:block; float:left; list-style:none; margin:0; padding:0px; position:relative; right:50%; } #navigation ul li a { display:block; margin:0; padding:.4em .8em; color:#000; text-decoration:none; } #navigation ul li a span { display:block; } #navigation ul li.active a { color: #fff; font-weight:bold; } #navigation ul li a:hover { color: #fff; } #mainContent { float: left; width: 450px; margin: 15px 15px -71px 15px; padding: 15px 15px 15px 15px; background:url(mainbg.gif) repeat-y; } #mainContent .p3{ padding-bottom:20px; margin-left: -21px; background:url(mainbottom.gif) bottom no-repeat; } #sidebar1 { float: right; width: 200px; padding: 15px; margin: 15px; background:url(sidebg.gif) repeat-y; } p { padding: 0px 20px 0px 20px; } #mainContent .article { padding-top:20px; } .bottom_border { width: 780px; height:30px; margin: 0px 10px; background-image: url(images/dd_border.png); } .copy { font-size: 12px; color: #000; } .copy a { color: #000; } hey, i have 2 CSS problems. number 1: my main <div> is not centered in IE. it's fine in FF, mozilla, and opera, but it stays all the way to the left in IE. Code: #main { width: 77%; margin: 0 auto; border: 1px solid #999; overflow: auto; background: #970303; color: #FFF; -moz-border-radius-topleft: 20px; -moz-border-radius-topright: 20px; -moz-border-radius-bottomleft: 20px; -moz-border-radius-bottomright: 20px; } Code: <div id='main' align='center'> number 2: i can't figure out this gradient background stuff. i have an image, 1 px wide and 1000 px high. it works fine, but once theres enough information on a page, and its longer than the 1000px, the image starts over and looks extremely unprofessional. how can i make so that the one gradient image is stretched out for the length of the page? thanks. 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. 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. 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? 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'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 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 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 HI, I have a main div for my page which I'm going to put background image for the whole page but the problem is when I write background-image in a style ,The image display below other divs and most of the part of the image does not show.how can I bring the image on the front? I hope it's clear. Thanks Hi friends, I am trying to make the background image at iamdesignermusic (dot) com to scroll to the left with the rest of the page when one clicks on the "music" or "video" link. here is what the CSS looks like for the background image: body { Code: Original - Code background-image: url(/images/background.jpg); background-color: #333333; background-repeat: no-repeat; margin-left: 0px; margin-top: 50px; margin-right: 0px; margin-bottom: 0px; background-position: top center; background-image: url(/images/background.jpg); background-color: #333333; background-repeat: no-repeat; margin-left: 0px; margin-top: 50px; margin-right: 0px; margin-bottom: 0px; background-position: top center; } div.button { margin-top:220px; } div.footer { margin-top:30px; } im redoing my website to try and make a version of it that is more clean because i got sloppy and fixing up sloppy code for me is alot harder than just starting over. i havent been working on my site for a few weeks or too much scripting in general so i might be making a dumb mistake, heres my problem http://mrsako.gotdns.com/newest.php this is where im making the newest version of my site, its going to be using css you can view the html if you want, you can see i included <link rel="stylesheet" type="text/css" href="stylesheet.css" /> inside it some of the lines include a class im making for a <td> of the table Code: .topbarTD{ border-style: none; border-width: thin; padding:0; height:187px; max-width:1024px; width: expression(document.body.clientWidth > 1024 ? "1024" : "auto" ); background-image:url("images/banner.jpg"); background-repeat: no-repeat; text-align:right; vertical-align:bottom; } which sort of works. the text align attributes applied to the page as you can see the text get put on the bottom right and also theres a blcok of space showing theres 187px there where the image would be, but its not showing up, mrsako.gotdns.com/images/banner.jpg DOES exist this is the table Code: <table class="container" cellpadding="0" cellspacing="0"> <tr> <td class="topbarTD" colspan="2">should be here</td> </tr> <tr> <td rowspan="2"> <img src="images/leftspace.png" width="165" height="472" alt=""></td> <td> <img src="images/topspace.png" width="859" height="95" alt=""></td> </tr> <tr> <td> <img src="images/mainspace.png" width="859" height="377" alt=""></td> </tr> <tr> <td colspan="2"> <img src="images/bottombanner.png" width="1024" height="107" alt=""></td> </tr> </table> 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? |