What are the three ways to align paragraphs between the top and bottom margins of a text placeholder?

margin: 1em; margin: -3px; margin: 5% auto; margin: 1em auto 2em; margin: 2px 1em 0 auto; margin: inherit; margin: initial; margin: revert; margin: revert-layer; margin: unset;

The margin property may be specified using one, two, three, or four values. Each value is a <length>, a <percentage>, or the keyword auto. Negative values draw the element closer to its neighbors than it would be by default.

  • When one value is specified, it applies the same margin to all four sides.
  • When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
  • When three values are specified, the first margin applies to the top, the second to the right and left, the third to the bottom.
  • When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).

The text-align CSS property sets the horizontal alignment of the inline-level content inside a block element or table-cell box. This means it works like vertical-align but in the horizontal direction.

text-align: start; text-align: end; text-align: left; text-align: right; text-align: center; text-align: justify; text-align: justify-all; text-align: match-parent; text-align: "."; text-align: "." center; text-align: -moz-center; text-align: -webkit-center; text-align: inherit; text-align: initial; text-align: revert; text-align: revert-layer; text-align: unset;

The text-align property is specified in one of the following ways:

  • Using the keyword values start, end, left, right, center, justify, justify-all, or match-parent.
  • Using a <string> value only, in which case the other value defaults to right.
  • Using both a keyword value and a <string> value.

start

The same as left if direction is left-to-right and right if direction is right-to-left.

end

The same as right if direction is left-to-right and left if direction is right-to-left.

left

The inline contents are aligned to the left edge of the line box.

right

The inline contents are aligned to the right edge of the line box.

center

The inline contents are centered within the line box.

justify

The inline contents are justified. Text should be spaced to line up its left and right edges to the left and right edges of the line box, except for the last line.

justify-all

Same as justify, but also forces the last line to be justified.

match-parent

Similar to inherit, but the values start and end are calculated according to the parent's direction and are replaced by the appropriate left or right value.

<string>

When applied to a table cell, specifies the alignment character around which the cell's contents will align.

The inconsistent spacing between words created by justified text can be problematic for people with cognitive concerns such as Dyslexia.

text-align =
start |
end |
left |
right |
center |
justify |
match-parent |
justify-all

<p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. </p>

.example { text-align: start; border: solid; }

<p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. </p>

.example { text-align: center; border: solid; }

<p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. </p>

.example { text-align: justify; border: solid; }

BCD tables only load in the browser

  • margin: auto, margin-left: auto, vertical-align