Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Styling form drop down box

Featured Replies

Hi,

 

I use this code to create really tidy forms but I can't work out how to style a drop down selection box (what is the proper name for one of them?). The code I use just ignores the style I try to create and gives me the default browser style.

 

Any advice please:

 

HTML example:

 

<form method="post" action="quoterequest.php"> 
 <fieldset> 
 <legend>Quotation form:</legend> 
      <p> 
     <label for="EmailFrom">Name:</label> 
          <input type="text" name="EmailFrom" class="txt" > 
   </p> 
   <p> 
     <label for="email">Email Address:</label> 
     <input type="text" name="emailaddress" class="txt"> 
   </p> 
   <p> 
     <label for="telephone">Telephone:</label> 
     <input type="text" name="telephone" class="txt"> 
   </p> 
   <p> 
     <label for="marque">Vehicle make:</label> 
     <input type="text" name="marque" class="txt"> 
   </p> 
   <p> 
     <label for="model">Vehicle model:</label> 
     <input type="text" name="model" class="txt"> 
   </p> 
   <p> 
     <label for="year">Year:</label> 
     <input type="text" name="year" class="txt"> 
   </p> 
   <p>
 <label for="fuel">Fueltype:</label>
Petrol
<input type="checkbox" name="petrol" value="Yes"> 
Diesel 
<input type="checkbox" name="diesel" value="No"><br /> 
</p> 

   <p> 
<label for="enquiry">Details of any other work required:</label> 
<textarea name="enquiry"></textarea> 
</p> 
  <br /> 
<p>
 <label for="comments">Preferred contact method:</label>
Please telephone me 
<input type="checkbox" name="contactbyemail" value="Yes"> 
Please email me: 
<input type="checkbox" name="contactbyemail" value="Yes"><br /> 
</p> 
<p></p> 
<p>
<label for="comments">       </label>
<input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p> 
     </fieldset> 
 </form> 

 

And the CSS:

input.txt {

font: bold 0.9em Arial, Helvetica, sans-serif;

color: #3C7ABE;

background-color:#FFFFD2;

border: 1px inset #3C7ABE;

width: 350px;

height: 22px;

}

textarea{

font: bold 0.9em Arial, Helvetica, sans-serif;

color: #3C7ABE;

width: 350px;

height: 120px;

background-color:#FFFFD2;

border: 1px inset #3C7ABE;

}

select{

font: bold 0.9em Arial, Helvetica, sans-serif;

color: #3C7ABE;

width: 350px;

height: 120px;

background-color:#FFFFD2;

border: 1px inset #3C7ABE;

}

form p {

clear: left;

margin: 0;

padding: 0;

padding-top: 8px;

}

form p label {

float: left;

width: 36%;

font: bold 0.9em Arial, Helvetica, sans-serif;

line-height: 18px;

}

fieldset {

border: 1px dotted #61B5CF;

margin-top: 4px;

padding: 4px;

}

legend {

font-family: Arial, Helvetica, sans-serif;

font-size: 1.4em;

font-style: normal;

color:#3C7ABE;

}[code]

You've got a style for select but I can't see any markup for a select box.

 

Do the styles for input and textarea work? They should work.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.