Current Affairs

This section takes on the latest happenings. The topics range from macroscopic national and international issues to microscopic issues of society around us.

Entertainment

This part of the spirit lightens you up with poetry,arts and culture, discussions on books, movies, music and video games.

Lifestyle

This section updates you on all latest gadgetry, style statements, games and fashion trends in all dimensions of human life. The aim of this section is to make you “Gaudy and Pompous”

Sports

Regular dose of happenings in the field of sports. Plus history and facts about the games people play.

Tech

Articles that would satisfy the geek in you. Everything from gadgets to software, coding to designing or internet to games. Plus tutorials, faq’s and tips and tricks as well.

Home » Tech

Add Gradient Using HTML (Only Works in IE)

Submitted by Ankit Sabharwal on May 1, 2009 – 12:31 pmNo Comment

gradient1A few days back, a friend asked me how he could add gradient to his site using only html and no other images or external references. We googled it and found one very intrestign way. The only problem is that it uses ActiveX Scripts and so works in IE. I tested it in Firefox and it did not work.

Before you start out remeber always select one light and one dark color for the gradient to display properly.

This powerful HTML code effect can be used to give your web pages a unique look and feel. However, it must be used very cautiously. Please ensure that you select your HTML web page background colors very carefully, as your text must be clearly visible through the background colors you select. In addition, you must select one light color and another color that is several shades lighter in order for this HTML gradient background effect to display properly.

This effect can be used for your entire web page background, or within your table cells.

To use the gradient effect as your web page background, use the following BODY tag:

<body style=”filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr=’#C0CFE2′, startColorstr=’#FFFFFF’, gradientType=’0′);”>

To use the gradient effect within your HTML tables, place the following code within your table tag:

style=”filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr=’#C0CFE2′, startColorstr=’#FFFFFF’, gradientType=’0′);”

Here is some explanation :

endColor and startColor

They have obvious meanings. Just keep in mind that out of these one should be light and one should be relatively darker.

Gradient Type

0 – Vertical Gradient

1 – Horizontal Gradient

2 – Makes the colors dark. (Nothing else happens)

Have fun !!

Edit: In my next post i will talk about another way to add gradient using sliced images that don’t take up much time to load. So keep watching this space :)

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.