From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/css/border-spacing/index.html | 131 +++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 files/ja/web/css/border-spacing/index.html (limited to 'files/ja/web/css/border-spacing') diff --git a/files/ja/web/css/border-spacing/index.html b/files/ja/web/css/border-spacing/index.html new file mode 100644 index 0000000000..0e9470089c --- /dev/null +++ b/files/ja/web/css/border-spacing/index.html @@ -0,0 +1,131 @@ +--- +title: border-spacing +slug: Web/CSS/border-spacing +tags: + - CSS + - CSS テーブル + - CSS プロパティ + - CSS 表 + - Reference + - リファレンス +translation_of: Web/CSS/border-spacing +--- +
{{CSSRef}}
+ +

CSS の border-spacing プロパティは、 {{htmlelement("table")}} における隣り合うセルの枠線同士の間隔を定めます。このプロパティは {{cssxref("border-collapse")}} が separate のときのみ適用されます。

+ +
{{EmbedInteractiveExample("pages/css/border-spacing.html")}}
+ + + +

border-spacing の値は、表の外周部分にも使用され、表の境界線と最初/最後の列または行との間の距離は、 (縦または横の) 対応する border-spacing と、表の対応する側 (上下左右のいずれか) の {{cssxref("padding")}} の合計になります。

+ +
+

メモ: border-spacing プロパティは、 <table> 要素の非推奨になった cellspacing 属性と同等ですが、任意で2つ目の値を指定して、左右方向と上下方向に異なる間隔を設定することができる点が異なります。

+
+ +

構文

+ +
/* <length> */
+border-spacing: 2px;
+
+/* 左右の <length> | 上下の <length> */
+border-spacing: 1cm 2em;
+
+/* グローバル値 */
+border-spacing: inherit;
+border-spacing: initial;
+border-spacing: unset;
+
+ +

border-spacing プロパティは1つまたは2つの値で指定することができます。

+ + + +

+ +
+
{{cssxref("<length>")}}
+
固定値による間隔の大きさです。
+
+ +

形式文法

+ +
{{csssyntax}}
+ +

+ +

この例では表のセル間において、垂直方向に .5em、水平方向に 1em の間隔を適用します。なお、外の辺においては、表の padding の値が border-spacing の値に追加されます。

+ +

HTML

+ +
<table>
+  <tr>
+    <td>1</td><td>2</td><td>3</td>
+  </tr>
+  <tr>
+    <td>4</td><td>5</td><td>6</td>
+  </tr>
+  <tr>
+    <td>7</td><td>8</td><td>9</td>
+  </tr>
+</table>
+
+ +

CSS

+ +
table {
+  border-spacing: 1em .5em;
+  padding: 0 2em 1em 0;
+  border: 1px solid orange;
+}
+
+td {
+  width: 1.5em;
+  height: 1.5em;
+  background: #d2d2d2;
+  text-align: center;
+  vertical-align: middle;
+}
+
+ +

結果

+ +

{{ EmbedLiveSample('Example', 400, 200) }}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{ SpecName('CSS2.1', 'tables.html#separated-borders', 'border-spacing') }}{{ Spec2('CSS2.1') }}初回定義
+ +

{{cssinfo}}

+ +

ブラウザーの対応

+ + + +

{{Compat("css.properties.border-spacing")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf