Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Gabriel Ward
Gabriel Ward
20,222 Points

Styling the arrow on a select element

I'm trying to style the arrow on a select element. I'm using the background-image property. I have no idea where I'm going wrong here, I've looked at this code form multiple angles. Any help would be greatly appreciated.

<div class='advancedSearchOptions'>
        <h3>Advanced Search Options</h3>
        <p>Look for my search in</p>
        <select class='advancedSearchScope' name='advancedSearch[text_type]'>
            <option value>Section</option>
            <option value='Audio'>Audio</option>
            <option value='Publications'>Publications</option>
            <option value='Maps'>Maps</option>
            <option value='Images'>Images</option>
        </select>
    </div>
select {
    width: 100%;
    -webkit-appearance: none;  
        -moz-appearance: none; 
    appearance: none;
    background-image: url("../img/pointer.png") 97% no-repeat right ;
    border-radius: 0;
    line-height: 2;
    padding: 0.5em;
}

1 Answer

Hi Gabriel,

I would try to use the class you have corresponding that specific div. Looks something like this:

.advancedSearchOptions {
    width: 100%;
    -webkit-appearance: none;  
        -moz-appearance: none; 
    appearance: none;
    background-image: url("../img/pointer.png") 97% no-repeat right ;
    border-radius: 0;
    line-height: 2;
    padding: 0.5em;
}

Let me know if that works.

Gabriel Ward
Gabriel Ward
20,222 Points

Hi Victor,

Sadly, it doesn't work.

Make sure that your targeting the right directory were the image is kept. You can look for some good examples of dropdown at codepen.io. This is one that I found in which she created the shapes in pure css. you can search for dropdowns.

http://codepen.io/Dianatomic/pen/HqICG