CSS - Stretchy Css Banner?
I'm trying to figure out a way to create a banner across the top that consists of an image, but whose right edge extends all the way to the right edge of the browser -- regardless of the window size.
At the same time, I need to do the same thing with the left column: fill it with an image whose bottom edge extends all the way to the bottom of the window. I can do this with tables, but can't figure out a cross-browser way to do it in CSS. The "stretchy" right edge of the banner is simply a 1 pixel wide slice of the banner's right edge, repeated as necessary. Similarly, the "stretchy" bottom of the left column is a 1 pixel slice of the bottom of the column's image. I can't get these to appear in Mozilla. Here's my code: Styles.css: PHP Code: .banner { background-image:url(./images/banner-fill.gif); width:100%; } .nav { background-image:url(./images/nav-fill.gif); width:104px; height:100%; } .content { position:absolute; left:140px; top:140px; } Template.htm: PHP Code: <html> <head> <title>Template</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="css/styles.css"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="height:100%;width:100%"> <div class="banner"><img src="images/banner.jpg" width="800" height="134" border="0"></div> <div class="nav"><img src="images/nav.jpg" width="104" height="327" border="0"></div> <div class="content"> <p>Page Content</p> </div> </body> </html> Similar TutorialsIm just starting trying to use more css instead of relying on tables. i think i have most everything worked out except for one thing: my navigation is on the left and i want the background color to stretch all the way down to the footer, regardless of how tall or short it is. is there any way i can work around this? thanks! The CSS: html,body{margin:0;padding:0; height:100%} body{font: 76% arial,sans-serif;} * html #outer{height:100%;} p{margin:0 10px 10px} a{display:block;color: #006;padding:10px} div#header{position:relative; padding-bottom:20px} div#header h1{height:80px;line-height:80px;margin:0; padding-left:10px;background: #EEE;color: #79B30B} div#header a{position:absolute;right:0;top:23px;} div#content p{line-height:1.4} div#navigation{background:#009900} div#extra{background:#FF8539} div#container {width:100%; min-height:100%; margin-bottom:-50px; height:auto} /*for fixed center w/ liquid sides ~~ width:800px; margin:0 auto ~~ */ div#wrapper{float:left;width:100%; height:100%} div#content{margin: 0 200px; height:100%} div#navigation{float:left;width:200px;margin-left:-100%; height:100%; border: 1px solid #009900} div#extra{float:left;width:200px;margin-left:-200px} div#footer{ float:left; width:100%; } div#footer{background: #333;color: #FFF; clear:both; height:150px;} div#footer p{margin:0;padding:5px 10px 5px} div#footer a{display:inline;padding:0;color: #C6D5FD} div#clearfooter{clear:both;height:50px;} The Html: <div id="container"> <div id="header"> <h1>We Sell Real Estate</h1> </div> <div id="wrapper"> <div id="content"> <p><!-- TemplateBeginEditable name="EditRegion1" -->EditRegion1<!-- TemplateEndEditable --></p> <div id="clearfooter"></div></div> </div> <div id="navigation"> <ul class="glossymenu"> <li><a href="(URL address blocked: See forum rules)">Home</a></li> <li><a href="(URL address blocked: See forum rules)">Our Listings</a></li> <li><a href="(URL address blocked: See forum rules)">Our Agents</a></li> <li><a href="(URL address blocked: See forum rules)">Request Info</a></li> <li><a href="(URL address blocked: See forum rules)">Area Info</a></li> <li><a href="(URL address blocked: See forum rules)" target="_blank">Missouri Info</a></li> <li><a href="(URL address blocked: See forum rules)">Mortgage Info</a></li> <li><a href="(URL address blocked: See forum rules)">FREE Market Analysis</a></li> <li><a href="(URL address blocked: See forum rules)">Links - Resources</a></li> <li><a href="(URL address blocked: See forum rules)">Link to Our Website</a></li> <li><a href="(URL address blocked: See forum rules)">Office Location</a></li> <li><a href="http://mailto:design@uscybertek.com">Send E-Mail</a></li> <li><a href="(URL address blocked: See forum rules)"><br> <img src="(URL address blocked: See forum rules)" alt="FREE HOMEBUYER'S GUIDE - YOU NEED THIS INFO!" width="100" height="91" vspace="0" border="0" align="center"><br> CLICK HERE!</A></li> </ul> </div> <div id="extra"> <p><strong>3) More stuff here.</strong> Here we can put a slideshow, mortgage calc, weather... </p> </div></div> <div id="footer"> <p class="footer" style="padding-right: 10px; padding-top: 10px;"><br> Real Estate Company ~ My Name, Owners/Brokers<br> 123 First St. ~ Houston, Missouri 123456 ~ Office: 417-967-2011<br> Fax: 417-967-2011 ~ E-Mail: <a href="mailto:design@uscybertek.com">design@uscybertek</a> ~ <a href="(URL address blocked: See forum rules)" class="lcolors">Site Map</a> ~ <a href="(URL address blocked: See forum rules)" target="_blank" class="lcolors">Missouri Real Estate</a><br> <a href="(URL address blocked: See forum rules)" target="_blank"> <img src="(URL address blocked: See forum rules)/links/ml_small_mo.gif" border="0" align="middle"></a> ~ <img src="(URL address blocked: See forum rules)" align="middle"><br /> <!-- #include virtual="/includes/footer.txt"--> </p> </div> I'm trying to do one of those cool, gel looking TH's in my CSS, but I'm not sure how, especially since I'm using Mambo (which gives me less overall control). So I have my three images: the right and left corners, and a 1px wide strip to be repeated for the middle section. Can someone explain if this is possible and how to accomplish it? Hi there, I have the following in my css file: } #headerBannerWrapper { background-image: url(/GREENLOGO.jpg); background-position: bottom left; background-repeat: no-repeat; background-color: #DEF2B0; padding: 0px; margin: 0px; } #headerBannerWrapper img { padding: 0px; margin: 0px; vertical-align: bottom; However the banner doesn't get rendered in IE7. It renders OK in IE8 Any help most appreciated. The above is linked to the following class: .clearFix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; NB If the banner has content inside then it renders OK, however if there is no contents inside then the banner (green background) is not displayed. hmm i cant get this to work... i have the left side of the banner that needs to be expandable wich is a long picture.....and the right side is 10px wide. how can i get this 2 in a div wich get width by % and center aligned on the page? and also on a layer above other stuff Hi and thank you in advance for any advice or help. my website: http://earlystartdc.com/ Im having trouble trying to find the right css code so that i can adjust the banner underneath the menu in order to remove the white spaces in the module. I would like for the banner to be at margin 0 so that its all the way to the top without any white space in between. any help?? Thank you P.s - This is what my css files look like from my template/css folder . Hi everyone, I've been playing around with this for a while but I can't seem to get it to work. Basically, I'm trying to get this table effect in CSS layers. Code: <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#669999"> <td width="580">Welcome</td> <td> <div align="right"><img src="images/bg_dblue_gradient.gif" width="200" height="25"></div> </td> </tr> </table> It's basicly a 2 column layout, with the left column being some kind of content and the right column being a gradient graphic I made, to make the banner look like it has a full gradient. The gradient graphic is 200px wide, thus one resizing of the browser the table in a whole won't shrink down past 780 pixels. I want to use a <div> tag for the graphic so I can repeat-y and have the gradient appear fluid if someone resizes the text size. Any suggestions? Cheers, Fozzy I've been away for nearly three months and may have forgotten some of the basics of CSS. Today I added a banner photo to the top of my new bike club site, but cannot remember how to style it so that, when a visitor adjusts the width of their browser window, the banner photo sidles to the left or right to remain centered at the top of their window, along with the the bike club name and pull-down menus immediately below (see http://stallinswebdesign.com/vs/index.php). Can you suggest how I can style that banner photo so that it remains centered whenever a visitor stretches their browser window? I know you can view source to view my <div> structure and so forth; let me know if you'd like to see any parts of my style sheet. Thank you for your valuable time. Curtis Hi, I just installed Gallery on my website, and I'm trying to integrate it with the main theme of the rest of the site. Well I'm having a problem with the banner overlapping the logo in FireFox. It renders fine in IE7 (surprisingly), but not in FF. Have a look he http://www.lightblu.com/gallery/main.php un/pass: test/test You can look at how I want it on the homepage, or anywhere else for that matter. What am I doing wrong? I tried everything with no success. Thanks guys --Waj Hi, I need to add some content (small div) over the top of a flash banner. I tried adding wmode="transparent" to both the object and embed tag but that didnt work. Any other suggestions? thanks i am writing a site for fun to learn how websites work. The site i write right now will be like a school newspaper. I have one problem with the background, at the begining i couldnt make it no repeat but later i did it, now, i got something wrong with my code. PLease help me here is my code: ( i mean that the back ground color does not appear!! Code: <html> <head> <title> blah blah </title> </head> <body bcolor="#004d79"> <center> <img src="/pics/banner.png"> </center> <h4> <b> <center> blah blah </center> </b> </h4> <style type="text/css"> <!-- body {background-image: url(pics/background.png); background-repeat: no-repeat;}set to background-repeat: no-repeat;background-position:center; </style> <center> <b> (C) blah blah </b> </center> <center> <div style="position:absolute;top:130px;left:375px"> <h1> <b> <p> Our website is under construction!!<br>Thank you for visiting us!! </p> </b> </center> </h1> </div> <div style="position:absolute;top:250px;left:260px"> <b> <p> blah blah </p> </b> </center> </div> </html> Thanks alot, J. Hi, I want to place a Logo and Banner in the header using CSS, i tried this but no use its not working properly. PHP Code: div#main #header{ width:100%; height:95px; text-align: center; background:url(images/top_bg.jpg); } div#header #header_title{ text-align:left; font-family: Arial, Helvetica, sans-serif; font-size:25px; color:#ffffff; padding-left:20px; padding-top:20px; } div#header #header_title #banner{ text-align:right; width:468px; height:60px; background:url(images/banner.jpg); background-repeat: no-repeat; padding-right:20px; padding-bottom:20px; } Then i used this in html PHP Code: <div id="page"> <div id="header"> <div id="header_title"> Your Logo <div id="google"></div> </div> </div> But its not working properly, please please please help me....thanks... vinodkv Hi everyone, I'm somewhat new to CSS and so far I have been able to solve everything except for this one problem. This is code from the styles.css file in the blog that I'm building, now this is a free template that I'm using and there is also a header.php file but that has only php code. In the frist part of the css file this appears: body { font-family: Verdana, sans-serif, Arial; font-size: 80%; color: #232323; margin: 0px; padding: 0px; background: url(images/header.png) no-repeat top; } The background line is the image that appears as the background for the header portion of the site, and it is 960px X 150px. Then there's this part: #header { float: left; width: 960px; height: 156px; } Then towards the middle of the code there is this other part which also relates to the header: .top-header { float: left; width: 960px; height: 62px; padding-top: 60px; } .top-header a { color: #000000; text-decoration: none; } .top-header h1 { color: #000000; margin: 0px; padding: 0px; float: left; width: 960px; font-size: 26px; } .top-header p { color: #000000; margin: 0px; padding: 0px; float: left; width: 960px; } So the problem I'm having is that I have designed a logo that is about 460px X 100px and I want this to go on top of the already defined background layer above in the body part. I have tried "positioning" and also tried to set it as another background and it just appears all over the place. Also the picture I crafted in photoshop has an invisible background so that only the decorative text of the log shows up, so if I use the background method to insert it, it appears with a white background. So any pointers on this would be a great help. I have tried researching this all kinds of ways and I'm still not sure what to do Thanks Chas. I have a problem that I've been wrestling for the past hour and a half, and I've come to the conclusion that I will most likely never solve it on my own, so here I am. I have a header area of a website. It has a logo(basically the name of the website in a fancy font). The logo is in the bottom-left area of the header. I also have a banner. This banner can be anywhere from 468x60 to 728x90 pixels in dimension, depending on user input from a back end. I want the banner positioned near the bottom-right of the header, with a bit of space in between it and the right edge of the browser window. I'm having a lot of trouble accounting for the varying banner sizes. I can't use margins and floats to position the banners because the banner image size changes, therfore I thought it would be a good idea to use absolute positioning (relative to the header). This works perfectly, except when I resize the window, the banner overlaps the logo image. So, I guess I can't use absolute positioning. My HTML is: Code: <body> <div id="header"> <div id="header_ads"> <?php display_banner() ?> </div> <h1 id="heading"><span class="invisible">This is the heading</span></h1> </div> </body> My CSS is: Code: * {margin:0;padding:0;} body {width:100%} .invisible {visibility:hidden;} /*Header*/ #header {margin-bottom:3em;background-color:rgb(80, 80, 82);padding:0 0 0.2em 0;height:8em;width:100%;position:relative;} #header #heading {background:url("../images/logo.jpg") no-repeat;height:70px;width:400px;position:absolute;top:1.6em;left:1em} #header_ads {float:right;margin-top:-1.5em;margin-right:1em;position:absolute;bottom:0.3em;right:4em} The above CSS/HTML yields the exact desired result, but does strange things when the browser window is resized... I would greatly appreciate any help! Hi all, I'm working on a header which I'm having trouble with. Here's a crude diagram of what I'm looking to accomplish: Code: ____________ _______________________| |___ | _____________________| Logo |_ | | | |___________| | | | | Banner | | | |___________________________________| | | | | | <-- container div Uhhh, hopefully you can see what I'm getting at! I want a logo to be positioned on top of the banner image, but offset above and to the right, outside the container div holding the banner. Note also that the container div is centered in the page, so that the relative amount of space on either side of the container div increases and decreases with the browser window. Approaches I've tried: (1) Use position:absolute for the logo. The problem here is the horizontal position. Regardless of what I've tried, the logo moves horizontally with the size of the window. I want the logo fixed relative to the container div. (2) I've tried to use negative margins and place the logo inside the container div, but this doesn't seem to work either. How should I do this? All suggestions welcome. Thanks! Hi there, I'm working on a site on behalf of a charity (non profit social enterprise) www.ableradio.com What I am trying to do is make the banner fit on screen, and stay centred when users resize the page (or have diffrent resolution). The site is a joomla based site, so i am constricted to making changes only to the css files. currently this is the css that governs the banner; Code: #gk-mainnav{ width: 977px; height: 80px; position: reletive; padding:7px 0 0 0; background:transparent rl('../images/menu_bg_top.png') no-repeat right top; padding-bottom:100px; } #gk-mainnav2{ height:50px; width:977; line-height:39px; font-size:90%;font-weight:bold; text-transform:uppercase; padding:0 20px; margin-top:100px; } Basically, i have replaced menu_bg_top.png with our banner, and a space for the menu bar to sit on top of it. The problem is, if your running an 800x600 resolution then the banner is cropped to fit rather than resized. Idealy the banner should resize and fit the width of the screen, but if this cannot be possible, then keeping it centred will suffice (holding ctrl+mouse wheel down to zoom out, shows how the banner doesn't resize, AND how it doesn't center). If i could find the main php file from which joomla creates each page i could insert the code there with some java script that resizes the image based on resolution etc... but i am limited to the style sheets only. Thanks for any help ^_- Take care, Steve. Hi guys I've added a banner zone in my site, but it is not looking good in FF nor IE !! Site: www.stockestate.com Code for the banner zone (div) Code: #banner { float:left; position:relative; top:0px; left:25px; width:468px; height:60px; margin-top: 50px; padding: 4px 4px 4px 4px; } Does any1 know what should I try to fix this ? Thanks |