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

Is there a way to color the background panel of the select element that uses the option tag with it ?

I want to colour the background panel when i click on the the select button in my mark up.

Steven Parker
Steven Parker
229,670 Points

Is this part of a workspace? If so, you can make a snapshot of your workspace and post the link to it here.

6 Answers

Steven Parker
Steven Parker
229,670 Points

Without seeing your code I can only be generic, but you can probably just add a background-color property to your select element. For example:

select { background-color: yellow; }

Please post or share a link to your code if you need more specific assistance.

no I am in the FEWD program to get a certification .. this is just one of the projects I am working on and I want to try to add that to my project , but I don't know how. I will post the css. and html

``css

select[name^="stat"] { -webkit-appearance: none; margin-top: 20px; margin-bottom: 10px; background-color: rgb(114, 155, 130); border: none; border: 1px solid rgb(114, 155, 130); padding: 2px 15px; color: #fff; letter-spacing: .01em; font-size: 0.875rem; }

    select[name^="stat"]:hover {
        background-color: rgb(87,142, 140);
    }
   For the select button in my mark up.
 select[name^="stat"] {
           -webkit-appearance: none;
           margin-top: 20px;
           margin-bottom: 10px;
           background-color: rgb(114, 155, 130);
           border: none;
           border: 1px solid rgb(114, 155, 130);
           padding: 2px 15px;
           color: #fff;
           letter-spacing: .01em;
           font-size: 0.875rem;
         }

        select[name^="stat"]:hover {
            background-color: rgb(87,142, 140);
        }

    ```css
<!DOCTYPE html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>THE CODE REVIEW</title>
<link rel="stylesheet" href="css/normalize.css"/>
<link rel="stylesheet" href="css/grey_Poupon.css"/>

</head>

<body> 

<div id="wrap">

<header class="main-header">
<h1 class="title">The Code Review</h1>

 <div class="main-head-info, clearfix" >
 <h3 class="sub-title">Signup for our newsletter</h3>

 <p>Get the latest news on how your code is doing in your inbox</p>

 </div>
 </header>

 <div class="contains-1">

    <h3 class="sub-title" id="con-info">Contact Information</h3>
  <label for="fullname" class="lab">Full Name</label>
 <input type="text" id="fullname" name="fullname" placeholder="absolutely" required="required"/>

    <label for="email"  class="lab" >Email Address</label>
 <input type="text" id="email" name="email" placeholder="absolutely" required="required"/>

   <label for="phone" class="lab">Phone</label>
   <input type="text" id="phone" name="phone" placeholder="absolutely" required="required"/>

    <fieldset id="mailfield">
   <legend>Mailing Info</legend>
   <label for="address" class="lab">Street Address</label>
   <input type="text" id="address" name="address" placeholder="optional" required="required" class="data"/>

   <label for="city" class="lab">City</label>
   <input type="text" id="city" name="City" placeholder="optional" required="required" class="data"/>


   <select name="states">
   <option value="choose state">Choose State</option>
   <option value="new york">New York</option>
   <option value="new jersey">New Jersey</option>
   </select>  


    <label for="zip" class="zip">Zip Code</label>
    <input type="text" id="zip" name="zip" placeholder="optional" required="required"/> 
     </fieldset>


    </div>

     <div class="contains-2, clearfix">


   <h3 class="sub-title" id="sub-2">Newsletter</h3>

   <fieldset id="field-2">
         <legend>Select the newsletters you would like to recieve</legend>
   <label for="html" id="star" class="ch">HTML News</label>
   <input type="checkbox" id="html" name="html"/>


     <label for="css" class="ch">CSS News</label>
  <input type="checkbox" id="css" name="css"/>

   <label for="js" class="ch">Javascript News</label>
  <input type="checkbox" id="js" name="js"/>

  </fieldset>

  <h5 class="check-ops">Newsletter format</h5>

            <div id="buttons">
            <label for="htmlrad">HTML</label>
           <input type="radio" id="htmlrad" name="radio"/>
            <label for="plainrad">Plain Text</label>
         <input type="radio" id="plainrad" name="radio"/>

             </div>

             <div id="codeSnip">

             <label for="code">Code Snippet</label>
             <p id="codep">Enter a code snippet if you wish for it to be evaluated</p>
             <textarea name="snippet" id="code"  cols="45"  rows="8"></textarea>
             <input type="button" id="cancel" name="cancel" value="Cancel"/>
               <input type="button" id="enter" name="enter" value="Enter"/>

             </div>
 </div>

   <footer class="main-footer">

   <p>Other topics you'd like to hear about</p>


    <textarea name="user-con" id="user-con" cols="45" rows="8"></textarea>

  <input type="submit" name="submit" id="submit" value="Sign Up"/>

        <h5 class="copyright">&copy; The Code Review</h5>

    </footer>


</div>
</body>
</html>

        ```html

here is a link to my gitHub instead ..... https://github.com/varlerang/online_Reg_4orm.git