Graphic tutorial on button design with Sliding Door Technology

Source: Internet
Author: User

This article is for translation Article , Full text address: http://diger.cn/article.asp? Id = 351
Address: http://www.filamentgroup.com/lab/buttonElement/

Particle tree recently published an article describing a technology that they came up with to design button elements. Table keys are notoriously difficult to customize for unskilled people. A typical solution is to use the default button provided by the browser or use a graphical input. When the Graphic Input completes the requirement result, it requests to create a new graph for each button to use its text "baked-in" (it is not mentioned to exchange it with hovers ).

Although particle tree technology provides a reliable solution, it cannot meet our needs. We need a button that uses the sliding door technology, a real HTML text, and does not need to request JavaScript to roll or submit a table. If these conditions are met, the input and anchor elements are excluded. Obviously, the button element is our only choice. The following technology demonstrates a cross-browser button technology using the sliding door technology.

View demo

Tags:CopyCodeThe Code is as follows: <button value = "Submit" class = "submitbtn"> <span> submit </span> </button>

CSS:

ProgramCodeCopy codeThe Code is as follows: button {
Border: 0;
Cursor: pointer;
Font-weight: bold;
Padding: 0 20px 0 0;
Text-align: center;
}
Button span {
Position: relative;
Display: block;
White-space: nowrap;
Padding: 0 0 0 20px;
}
/* Blue buttons */
Button. submitbtn {
Background: URL (images/btn_blue_right.gif) right no-Repeat;
Font-size: 1.3em;
}
Button. submitbtn span {
Height: 50px;
Line-Height: 50px;
Background: URL (images/btn_blue_left.gif) left no-Repeat;
Color: # FFF;
}
Button. submitbtn: hover {
Background: URL (images/btn_blue_right_hover.gif) right no-Repeat;
}
Button. submitbtn: hover span {
Background: URL (images/btn_blue_left_hover.gif) left no-Repeat;
}

CSS for IE6 and IE7 (sometimes required)

Copy code The Code is as follows: button {
Width: auto;
Overflow: visible;
}
Button span {
Margin-top: 1px;
}

As you can see, each status uses two images (a total of four images ). To further simplify the process, you can convert these statuses to two. However, the initial test of this idea showed inconsistent results.



Browser support:
IE6, IE7, Firefox (MAC/PC), Safari, opera, Camino, etc.

Warning to make hover valid in IE6, you will need to write a class trigger. Although it is not as bad as picture exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.