公式YouTube

【CSSコピペでOK!】レスポンシブテーブル HTML CSS

CSS


    <style>
.prof-head {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 10px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.prof-info-tags {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.prof-tag { 
    padding: 3px 10px;
    border-radius: 5px;
    color: #fff;
    font-size: 12px;
}

.tea-num {
    background-color: #ff0000;
}

.reki, .tea-cate {
    background-color: #007bff;
}

.de-but {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    font-size: 1em;
    color: #333;
    margin-bottom: 15px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s, color 0.3s;
}

.de-but:hover {
    background-color: #ddd;
    color: #000;
}

.de-but i {
    margin-right: 5px;
}

.dates {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
}

.book {
    display: flex;
    justify-content: space-between;
    align-items: stretch; /* ボタンの高さを揃える */
    gap: 10px; /* ボタン間のスペースを設定 */
    flex-wrap: nowrap; /* 改行しない */
}

.apply-but, .fav-but {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    margin-bottom: 0;
}

.apply-but {flex-direction: column; /* 縦に並べる */
    background-color: #ff7f50;
    color: #fff;
    border: none;
    flex: 0 0 70%;
}

.apply-but span {   display: block;
    font-size: 11px;
}













.apply-but:hover {
    background-color: #e67345;
    color: #fff;
}

.fav-but {
    background-color: #fff;
    color: #007bff;
    border: 1px solid #007bff;
    flex: 0 0 30%;
}

.fav-but:hover {
    background-color: #007bff;
    color: #fff;
}

.fav-but i {
    margin-right: 5px;
}

/* メディアクエリ */
@media (max-width: 768px) {
    .book {
        flex-direction: row; /* 横並びに変更 */
    }

    .apply-but, .fav-but {
        flex: 0; /* 初期値は 0 にして、個別の比率を指定 */
    }

    .apply-but {
        flex: 7; /* `fav-but` の 7 倍の幅 */
    }

    .fav-but {
        flex: 3; /* 幅の比率を指定 */
    }

    .apply-but, .fav-but {
        margin-bottom: 0; /* ボタン間のスペースをなくす */
    }
    .prof-info-tags {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}


.prof-tag {
    padding: 2px 7px;
    border-radius: 5px;
    color: #fff;
    font-size: 11px;
}






}


    </style>

HTML

<div class="prof-head">
    <div class="prof-info-tags">
        <span class="prof-tag tea-num">NEW</span>
        <span class="prof-tag reki">正社員</span>
        <span class="prof-tag tea-cate">上場企業</span>
    </div>
    <button class="de-but">
        <i class="fas fa-building"></i> 企業情報を詳しく見る
    </button>
    <div class="dates">
        <p>掲載予定期間:2024/7/29(月)~2024/10/27(日)</p>
        <p>更新日:2024/7/29(月)</p>
    </div>
    <div class="book">
        <button class="apply-but">応募依頼する<span>(エージェントサービス)</span></button>
        <button class="fav-but">
            <i class="fas fa-heart"></i> 気になる
        </button>
    </div>
</div>
モバイルでの表示

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

ド "place_id" の件数: 41