Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Does anyone know how to apply a gradient... (Read 3129 times)
Citron
New Member
*
Offline


I Love YaBB 2!

Posts: 22
Joined: Dec 17th, 2010
Does anyone know how to apply a gradient...
Dec 20th, 2010 at 8:42pm
Print Post  
to the background? I went to http://gradcolor.com/ and after designing my gradient, it gave me 2 files, a .png and html code which I have zipped. How and where do I apply these. I know that my background color reside in the css located:

body {
     background-color: #0000CC;
but, if using a .png and new .html, how does that affect it?

Or maybe there is an easier way/tool for doing this.
  

Gradient_Color.zip ( 0 KB | Downloads )
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: Does anyone know how to apply a gradient...
Reply #1 - Dec 20th, 2010 at 9:37pm
Print Post  
If this is the CSS body that you already have:

Code
Select All
body {
     background-color: #0000CC;
} 


Then you just need to add it there:

Code
Select All
body {
     background-color: #0000CC;
     background-image: url(3KQdNt.png);
     background-repeat: repeat-x;
     background-attachment: fixed;
} 


If you've already got a HTML file, you don't need the one that it has supplied you with - it's just an example. If you open it in a text editor, you'll see the CSS in the head section of the file. That's all you need, but you have to adapt it to your own page, like I've shown you above.

Note that this assumes that the .png image is in the same folder as the HTML file. If you place your image outside of that, then you will need the add the path to this bit of code:

Code
Select All
     background-image: url(./your_folder/3KQdNt.png); 



  
Back to top
 
IP Logged
 
Citron
New Member
*
Offline


I Love YaBB 2!

Posts: 22
Joined: Dec 17th, 2010
Re: Does anyone know how to apply a gradient...
Reply #2 - Dec 20th, 2010 at 10:09pm
Print Post  
Okay, it shows up in the background but is only a quarter the size of my page. Do I need to use a height and width html cmd or do I resize the image. I want it to take up the entire page.
  
Back to top
 
IP Logged
 
Citron
New Member
*
Offline


I Love YaBB 2!

Posts: 22
Joined: Dec 17th, 2010
Re: Does anyone know how to apply a gradient...
Reply #3 - Dec 20th, 2010 at 10:21pm
Print Post  
I just resized the image and it worked. Thanks! Gradients are cool! Grin

  
Back to top
 
IP Logged
 
Derek Barnstorm
God Member
*****
Offline



Posts: 1146
Location: Warwickshire
Joined: Mar 23rd, 2008
Gender: Male
Re: Does anyone know how to apply a gradient...
Reply #4 - Dec 20th, 2010 at 10:25pm
Print Post  
Nope, you don't need to set any widths or anything. If you've added that code correctly then it should spread the whole width of the page.

Note that I said 'width' - this bit of code will repeat it horizontally across the whole background:

Code
Select All
background-repeat: repeat-x; 


That image is only 200px high though, so if that's what you mean, then you need a higher image really...

You can open the HTML file that you attached to the first post in your browser to see how it is meant to look - I presume you already did that?

Edited:
Citron wrote on Dec 20th, 2010 at 10:21pm:
I just resized the image and it worked. Thanks! Gradients are cool!

Too quick at posting for me then - glad you sussed it. Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint