CSS - Best Method For Background Gradients?
hi
I'm wanting to create the same background as this: http://www.designdetector.com/demos/css-gradients-demo-1.php (0,191,255 and 255,255,255) It looks like it uses a variety of div tags to create the gradient. But then it's kind of hard to put things over the top of the gradient. So what's the best way to create that gradient above as a background (NOT fixed)? cheers nathan Similar TutorialsHi all, Is there some trick to achieving a nice gradient background in Safari? I have a nice 150x400 red to dark red gradient JPG, and I'm using this code in the body tag of my CSS file: background: url(../images/page_back.jpg) repeat-x #670000; I have a div with a background color set, that I want to have slightly transparent. Inside that div, is essentially my entire website. Now if I apply the opacity to the main outer div, all the divs inside inherit that transparency. Any ways to get around this? The outer Div with the transparency is the "content_wrapper" div. It excludes the header and footer. So the only issue is correcting everything wrapped inside the "content_wrapper" and "content" div. I tried setting the "content" div to opacity: 1; but it had no effect whatsoever. http://www.area51entertainment.co/index.php?about I have a navigation bar. The desired behaviour is such that when a user mouses over (or out) of a button, its appearance changes. The appearance and change is being set by css (let's say background-color and background-image to make things simple). My question is this: On the mouseover and mouseout events, is it better to use javascript to manipulate these css properties directly or to use javascript to assign a new className to the button's container? Ex. Code: document.getElementById("button1").style.background-color = newColor; vs Code: document.getElementById("button1").className = newClassName In the latter, "newClassName" would obviously reference an alternate css style where the "newColor" would be defined So I have a design where the background is a large (1400x1100) image that fades into a vertical gradient at the edges. I've set up the css as follows: body { background: #000 url(gradient.jpg) repeat-x; margin: 0; } Here's where I run into my problem... I've created an empty DIV to hold the large image which will appear on top of the gradient and positioned it absolutely. <div id="bg_image"></div> #bg_image { width: 100%; height: 1100px; background: url(images/bg_image.jpg) no-repeat top center; margin: 0; position:absolute; } This works and the background looks like it should, however because the large image is inside a DIV, any time the browser window is smaller than that div (which will be the case for most users considering the image size) there will be scrollbars. This makes perfect sense of course I just can't come up with an alternative. If there was a way to extend a background image beyond the borders of a DIV that would work but overflow:visible; doesn't seem to work with background images only content. I wish I could set a repeating background AND a static background in the body style, because that is exactly the effect I'm trying to achieve. Any suggestions would be greatly appreciated! Thanks, Josh 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. Very cool new method, definitely worth a look. http://somerandomdude.net/projects/webdev/divless/ Enjoy. I have a client who wants HTML emails (I know... I know...). I'm just curious what type of CSS works the best with the most email readers out there. I really don't want to go back to tables, <font>, <center>, etc... Obvious choices are an external stylesheet linked to in the <head>. Downfall for that is if they aren't connected it may not load? Or I can do an internal sheet in the <head> or just use inline styles in each <div>, <p>, etc. What are recommendations? I imagine the client is using Outlook or OE, but I haven't asked. ---John Holmes... Hello, Is there a method by which we can use position:fixed in Internet Explorer 5.5 and 6.0 ? I have searched google but did not find anything really useful. Please help me. Hello, I tried to make a page with a header, left column and right column, as shown in the screenshot. http://img292.imageshack.us/my.php?image=screengr2.jpg You can see the code at the bottom. I used the faux-column technique to make the column colors extend to the bottom of the page. Is this a good way to do it? and does this method give problems with different resolutions on different computer-monitors. I used floats in this example to position the divs, is this a common solution or is absolute or relative positioning better? My goal is to teach myself a way to easily and effectively divide a webpage, so that I have a basic method, also in larger and more complex websites. I like to hear any tips/techniques to improve this. I used the folowing code: Code: <html> <body> <div class="wrapper"> <div class="header"> <br /><br /><br /><br /><br /> </div> <div class="left"> <img src="homer.jpg" /> </div> <div class="right"> <div class="nav"> <a href="home.htm">home</a> <!-- menubar --> </div> <div class="contents"> This is the contents of the page </div> </div> </div> </body> </html> and the css code Code: body{ background: url(fauxcolumn.jpg) 15% 0; margin: 0; padding: 0; } .header{ background-color: green; float: left; width: 100%; margin: 0%; padding: 0%; } .left{ background-color: purple; width: 15%; float: left; margin: 0%; padding: 0%; height: 100%; } .nav{ background-color: blue; width: 85%; float: left; margin: 0%; padding: 0%; } .contents{ float: left; width: 85%; margin: 0%; padding: 0%; background-color: red; } Thanks in advance. I have a table with a specified background color (specified in CSS). The content part of the table (a cell) uses information from a downloaded script (wordpress.com) to load information. I want the table background to shine through everything. How can I accomplish this (I suspect it is in the script CSS, but I don't know what). URL The 'home' page is how I want it (basically that background effect). But the other pages come out funny with no background. Could someone solve this, or alternatively reccommend another way. 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. Am design a site just now this is the image of the site here The problem is the blue background what is the best way to do this just now i have it like this by use a repeat of part of the image but want the cloud part at the top left too. I have background image for bullet. However, in Firefox it tries to display several of them for one line, and in IE it is like it should - one background image per line. Ive set background to no-repeat, and it still doesn't work in FF. Help plz. See the problem here http://www.armedassault.org/wp/ I have a div box with a 100% width and a repeating background image on it. Everything works great except when the window is smaller then the actual site. If I resize my window so that the horizontal scrollbar appears, as if I had a 15" monitor, the background image does not go all the way to the edge. Instead it is only the width of the browser window, although the content of that box displays fine. Anyone know how to fix that? whats wrong with this? body { font-family:arial; font-color:#000000; background:url(background/bg.jpg); } its the background bit that isnt working it works when the css is included on the page but when i put it on a seperate stylesheet it hasnt worked someone know how to make a web with background like this... http://netcodigo.webinfo.es/ I tried, but I can't do it. pd: Sorry for my bad english. Hi, I'm building a website for my work and got in a little trouble. I do not know if it is just the browser or the code. I'm new to this CSS and HTML so i'm not 100% sure. I needed my background fixed which i had done, and on my home computer the main stuff on my page just floats above the background. On my work computer the main information is when you scroll down, after the background image. I'm confsued and wondering if anyone could help, thanks. Here is also a link to the page so you can see what the problem is, http://www24.brinkster.com/mattphat/ymca2.html Code: <html> <head> <TITLE>Northwest Connecticut YMCA | We build strong kids, strong families, strong communities.</TITLE> <style type="text/css"> html {height:100%;}body {height:100%; margin:0; padding:0;} #bg {position:fixed; top:0; left:0; width:100%; height:100%;} #content {position:relative; z-index:1;} </style> <!--[if IE 6]> <style type="text/css"> html { overflow-y: hidden; } body { overflow-y: auto; } #bg { position:absolute; z-index:-1; } #content { position:static; } </style> <![endif]--> </head> <body> <! --- --- BACKGROUND IMAGE --- ---> <div id="bg"> <img src="YMCA/graudal1.jpg" width="100%" height="100%"> </div> <! --- --- DONE BACKGROUND IMAGE --- ---> <! --- --- MAIN PAGE BORDER--- ---> <div id="content"> <div align="center"> <table width="727" border="1" color="#736F6E" cellspacing="0" cellpadding="0"> <! --- --- DONE MAIN PAGE BORDER--- ---> <!--- --- MAIN PAGE POSITION STAY --- ---> <td align="left" valign="top" bgcolor="#FFFFFF"> </td> <td rowspan="2" align="left" valign="middle" background="" bgcolor="#000000"> <form id="search" name="search" method="get" action="search_results.asp"> <table width="383" border="0" cellspacing="0" cellpadding="0"> <!--- --- DONE MAIN PAGE POSITION STAY --- ---> <!--- --- NWCTYMCA LOGO --- ---> <td align="left" valign="top" bgcolor="#FFFFFF"> <img src="YMCA/NWLOGO2.JPG" width="727" height="289" border="none" usemap="#Map"> </td> <tr> <td colspan="2" bgcolor="#FFFFFF"> </td> </tr> <!--- --- DONE NWCTYMCA LOGO --- ---> <!--- --- BARS ABOVE LINKS --- ---> <!--- BLACK BAR ---> <tr> <td colspan="2"> <img src="images/clear_spacer.gif" width="727" height="0"> </td> </tr> <!--- RED BAR ---> <tr align="left" bgcolor="#A93333"> <td colspan="2"> <img src="images/clear_spacer.gif" width="727" height="0"> </td> </tr> <!--- STRONG KIDS BAR ---> <tr align="center" bgcolor="#FFFFFF"> <td colspan="2"> <img src="http://www.ymcadc.org/PublishingImages/webuild_tagline.gif" width="360" height="15"> </tr> </td> <!--- --- DONE BARS ABOVE LINKS --- ---> <!--- --- LINKS --- ---> <tr bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0"> <td colspan="2"> <div align="left"> <img src="ymca/miniY.jpg"></img> <!-HOME-> <a href="http://www24.brinkster.com/mattphat/YMCA2.html" ONMOUSEOVER=rollover.src="YMCA/homelink2.jpg" ONMOUSEOUT=rollover.src="YMCA/homelink.jpg"> <img src="YMCA/homelink.jpg" name="rollover" width="89" height="28" border="0"></a> <img src="images/nav_line.gif" width="1" height="25"> <!-TORRINGTON-> <a href="http://www24.brinkster.com/mattphat/ymcatorrington.html" ONMOUSEOVER=rollover2.src="YMCA/Torringtonlink2.jpg" ONMOUSEOUT=rollover2.src="YMCA/Torringtonlink.jpg"> <img src="YMCA/torringtonlink.jpg" name="rollover2" width="140" height="28" border="0"></a> <img src="images/nav_line.gif" width="1" height="25"> <!-WINSTED-> <a href="http://www24.brinkster.com/mattphat/ymcawinsted.html" ONMOUSEOVER=rollover3.src="YMCA/winstedlink2.jpg" ONMOUSEOUT=rollover3.src="YMCA/winstedlink.jpg"> <img src="ymca/winstedlink.jpg" name="rollover3" width="109" height="28" border="0"></a> <img src="images/nav_line.gif" width="1" height="25"> <!-CANNAN-> <a href="http://www24.brinkster.com/mattphat/ymcacannan.html" ONMOUSEOVER=rollover4.src="YMCA/cannanlink2.jpg" ONMOUSEOUT=rollover4.src="YMCA/cannanlink.jpg"> <img src="ymca/cannanlink.jpg" name="rollover4" width="93" height="28" border="0"></a> <img src="images/nav_line.gif" width="1" height="25"> <!-GIVING-> <a href="http://www24.brinkster.com/mattphat/ymcagiving.html" ONMOUSEOVER=rollover5.src="YMCA/givinglink2.jpg" ONMOUSEOUT=rollover5.src="YMCA/givinglink.jpg"> <img src="ymca/givinglink.jpg" name="rollover5" width="86" height="28" border="0"></a> <img src="images/nav_line.gif" width="1" height="25"> <!-ABOUT US-> <a href="http://www24.brinkster.com/mattphat/ymcaaboutus.html" ONMOUSEOVER=rollover6.src="YMCA/aboutuslinks2.jpg" ONMOUSEOUT=rollover6.src="YMCA/aboutuslinks.jpg"> <img src="ymca/aboutuslinks.jpg" name="rollover6" width="104" height="28" border="0"></a> <img src="ymca/miniY.jpg"></img> </div> </td> </tr> <!--- --- DONE LINKS --- ---> <!--- --- BOTTOM RED BAR --- ---> <tr align="left" valign="top" bgcolor="#A93333"> <td colspan="2"> <img src="images/clear_spacer.gif" width="727" height="3"> </td> </tr> <!--- --- DONE BOTTOM RED BAR --- ---> <!--- --- BODY TEXT SECTION --- ---> <td align="left" valign="top" bgcolor="#FFFFFF"> <center> <P>YMCA YMCA YMCA YMCA YMCA YMCA <P>YMCA YMCA YMCA YMCA YMCA YMCA <P><s>FIX BACKGROUND *DONE*</s> <P>NEW STRONG KDIS .GIF <P><s>TOP BAR LINK IMAGES *DONE*</s> <P><s>NEW LOGO / HEADER BAR *DONE*</s> <P>SEE ABOUT NEW COLORS FOR LINK ROLLOVERS <P>LEFT SIDE LINKS FOR EACH PAGE <P>COPYRIGHT INFO AND REGULAR LINKS AT BOTTOM OF PAGE <P>YMCA YMCA YMCA YMCA YMCA YMCA <P>YMCA YMCA YMCA YMCA YMCA YMCA </center> <br> <br> <center> <a href="">Home</a> | <a href="">Torrington</a> | <a href="">Winsted</a> | <a href="">Cannan</a> | <a href="">Giving</a> | <a href="">About Us</a> <br> 2009 Northwest Connecticut YMCA. <br> The YMCA is a 501(c)(3) not-for-profit social services organization dedicated to <br> building strong kids, strong families and strong communities. </center> <!--- --- DONE BODY TEXT SECTION --- ---> </div> </body> </html> Hi all. I'm having a small but very annoying problem with my new design. I'm using backgrounds for my divs but somehow Internet Explorer manages to push them one pixel upwards and to the left. I can't find out why and after trying things for three hours I don't know what to try anymore. In both Firefox and Opera it works fine! Here is a screenshot where you can clearly see what goes wrong. The one on the top is Internet Explorer, the one on the bottom is made in Firefox and is how it is supposed to be. URL Site: URL CSS: URL I also found out that the footer of my page doesn't go to the bottom correctly in Opera. If anybody knows how what the problem is there and how to fix it I will be the happiest person on earth Thx in advance. Greetings, Sjoerd Is it just IE that using a gif as a background url not work... or is that one of the standards.. I know jpgs work.. but why not gifs? |