Help us understand the problem. What is going on with this article?

[HTML5] <input type="file">のデザインをもっと簡単に変更

More than 1 year has passed since last update.

<input type="file"> そのものにはCSSが効かず、スタイルを変更できません。そこで、<input> 自体は非表示にし、<label> で修飾します。

サンプルソース

HTML
<style>
label {
  color: white;  
  background-color: red;
  padding: 6px;
  border-radius: 12px;
}
</style>

<label for="file_photo">
    +写真を選択
    <input type="file" id="file_photo" style="display:none;">
</label>

デモソースはこちら

参考URL

yasumodev
「長い旅行に必要なのは大きなカバンじゃなく、口ずさめる一つの歌さ」スナフキン
https://twitter.com/yasumodev
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした