Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling file upload button #1232

Open
jcbsv opened this issue Nov 23, 2023 · 0 comments
Open

Styling file upload button #1232

jcbsv opened this issue Nov 23, 2023 · 0 comments

Comments

@jcbsv
Copy link
Contributor

jcbsv commented Nov 23, 2023

I suggest to revive issue #812 regarding styling of upload buttons.

The ::file-selector-button CSS selector now has wide (if not universal) adoption.

The following code (adopted from buttons-core.css and buttons.css) shows an example implementation:

input::file-selector-button {
    display: inline-block;
    line-height: normal;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
    cursor: pointer;
    -webkit-user-drag: none;
    user-select: none;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 100%;
    padding: 0.5em 1em;
    color: rgba(0, 0, 0, 0.80);
    border: none rgba(0, 0, 0, 0);
    background-color: #E6E6E6;
    text-decoration: none;
    border-radius: 2px;
}

input::file-selector-button:hover,
input::file-selector-button:focus {
    background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10));
}
input::file-selector-button:focus {
    outline: 0;
}
input::file-selector-button:active {
    box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset;
    border-color: #000;
}

The result in Safari (Swedish language):
Skärmavbild 2023-11-23 kl  07 52 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant