Home  >  Article  >  Web Front-end  >  Why Isn\'t Padding Working in Safari and IE Select Lists?

Why Isn\'t Padding Working in Safari and IE Select Lists?

DDD
DDDOriginal
2024-10-24 08:55:03364browse

Why Isn't Padding Working in Safari and IE Select Lists?

Padding Not Displaying in Select Lists in Safari and IE

Despite the lack of restrictions in the W3 specification, padding in select boxes is not supported by WebKit browsers, including Safari and Chrome. As a result, padding is not applied in these browsers.

To address this issue, consider using text-indent instead of padding-left. Maintain the same indentation amount by incrementing the width of your select box accordingly.

For example, in your code:

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

By adding text-indent:15px and increasing the width to 258px, the select box will now display the same indent as if it had 15px of left padding, while still functioning correctly in WebKit browsers.

The above is the detailed content of Why Isn\'t Padding Working in Safari and IE Select Lists?. 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