Link to home
Start Free TrialLog in
Avatar of mohan21_kumar
mohan21_kumar

asked on

How to add Stylesheets to the select tag (combo box) in html

Hi,

  I'm using the following code to add the styles to the combo box but it is not getting reflected suggest me how to add the styles to the combo boc

The code which i have used is as follows :

<html>

<style type="text/css">

cmbBox {
background-color: navy;
border: black 2px solid;
color: 00000;
font-family: arial, verdana, ms sans serif;
font-size: 18pt;
font-weight: normal
}

</style>

then..
<body>
<select class="cmbBox">

<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>

    </select>

</body>
</html>

But in the above code the style is not getting reflected

Suggest me how to add the style to the combo or give me some sample examples which would meet my requirements

Thanx
Avatar of edkim80
edkim80

if you are using <select class="cmbBox"> your style should be of the form element.class i.e.

select.cmbBox {
etc etc.
}

Regards,
Ed
Note the '.' in front of cmbBox:

.cmbBox {
background-color: navy;
border: black 2px solid;
color: 00000;
font-family: arial, verdana, ms sans serif;
font-size: 18pt;
font-weight: normal
}

neill
Avatar of mohan21_kumar

ASKER

after adding . to the style i'm able to get the style to the combo box but the border style is not getting suggest me how to add the style to the borders of the combo box

Code is as follows :

<html>

<style type="text/css">

.cmbBox {
background-color: white;
border: 10px solid;
BORDER-RIGHT: #000099 2px solid;
BORDER-TOP: #000099 2px solid;
BORDER-LEFT: #000099 2px solid;
BORDER-BOTTOM: #000099 2px solid;
color: 00000;
font-family: arial, verdana, ms sans serif;
font-size: 12pt;
font-weight: normal
}

</style>

then..
<body>
<select class="cmbBox">

<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>

    </select>

</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of nwalex
nwalex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial