3@TECH BLOG

日々の業務で得た知見やノウハウ、技術情報などを発信します。

フォームテーブル

フォームテーブル

テーブルのスタイル、ブレイクポイント等は、テーブルの項目を参照してください。

View

必須項目名

○○は入力必須です。…などのエラー表示

項目名 入力例、補足など

Source

必須項目名

       

○○は入力必須です。…などのエラー表示

   

項目名        入力例、補足など    
HTML

CSS
/* ====================================================
 フォームテーブル設定
==================================================== */
form table { width: 100%; }
form th.required:before {
    content: "必須";
    display: inline-block;
    position: relative;
    top: 0.2em;
    float: right;
    background: #990000;
    border-radius: 3px;
    padding: 0.25em 0.5em;
    vertical-align: middle;
    line-height: 1;
    color: #ffffff;
    font-size: 70%;
}
form .sample {
    display: block;
    margin: 0.5em 0;
    padding-left: 1em;
    text-indent: -1em;
    line-height: 1;
    color: #555555;
    font-size: 80%;
}
form .sample:before { content: "※"; }
form .error {
    display: block;
    margin: 0.25em 0 0;
    padding-left: 1em;
    text-indent: -1em;
    line-height: 1;
    color: #ff0000;
    font-size: 90%;
    font-weight: bold;
}
form .error:before { content: "※"; }

/* ====================================================
 フォームスタイル
==================================================== */
input[type="text"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="email"],
input[type="datetime"],
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #999999;
    border-radius: 2px;
    background-color: #ffffff;
    max-width: 100%;
    padding: 0.25em 0.5em;
    height: 2.25em;
    font-size: 14px;
    color: #666 !important;
    font-family: "游ゴシック", YuGothic, "メイリオ", "Meiryo", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", sans-serif;
}
/* ====================================================
 テーブル基本設定
==================================================== */
table { width: 100%; }
caption {
    text-align: left;
    font-size: 80%;
    font-weight: bold;
}
th,
td {
    border-color: #cccccc;
    padding: 0.5em;
    text-align: left;
    font-weight: normal;
}

@media print, screen and (min-width: 768px) {
    th {
        background: #f7f7f7;
        padding: 0.5em;
        vertical-align: top;
        font-size: 14px;
    }
    td {
        padding: 0.5em;
        font-size: 14px;
    }
}

@media screen and (max-width: 767px) {
    th {
        background: #f7f7f7;
        padding: 0.5em;
    }
    td { padding: 0.5em; }
}
/* ====================================================
 囲み
==================================================== */
.borderHorizon th,
.borderHorizon td { border-width: 1px 0; }
.borderBox th,
.borderBox td { border-width: 1px; }
/* ====================================================
 線種
==================================================== */
.borderSolid th { border-style: solid; }
.borderSolid td { border-style: solid; }
.borderSolid td:before { border-style: solid; }
.borderDotted th { border-style: dotted; }
.borderDotted td { border-style: dotted; }
.borderDotted td:before { border-style: dotted; }
.borderDashed th { border-style: dashed; }
.borderDashed td { border-style: dashed; }
.borderDashed td:before { border-style: dashed; }
/* ====================================================
 *のときTHをサイドに作る
==================================================== */
table.cell-xs-create td:before,
table.cell-sm-create td:before,
table.cell-md-create td:before,
table.cell-lg-create td:before {
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0;
    border-width: 0 1px 0 0;
    border-color: #cccccc;
    background: #eeeeee;
    width: 6em;
    height: 100%;
    padding: 0.5em;
}
table.borderHorizon.cell-xs-create td:before,
table.borderHorizon.cell-sm-create td:before,
table.borderHorizon.cell-md-create td:before,
table.borderHorizon.cell-lg-create td:before { border: none; }

@media print, screen and (max-width: 767px) {
/* ====================================================
 xsのときcellをBlock
==================================================== */
    table.xs-block { display: block; }
    table.xs-block caption,
    table.xs-block thead,
    table.xs-block tbody,
    table.xs-block tr,
    table.xs-block th,
    table.xs-block td { display: block; }
    table.xs-block th,
    table.xs-block td { margin-bottom: -1px; }
    table.xs-block th {
        padding-top: 0;
        padding-bottom: 0;
    }
    table.cell-xs-create th { display: none; }
    table.cell-xs-create td {
        position: relative;
        overflow: hidden;
        padding-left: 7em;
    }
    table.cell-xs-create td:before { content: attr(title); }
}

@media print, screen and (max-width: 991px) {
/* ====================================================
 smのときcellをBlock
==================================================== */
    table.sm-block { display: block; }
    table.sm-block caption,
    table.sm-block thead,
    table.sm-block tbody,
    table.sm-block tr,
    table.sm-block th,
    table.sm-block td { display: block; }
    table.sm-block th,
    table.sm-block td { margin-bottom: -1px; }
    table.sm-block th {
        padding-top: 0;
        padding-bottom: 0;
    }
    table.cell-sm-create th { display: none; }
    table.cell-sm-create td {
        position: relative;
        overflow: hidden;
        padding-left: 7em;
    }
    table.cell-sm-create td:before { content: attr(title); }
}

@media screen and (max-width: 1199px) {
/* ====================================================
 mdのときcellをBlock
==================================================== */
    table.md-block { display: block; }
    table.md-block caption,
    table.md-block thead,
    table.md-block tbody,
    table.md-block tr,
    table.md-block th,
    table.md-block td { display: block; }
    table.md-block th,
    table.md-block td { margin-bottom: -1px; }
    table.md-block th {
        padding-top: 0;
        padding-bottom: 0;
    }
    table.cell-md-create th { display: none; }
    table.cell-md-create td {
        position: relative;
        overflow: hidden;
        padding-left: 7em;
    }
    table.cell-md-create td:before { content: attr(title); }
}

@media screen and (max-width: 9999px) {
/* ====================================================
 lgのときcellをBlock
==================================================== */
    table.lg-block { display: block; }
    table.lg-block caption,
    table.lg-block thead,
    table.lg-block tbody,
    table.lg-block tr,
    table.lg-block th,
    table.lg-block td { display: block; }
    table.lg-block th,
    table.lg-block td { margin-bottom: -1px; }
    table.lg-block th {
        padding-top: 0;
        padding-bottom: 0;
    }
    table.cell-lg-create th { display: none; }
    table.cell-lg-create td {
        position: relative;
        overflow: hidden;
        padding-left: 7em;
    }
    table.cell-lg-create td:before { content: attr(title); }
}

Contact お問い合わせ

お気軽にお問い合わせください。

PageTop