--- title: alignment-baseline slug: Web/SVG/Attribute/alignment-baseline tags: - SVG - SVG Attribute translation_of: Web/SVG/Attribute/alignment-baseline ---
alignment-baseline 属性は、要素が親要素に対して配置される方法を指定します。このプロパティは、要素と親要素の対応するベースラインのどれを揃えるかを指定します。例えば、ローマ字のテキストでフォントサイズが変わった場合でも、アルファベットのベースラインを一定にすることが可能になります。既定値は alignment-baseline プロパティの計算値と同じ名前の値となります。
注: プレゼンテーション属性として、 alignment-baseline は CSS プロパティとして使用することができます。
プレゼンテーション属性として、あらゆる要素に適用できますが、効果があるのは {{SVGElement("tspan")}}, {{SVGElement("tref")}}, {{SVGElement("altGlyph")}}, and {{SVGElement("textPath")}} の4つの属性のみです。
| 値 | auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | top | center | bottom |
|---|---|
| 既定値 | auto |
| アニメーション | 可 |
auto {{deprecated_inline}}baselinebefore-edge {{deprecated_inline}}text-bottomtext-before-edgeThe alignment-point of the object being aligned is aligned with the "text-before-edge" baseline of the parent text content element.
Note: This keyword may be mapped to text-top.
middlecentralafter-edge {{deprecated_inline}}The alignment-point of the object being aligned is aligned with the "after-edge" baseline of the parent text content element.
text-toptext-after-edgeThe alignment-point of the object being aligned is aligned with the "text-after-edge" baseline of the parent text content element.
Note: This keyword may be mapped to text-bottom.
ideographicalphabetichangingThe alignment-point of the object being aligned is aligned with the "hanging" baseline of the parent text content element.
mathematicaltopAligns the top of the aligned subtree with the top of the line box.
centerbottomSVG 2 introduces some changes to the definition of this property. In particular: the values auto, before-edge, and after-edge have been removed. For backwards compatibility, text-before-edge may be mapped to text-top and text-after-edge to text-bottom. Neither text-before-edge nor text-after-edge should be used with the {{cssxref("vertical-align")}} property.
<svg width="300" height="120" viewBox="0 0 300 120"
xmlns="http://www.w3.org/2000/svg">
<!-- Materialisation of anchors -->
<path d="M60,10 L60,110
M30,10 L300,10
M30,65 L300,65
M30,110 L300,110
" stroke="grey" />
<!-- Anchors in action -->
<text alignment-baseline="hanging"
x="60" y="10">A hanging</text>
<text alignment-baseline="middle"
x="60" y="65">A middle</text>
<text alignment-baseline="baseline"
x="60" y="110">A baseline</text>
<!-- Materialisation of anchors -->
<circle cx="60" cy="10" r="3" fill="red" />
<circle cx="60" cy="65" r="3" fill="red" />
<circle cx="60" cy="110" r="3" fill="red" />
<style><![CDATA[
text{
font: bold 36px Verdana, Helvetica, Arial, sans-serif;
}
]]></style>
</svg>
{{EmbedLiveSample("Example")}}
他の要素 ({{SVGElement("text")}} など) におけるオブジェクトの配置については、 {{SVGAttr("dominant-baseline")}} を参照してください。
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName("CSS3 Inline", "#propdef-alignment-baseline", "alignment-baseline")}} | {{Spec2("CSS3 Inline")}} | 変更なし |
| {{SpecName("SVG2", "text.html#AlignmentBaselineProperty", "alignment-baseline")}} | {{Spec2("SVG2")}} | CSS Inline Layout および注釈を参照し、 auto, before-edge, after-edge, text-before-edge, text-after-edge へ変更 |
| {{SpecName("SVG1.1", "text.html#AlignmentBaselineProperty", "alignment-baseline")}} | {{Spec2("SVG1.1")}} | 初回定義 |
{{Compat("svg.attributes.presentation.alignment-baseline")}}