Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Stretched background gradient  (Read 6216 times)

0 Members and 1 Guest are viewing this topic.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Stretched background gradient
« on: October 17, 2009, 12:30:02 PM »
A customer of mine wants a gradient background moving from one color to another color for a background.
I have done this before, but I can't remember how. I am in Kompozer, so my "extra special" tools are limited (I like Kompozer more than Dreamweaver anyways... it's Web Expressions that I miss).

Anyways, what are my options when it comes to creating something like this?

(I haven't been keeping my web design in practice very well lately)

Best,
Jesse Zylstra

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: Stretched background gradient
« Reply #1 on: October 17, 2009, 12:35:46 PM »
For an image, use Paint.NET and select the two colours you want - one for top and one for bottom.
Next, use CSS to set the background image URL and the background-repeat to repeat-x. Then set the BG colour to the bottom gradient colour.

You might also be able to use JS. PHP can also do it I think.
JS: http://slayeroffice.com/code/gradient/

Kip



    Apprentice

    Thanked: 21
    • Yes
    • Yes
    • Yes
  • Experience: Experienced
  • OS: Linux variant
Re: Stretched background gradient
« Reply #2 on: October 17, 2009, 01:02:32 PM »
It probably does not matter much but I would you CSS instead of JavaScript because some people, including me, browse with JavaScript disabled by default.

To add a background using CSS in Kompozer...
1)  Go to "Format" in the menu bar and click "Page Colors and Background".
2)  Click "Advanced Edit" and go to the "Inline Style" tab.
3)  In the attribute field, type "background" and in the "Value" field, type "url('background_image.png') repeat-x".

In the value, "background_image.png" should be replaced with the image you choose and "repeat-x" will tile the image horizontally.

More information on the background attribute can be found here.
Happiness is not getting what you want, it is wanting what you get.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: Stretched background gradient
« Reply #3 on: October 17, 2009, 01:09:48 PM »
Quote
In the value, "background_image.png" should be replaced with the image you choose and "repeat-x" will tile the image horizontally.
And also, be sure to create the background image so it's only about 5 px wide to minimize loading time.