Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
137
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

@yasumodev

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

<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

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
137
Help us understand the problem. What are the problem?