0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

tableのCSSについて

Last updated at Posted at 2024-01-17

             
以下はSCSS
.table{
border-collapse: collapse;/ボーダーをまとめて、1つの線にする/
border: 1px solid #707070;/table全体の線(外郭長方形の線のみ)/
background: #fff;
font-weight: 700;
width: 100%;/このwidthをつける前、tableが小さいです/
table-layout: fixed;/今は3列があるが、これを入れると、列が3等分になる/
/「table-layout: fixed;」を反映させるためには、テーブル全体の幅を指定する必要があります。/

th,
td{
    border: 1px solid #707070;
    padding: 0 24px;
    height: 58px;/*これがないと、高さが小さい*/
    vertical-align: middle;/*上下中央揃い. vertical-alignは、display:blockの要素には指定することができません。*/
}                          /*inline、または、table-cellにのみ指定することができます。*/

th{
    background: #999999;
    color: #fff;
    text-align: center;
    font-family: $font-en;
    &:nth-child(1){
        width: 172px;/*第1列は3等分ではなく、width:172px*/
    
    @include mq("sp"){
        width: 112px;/*スマホ時、見出し列の横幅が大きい*/
    }
    
    }
}

td{
    text-align: right;
}

strong{
    color: #E81919;
    line-height: 1.2;/*?これがないとずれると言われたが*/
}

span{
    font-size: 13px;
    display: block;
    margin-top: 1px;
    line-height: 1.2;/*?これがないとずれると言われたが*/
}

}

以下は説明
table-layoutで利用できる値
table-layoutでは以下の値を使うことができます。

値   説明
auto 幅と中身は要素のに合うよう自動的に調整されます。(初期値)
fixed widthによって指定された値が列の幅となる。
     指定のない場合は均等に調整される。

border-collapseで利用できる値
border-collapseでは以下の値を使うことができます。

値 説明
collapse 隣接するセルで境界線を共有します (collapsed-border 表レンダリングモデル)。
separate 隣接するセルが個別に境界線を持ちます (separated-border 表レンダリングモデル)。
対応ブラウザ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?