Friday, June 17, 2011

Styling the Button Element with CSS Sliding Doors - now with Image Sprites and IE 8 Support

Examples

The buttons shown use the same markup and style — only the label text is different.
View in a new window

Sprite image

The background sprite contains four images: each button has a left and right "door," and each door has two states, default and hover. Update 4/27/09: Our example button now references a single sprite image for both doors and their hover states as shown (thanks to Louis Walch for the update!):
Button sprite
We recommend adding at least 20px vertical space between the stacked states to prevent one state from appearing when it should be hidden. (We could add "overflow: hidden" to the button rule instead, but doing so would mean that we'd have to reinstate conditional styles for IE, which requires that the overflow property be visible — otherwise you may see extra right and left padding in IE. We figure this is a reasonable workaround to avoid having to maintain separate style blocks.)

Markup

Button markup consists of a button tag around a span tag, and label text is written into the span. Both tags are necessary to support the sliding door background images: the button tag's background image is shorter with right corners, and the span's background image is larger with left corners. We found in our tests that the right image should be at least as wide as it is tall to avoid gaps between the doors.
And last but not least, we assigned a class to the button element to apply our design; in this case, "submitBtn." Styles for the span tag are assigned with descendant selectors.

CSS

/* REQUIRED BUTTON STYLES: */  
button { 
 position: relative;
 border: 0; 
 padding: 0;
 cursor: pointer;
 overflow: visible; /* removes extra side padding in IE */
}

button::-moz-focus-inner {
 border: none;  /* overrides extra padding in Firefox */
}

button span { 
 position: relative;
 display: block; 
 white-space: nowrap; 
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
 /* Safari and Google Chrome only - fix margins */
 button span {
  margin-top: -1px;
 }
}


/* OPTIONAL BUTTON STYLES for applying custom look and feel: */  
button.submitBtn { 
 padding: 0 15px 0 0; 
 margin-right:5px; 
 font-size:2em; 
 text-align: center; 
 background: transparent url(images/btn_blue_sprite.gif) no-repeat right -140px; 
}
 
button.submitBtn span {
 padding: 13px 0 0 15px; 
 height:37px; 
 background: transparent url(images/btn_blue_sprite.gif) no-repeat left top; 
 color:#fff; 
}
 
button.submitBtn:hover, button.submitBtnHover { /* the redundant class is used to apply the hover state with a script */
 background-position: right -210px; 
}
 
button.submitBtn:hover span, button.submitBtnHover span {
 background-position: 0 -70px;
}

Supported Browsers

So far it works in:
  • IE 6+
  • Firefox 1.5+
  • Opera 8+
  • Safari 3+
  • Chrome 1.0
Update 4/27/09: The button styles now work in Chrome — thanks again, Louis!

Caveats

IE 6 does not support the ":hover" pseudoclass on elements other than anchor tags. To get the hover to work in IE6, create a class that duplicates the :hover styles, and then script a function to toggle that class on/off like the one below written with jQuery:

Monday, April 25, 2011

CSS Editor - Cascading style sheet editor

With Rapid CSS Editor you can quickly and easily create and edit cascading style sheets of any size and complexity. You can write the style sheet code manually or let the program do it for you. In each case it is easy because of the many helpful features, including auto complete, code inspector and CSS checker. Results are shown instantly with the built-in preview. Rapid CSS Editor is designed to save you time and make your job easier.

Rapid CSS Editor Key Features

  • Advanced, fully customizable text editor
  • HTML and XHTML editing features
  • Syntax Highlighting for CSS and HTML documents
  • CSS Checker and Validator More info
  • CSS Code Explorer More info
  • Code Inspector More info
  • Code Auto Complete for CSS and HTML More info
  • Instant Style Sheet Preview with Internet Explorer or FireFox
  • X-Ray for HTML preview More info
  • Compliance with CSS standards and various browsers
  • Integration with W3C CSS and HTML validators
  • Built-in CSS Reference
  • CSS Code Formatter and Beautifier
  • CSS Code Compressor
  • Search and Replace with Regular Expression support
  • Search and Replace in files More info
  • Multi Item Clipboard More info
  • Built-in File Explorer
  • Save and open files directly from FTP
  • Project and site management and FTP publishing
  • Fully customizable interface
  • Integration with CSE HTML and CSS Validator
  • Code collapse
Download Rapid CSS Editor Now
If you need something more than a cascading style sheet editor with some HTML support, you might be interested in our full scale HTML and CSS editor HTMLPad 2010 Pro.

URL: http://www.blumentals.net/rapidcss/?refid=cssexit

Saturday, February 26, 2011

CSS Drop down Script...

<script>

// Javascript originally by Patrick Griffiths and Dan Webb.

// http://htmldog.com/articles/suckerfish/dropdowns/

sfHover = function() {

var sfEls = document.getElementById("navbar").getElementsByTagName("li");

for (var i=0; i<sfEls.length; i++) {

sfEls[i].onmouseover=function() {

this.className+=" hover";

}

sfEls[i].onmouseout=function() {

this.className=this.className.replace(new RegExp(" hover\\b"), "");

}

}

}

if (window.attachEvent) window.attachEvent("onload", sfHover);

</script>

Tuesday, February 1, 2011

Linkup through OnClick

onclick="location.href='index_plans.html'"

Wednesday, January 26, 2011

parameshrag@gmail.com is inviting you to jeetle.in

Congratulations!!

You have been referred by your friend to join Jeetle, India’s leading auction portal.

With JeetLe you can get the latest mobile phones, laptops, digital camera’s and many more latest products in just a few Rupees.

Use this promotional code to avail 300 bid points to start bidding on JeetLe: j4PfAeAeAqwW

Click the following link to get started:http://www.jeetle.in/cms/refer/113982

Happy Bidding

Paramesh

Tuesday, December 7, 2010

jQuery Effect code ( for Menu easeOutBounce and image fade effect )

$(document).ready(function(){ 
$('.home').mouseover(function(){ 
$('.fan1').stop().animate({"bottom": "-150px"},{queue:false, duration:850, easing: 'easeOutBounce'});                    }) 
$('.home').mouseout(function(){ 
$('.fan1').stop().animate({"bottom": "40px"},{queue:false, duration:350});                    }) 
$('.work').mouseover(function(){ 
$('.fan2').stop().animate({"bottom": "-150px"},{queue:false, duration:850, easing: 'easeOutBounce'});                    }) 
$('.work').mouseout(function(){ 
$('.fan2').stop().animate({"bottom": "40px"},{queue:false, duration:350});                    }) 
$('.about').mouseover(function(){ 
$('.fan3').stop().animate({"bottom": "-150px"},{queue:false, duration:850, easing: 'easeOutBounce'});                    }) 
$('.about').mouseout(function(){ 
$('.fan3').stop().animate({"bottom": "40px"},{queue:false, duration:350});                    }) 
$('.contact').mouseover(function(){ 
$('.fan4').stop().animate({"bottom": "-150px"},{queue:false, duration:850, easing: 'easeOutBounce'});                    }) 
$('.contact').mouseout(function(){ 
$('.fan4').stop().animate({"bottom": "40px"},{queue:false, duration:350});                    }) 
 
 
$("img.b").mouseover(function(){ 
$(this).stop().animate({"opacity": "0"}, "slow");                     }); 
$("img.b").mouseout(function(){ 
$(this).stop().animate({"opacity": "1"}, "slow");                     });                     });    

Friday, October 15, 2010

Check out my photos!

Hi,

I set up a profile where I can post photos, connect and share.

Do me a favor and confirm our relationship here.


Thanks,
Paramesh Ragala
This message was intended for parameshrag.getwebinfo@blogger.com and was sent as a notification, invitation or reminder (digital goods subject to change in reminders) of an event initiated by Paramesh Ragala using a third-party or platform application and may contain promotional materials and/or services for sale including digital goods received.

To control messages sent to or from you, your contacts and/or FanBox, click here.
Our offices are located at: FanBox - 255 G Street, Ste 723, San Diego, CA 92101