How To Style select menu in HTML using jquery


Today, when I was surfing net, I found this very interesting topic – How To Style Dropdown in HTML. Since in HTML the dropdown is the SELECT tag and its rendering depends on both OS and the browser of client. Though you can change its font, font-size, width, height like basic CSS properties but what if you want to change the whole look and feel of the dropdown. For example, the down arrow that comes along with the dropdown or the background colour of the options list when mouse is hovered through them.

So I decided to try and do this using jQuery and CSS and finally came with this small jQuery plugin selectify that can help in styling dropdown menus. Its very simple in use and when used with a small javascript code …

Javascript

1
2
3
4
5
	jQuery( function( $ ) {
		$( '#myDropdown' ).selectify({
			arrowSymbol : '▼'
		});
	});

… and customized CSS …

CSS

1
2
3
4
5
6
7
8
	ul.uploadifyDropdown{padding:0;float:left;width;position:relative;background:#eee}
	ul.uploadifyDropdown li[name=selected]{border:1px solid #ccc;cursor:default;padding:2px;-moz-border-radius:2px;border-radius:2px;webkit-border-radius:2px;background:#eee}
	ul.uploadifyDropdown li[name=selected] span.selectText{padding:2px 4px;}
	ul.uploadifyDropdown li[name=selected] a.changeValue{text-decoration:underline;color:#000;float:right;border-left:1px solid #ddd;padding:2px 4px;}
	ul.uploadifyDropdown li.generated{border-right:1px solid #ddd;padding:2px 4px;border-left:1px solid #ddd;}
	ul.uploadifyDropdown li.generated:last-child{border-bottom:1px solid #ddd;-moz-border-radius:2px;border-radius:2px;webkit-border-radius:2px}
	ul.uploadifyDropdown li.generated:hover{color:#eee;background:#39f}
	ul.uploadifyDropdown li[name=selected] a.changeValue:focus{outline:0}

… the trick worked out pretty well.

Check out the Demo
Thanks for sparing time with me hope you liked the work done by me. Keep visiting and help in keeping web developing and growing. Kudos for now …

Recently Published

»

Why is Link Building So Important? Read this to understand

Getting a high ranking on search engine results is important to the ...

»

Productivity Tips for Web Developers for Efficient Time Management

The world is full of distractions. Whether you are a work-from-home, ...

»

The Importance of a Good Domain Name

The right domain name can genuinely make or break a business – ...

»

Cloud Strategy of Oracle: Working or Not?

Though Oracle considered cloud strategy as gibberish long before, it ...

»

Some Excellent SEO Tools for Boosting SEO Rankings like Never Before

You could be having a really great-looking website and the niftiest ...

»

How to Promote Your Business by Collecting Instagram Followers – Part 2

Promoting business is not an easy task these days with so many ...

»

Using Instagram to Optimize Your Business – Unfolding the Tricks – Part 1

Instagram is one of the most popular social networking communities ...

»

6 Mobile UX Design Techniques that work

In software development, be it a mobile app or a website, creating ...

»

Importance of website design in online branding

“A brand for a company is like a reputation for a person. You earn ...