From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../broken_table_layout.html/index.html | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 files/ja/web/compatibility_faq/broken_table_layout.html/index.html (limited to 'files/ja/web/compatibility_faq/broken_table_layout.html/index.html') diff --git a/files/ja/web/compatibility_faq/broken_table_layout.html/index.html b/files/ja/web/compatibility_faq/broken_table_layout.html/index.html new file mode 100644 index 0000000000..32dc4a39a4 --- /dev/null +++ b/files/ja/web/compatibility_faq/broken_table_layout.html/index.html @@ -0,0 +1,67 @@ +--- +title: テーブルのレイアウトが崩れている +slug: Web/Compatibility_FAQ/Broken_Table_Layout.html +tags: + - Compatibility + - Layout +--- +

概要

+ +

 テーブルのセル幅に統一性がなく、テーブル全体のレイアウトが崩れます。

+ +
  
+ +

左:Firefox 右:他ブラウザ

+ +

要因

+ +

 要因の代表例として以下があります。

+ +
    +
  1. +

    テーブルのセル幅の未指定

    + +

     テーブルのセル幅が明示的に指定されていないため、セルの横幅がテーブル各行左側のセルのサイズに合わせて伸縮しています。

    + +
      #maincontent section.category .list div{
    +	display: table;
    +	width: 100%;
    +	border-top: #b2b2b2 1px solid;
    +  }		
    + +

     上記のようなテーブル指定に加えて、更に横並びのセルが左右均等となるような配置指定が必要となります。
    +  

    +
  2. +
+ +

解決策

+ +

 解決策の代表例として以下があります。

+ +
    +
  1. +

    テーブルのセル幅の未指定

    + +

    テーブルの配置指定に table-layout: fixed; を適用させます。
    + table-layout: fixed; の指定により、横並びのセル幅が左右均等になります。

    + +
      #maincontent section.category .list div{
    +	display: table;
    +	table-layout: fixed;
    +	width: 100%;
    +	border-top: #b2b2b2 1px solid;
    +  }	
    + +

     

    +
  2. +
+ +

メリット

+ +

 ・他のブラウザでも互換性を維持することができます。
+  ・細かいpxの指定をせずにテーブルの見た目を整えることができます。
+  ・また、後続するセルのコンテンツが用意された列幅をオーバーフロー(はみ出し)した場合にも、
+   発生したセルに対してoverflowプロパティを用いればはみ出したセルの内容を表示できるようになるなど、セルの内容変更にも柔軟に対応できます。

+ +


+ 戻る

-- cgit v1.2.3-54-g00ecf