Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

baseline-source — choosing the baseline source

baseline-source chooses the first or last baseline set of a box participating in baseline alignment.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

baseline-source: auto | first | last;

baseline-source applies to inline-level boxes establishing an independent formatting context, such as inline-block, not ordinary inline boxes.

first selects the first baseline set; last selects the last. Initial auto means last for inline-block and first otherwise. The property is not inherited.

Unlike alignment-baseline, it selects the source, not the baseline type. It is a longhand of vertical-align; a later shorthand can reset it.

This definition comes from a draft specification. Verify behavior in the target browser before deployment.

Examples

<!doctype html>
<meta charset="utf-8">
<title>baseline-source</title>
<style>
  body { font: 20px/30px monospace; }
  .box {
    display: inline-block;
    vertical-align: baseline;
    outline: 1px solid;
  }
  .first { baseline-source: first; }
  .last { baseline-source: last; }
</style>
<p>X <span class="box first">AAA<br>BBB</span></p>
<p>X <span class="box last">AAA<br>BBB</span></p>

Result

With the specified behavior implemented, the first X aligns with AAA; the second X aligns with BBB.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources