HTML
  Home arrow HTML arrow Page 4 - Custom Buttons in HTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Custom Buttons in HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2008-05-07

    Table of Contents:
  • Custom Buttons in HTML
  • Colored Button
  • Colored Button continued
  • Button with Background Image

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Custom Buttons in HTML - Button with Background Image


    (Page 4 of 4 )

    Button with Background Image

    Instead of a background color you can have a background image. To do this, create an image with your drawing tool. Add the following code to the button syntax in your CSS:


    background-image: url(image.gif)


    where you have to replace image.gif with the URL of your image.


    After this you have to decide which colors to use for the borders when the button is not pressed and when it is pressed. When the button is not pressed, the left and top borders take a similar but lighter color to the overall color of the image and the right and bottom borders take a similar but darker color to the overall color of the image. When the button is pressed, the reverse is true. You change these colors using JavaScript as we did above.

    Button with a Gradient Image

    If you have an area of a picture made of lines, and the lines are slowly changing colors as your eye moves from one position to another, that area is a gradient. You must have seen some of these as background in web pages. You can also have that kind of background for your button.

    One way to achieve this is to use your drawing tool to create a gradient, save the result as an image and then use a URL link to put this as the background of your button. The problem here is that pictures take a long time to be downloaded (to appear in the user’s browser).

    The solution is this: if you want a horizontal gradient, create a gradient whose height is that of your button and whose width is 1 pixel, using your drawing tool. Save the image in a directory (folder). Use a URL link to link it as background to your button. Use CSS as shown below, to repeat it all over the required background of your button.

    If you want a vertical gradient, create a gradient whose width is that of the content area of your button and whose height is 1 pixel, using your drawing tool. Save the image in a directory (folder). Use a URL link to link it as background to your button. Use CSS as shown below, to repeat it all over the required background of your web page.


    To repeat a background image horizontally, have code like the following in your CSS.


    button {background-image: url(image.gif); background-repeat: repeat-x}


    To repeat a background image vertically, have code like the following in your CSS.


    button {background-image: url(image.gif); background-repeat: repeat-y}


    Conclusion

    You can create a custom button by modifying the appearance of the Button element. All the properties and events of the button element will still be available.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · It is cool.Chrys
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT