admin管理员组

文章数量:1425799

I was wondering if there is a way to remove the dropdown (<select>) button (the little arrow) from the dropdown menu? I want to create a item list, but without the arrow.

  • Steve

I was wondering if there is a way to remove the dropdown (<select>) button (the little arrow) from the dropdown menu? I want to create a item list, but without the arrow.

  • Steve
Share Improve this question edited Nov 25, 2010 at 3:32 Gabriele Petrioli 196k34 gold badges271 silver badges328 bronze badges asked Nov 25, 2010 at 3:25 StevenSteven 14k35 gold badges102 silver badges155 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 2

You can't do this, especially cross-browser. You can replace the <select> elements entirely with another control, but you can't modify how a <select> renders...not in the way you want at least.

Here are a few examples of replacements.

Perhaps you are looking for something more like this:

<html>
  <body>

  <select size=1>
    <option>Volvo</option>
    <option>Saab</option>
    <option>Mercedes</option>
    <option>Audi</option>
  </select>

  </body>
</html>

This will create a select list of items one item tall. On some browsers there will still be an empty scrollbar, but it will get rid of the drop down arrow. As long as the size of the select tag is set then the arrow will not appear.

There are more options on select lists here: http://www.w3schools./tags/tag_select.asp

this answer from João Cunha is working wonders for me

pure CSS!

I added a bit of code to extend the browser support, see my answer in that question or below:

select {
    /*for firefox*/
    -moz-appearance: none;
    /*for chrome*/
    -webkit-appearance:none;
    text-indent: 0.01px;
    text-overflow: '';
}
/*for IE10*/
select::-ms-expand {
    display: none;
}

Try this code:

select {
   -webkit-appearance: none;
   background-color: #FFF;
   border: medium none;
   color: #555555;
   font-family: inherit;
   outline: medium none;
   overflow: hidden;
   padding: 0;
   text-overflow: ellipsis;
   white-space: nowrap;
   width: 10em;
   height: 1em;
}

itz work for me. Just try it.

本文标签: javascriptRemove dropdown (select) button from dropdown menusStack Overflow