Dreevoo.com | Online Learning and Knowledge Sharing
 
Home | Programs | Programming languages | HTML | A fake gradient website background with CSS
Guest
Click to view your profile
Topics
Programs
Languages
Recipes
Home
Shortcuts
 
 

A fake gradient website background with CSS

You will learn how simple it is to apply a gradient background created using Photoshop or Gimp to a website using CSS.

 
  Author: mat | Version: | 21st August 2013 |  
 
 
1.
 

Using your favorite web code editor such as Notepad++ or Adobe Dreamweaver, create a new style.css document and enter/paste the following code:

body{
    background: url('gradient_background.jpg');
    background-size: 100% 100%;
    background-attachment: fixed;
}


Where gradient_background.jpg is an image you want to use for a gradient background.

To create your own gradient background image I recommend one of these two tutorials:




 
 
2.
 

In the index.html document enter the following code before the </head> tag:

<link rel="stylesheet" href="styles.css" />

Make sure you save the index.html, styles.css and your background image in the same folder on your web server, otherwise you will need to change the paths in the code.

Also recommended:


 
 
3.
 

Click to see or download my fake gradient background web page and you can also download the styles.css file from this tuts.

In case of any questions or to let me now it worked or didn't work for you simply drop me a comment.

 
 
 
   
  Please login to post a comment
   
 
 
online learning made for people
Dreevoo.com | CONTRIBUTE | FORUM | INFO