How to define the select border color

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.