treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How to style form tags completely?

  • Anyone know any efficient way how to style from <select> tags? I mean completely: add background image and style <option> values? I'm looking for cross browser technique. Maybe anyone did it and can share the knowledge?
  • It can't be done with css alone. Check out this jQuery plugin http://www.scottdarby.com/2009/05/jquery-plugin-stylish-select-unobstrusive-select-box-replacement/
  • Thanks! I will try to use it right now :)
  • "apostrophe" said:
    It can't be done with css alone. Check out this jQuery plugin http://www.scottdarby.com/2009/05/jquery-plugin-stylish-select-unobstrusive-select-box-replacement/


    It is wokring fine on Firefox, but it's buggy in IE6, IE7. Maybe I'm doing something wrong?

    [attachment=0]wrong.jpg[/attachment]

    The css of this select:


    ul.newList {margin:0; padding:0; list-style:none; color:#666; width:160px; background:#feffff; position:absolute; display:none; border:1px solid #666; top:22px; left:0; overflow:auto; z-index:9999;}
    .newListSelected {width:150px; color:#666; height:18px; padding:4px 0 0 12px; float:left; background:url(images/search-select-bg.gif) no-repeat; outline:none;}
    .newListSelected span {width:162px; display:block;}
    ul.newList li {padding:3px 12px;}
    .selectedTxt {width:127px; overflow:hidden; height:16px; padding:0 23px 0 0;}
    .hiLite {background:#23788B!important; color:#feffff!important;}
    .newListHover {background:#ccc!important; color:#000!important; cursor:default;}
    .newListSelHover {cursor:default;}
    .newListOptionTitle {font-weight:bold;}
    .newListOptionTitle ul {margin:3px 0 0;}
    .newListOptionTitle li {font-weight:normal; border-left:1px solid #666;}


    The link: LINK DELETED
  • After testing like 6 other jquery plugins I came back to this one. The whole thing about ie's was the z-index property..
  • So it's working now? I confess I've never used the plugin. When it comes to forms, if it can't be done with css alone then I don't bother. I'd rather lose a little style and keep the functionality and accessibility.
    If you can't solve the z-index issue I would suggest contacting the plugin author who claims that it works in all browsers from ie6 up.
  • Yes it is working right now. Thanks for nice plugin link :)