How to define the select border color
Solution :
After learning the usage of clip and margin attributes, you can easily obtain the answer based on their characteristics.
Procedure :
1. Use the margin attribute. First, set the margin attribute to-2 to hide the original border of the select object, and then set the border of the parent object of the select object.
<Span style = "border: 1px solid #333333; width: 80">
<Select style = "margin:-2; width: 84; Background: # eeeeee">
<Option value = "1"> 1 </option>
<Option value = "2"> 2 </option>
<Option value = "3"> 3 </option>
<Option value = "4"> 4 </option>
<Option value = "5"> 5 </option>
</SELECT>
</Span>
2. The margin attribute is implemented in combination with the clip attribute. It also uses margin to hide the original border of the SELECT statement, and clip to control the visible area of the SELECT statement to completely hide the original border of the SELECT statement, finally, the border of the select parent object is defined as the border of the select object.
<Span style = "position: absolute; Border: 1px solid #333333;
Width: 80; Height: 20 ">
<Select style = "position: absolute; clip: rect (2 80 20 2); margin:-2;
Width: 84; Background: # eeeeee ">
<Option value = "1"> 1 </option>
<Option value = "2"> 2 </option>
<Option value = "3"> 3 </option>
<Option value = "4"> 4 </option>
<Option value = "5"> 5 </option>
</SELECT>
</Span>
Note: In method 2, the position attribute of the span and select elements must be set to absolute.
Note
Two sections in this exampleCodeThe running results of 2.1.6.6 and 2.1.6.7 are shown respectively. By careful comparison, we can find some minor differences.
Figure 2.1.6.6 define select border effect 1
Figure 2.1.6.7 define the select border effect 2
Note that this example mainly applies the clip and margint attributes. Because of the special nature of the select control, it is impossible to directly define its border style. Therefore, you must master the skills used in this example.