ホーム カテゴリ 記事

@ハクト 2022-04-20 12:39:00に投稿

上下で比較できるテンプレート

jQueryとJavaScriptの記法の違いをツイートしよう

コードを表示

<div class="box">
    <input type="text" class="box-input" disabled="" placeholder="ファイルを選択してください">
    <label class="file-label" for="file-select">
        ファイル選択
        <input type="file" class="file-control" id="file-select">
    </label>
</div>
.box {
    display: flex;
    width: 100%;
}

.box-input {
    flex-grow: 4;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #efefef;
    border: 1px solid #ced4da;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0.25rem;
    transition: border-color .3s;
}

.file-label {
    flex-grow: 1;
    cursor: pointer;
    padding: 15px;
    background: #000;
    color: #fff;
    text-align: center;
}

.file-label input {
    display: none;
}

@ハクト

サービス作り・デザイン好き。70年代生まれのWEBエンジニア。WEBパーツをCSSでカスタマイズしてコピペできるサービスを運営中「Pa-tu」。実装したWEBパーツやツールを利用してWEB情報やライフハックを発信してます。

Twitter