I want to add css3 box shadow for a select box. It works in all browsers except Google chrome. Since I am wrapping form elements by p tags I can’t wrap select tags by div tags (Since div inside p is not allowed in HTML). Is there any other way to apply box shadow for select boxes in Google chrome?
HTML page
<form method="post">
<p>
<label for"option_box"">Title:</label>
<select name="option_box">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</p>
CSS
select {
box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px;
-moz-box-shadow: 0px 0px 8px rgba(0,0,0, 0.1);
-webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px;
}
1) Add following lines to css file
2) Then apply shadow_select class for select tags
This works on all other browsers except webkit. for webkit wrap select using div. Then use jquery to detect focus event on select and apply CSS shadow class to that div. (Because focus event can’t be applied to a div)