Jan 15 2008

HTML select with background (image or icon next to text)

Category: CSS, Designpaomic @ 9:28 pm

I’ve found out a nice article on how to place an icon or image next to a select option. This is the sample css:
<select name=”issuetype” id=”issuetype”>
<option value=”1″ class=”imagebacked” style=”background-image: url(/images/icons/bug.gif);” selected>
Bug
</option>
<option value=”2″ class=”imagebacked” style=”background-image: url(/images/icons/newfeature.gif);”>
New Feature
</option>
<option value=”3″ class=”imagebacked” style=”background-image: url(/images/icons/task.gif);”>
Task
</option>
<option value=”4″ class=”imagebacked” style=”background-image: url(/images/icons/improvement.gif);”>
Improvement
</option>
</select>

option.imagebacked {
padding: 2px 0 2px 20px;
background-repeat: no-repeat;
background-position: 1px 2px;
vertical-align: middle;
}

Here’s an example:

HTML select with background (image or icon next to text)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • description
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Post Tagged:

Leave a Reply