Day 86: the initial-letter property

posted on

It’s time to get me up to speed with modern CSS. There’s so much new in CSS that I know too little about. To change that I’ve started #100DaysOfMoreOrLessModernCSS. Why more or less modern CSS? Because some topics will be about cutting-edge features, while other stuff has been around for quite a while already, but I just have little to no experience with it.


The initial-letter property specifies size and sink for initial letters.

@supports (-webkit-initial-letter: 1) or (initial-letter: 1) {
  p::first-letter {
    -webkit-initial-letter: 3;
    initial-letter: 3;
  }
}

The property takes two arguments. The first one defines the size of the initial letter in terms of how many lines it occupies. The optional second argument defines the number of lines the initial letter should sink. If it's omitted, it equals the initial letter size.

  p::first-letter {
    initial-letter: 2;
  }
The first letter in a paragraph spans 2 lines starting at the first line and ending at the second line."

1 as the second argument indicates a raised initial.

  p::first-letter {
    initial-letter: 2 1;
  }
The first letter in a paragraph spans 2 lines starting at the first line and going up ending one line above the first line."

Values greater than 1 indicate a sunken initial letter.

  p::first-letter {
    initial-letter: 2 5;
  }
The first letter in a paragraph spans 2 lines starting at the fourth line and ending at the fifth line."

Note: This property is currently only supported in Safari with a prefix, but it's coming to Chromium browsers soon.

See on CodePen

Further reading

Overview: 100 Days Of More Or Less Modern CSS