Home  >  Article  >  Web Front-end  >  How to Apply Padding to Select Lists in Safari and Internet Explorer?

How to Apply Padding to Select Lists in Safari and Internet Explorer?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-24 08:44:01174browse

How to Apply Padding to Select Lists in Safari and Internet Explorer?

Padding Not Applied to Safari and IE Select Lists

Enhancing the styling of select lists in Safari and Internet Explorer can be challenging due to a lack of support for padding. While the World Wide Web Consortium (W3C) specification allows for padding in select boxes, webkit browsers like Safari and Chrome disregard this feature.

To overcome this issue, an alternative approach is to utilize text-indent in place of padding-left. By adding the same amount to the width of the select box, you can effectively achieve the desired spacing.

Consider the following code:

<select id="sexID" name="user[sex]"
        style="border: 1px solid #C1272D;
               width: 258px; // 243 + 15px
               text-indent: 15px;
               height: 25px;
               color: #808080;">

This example demonstrates how to achieve the desired 15px padding by applying text-indent: 15px and increasing the width of the select box accordingly.

The above is the detailed content of How to Apply Padding to Select Lists in Safari and Internet Explorer?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn