CSS first letter

Created By: chatGPT

The first-letter pseudo-element in CSS is used to apply styles to the first letter of a block-level element. This can be especially useful for creating a drop cap effect in a paragraph. Using ::first-letter, you can manipulate various properties like font size, color, and text-transform.
p::first-letter {
    font-size: 3em;
    color: #ff0000;
    float: left;
    margin-right: 0.1em;
}
In the example above, the first letter of any paragraph (<p>) will be displayed in a larger size (3em), colored red, and floated to the left with a small margin on the right. You can further customize the appearance by adding more CSS properties such as font-weight, text-transform, or line-height.
p::first-letter {
    font-size: 3em;
    color: #ff0000;
    float: left;
    margin-right: 0.1em;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1;
}
Be mindful that the ::first-letter pseudo-element applies only to block-level elements. Also, it only affects the very first letter and not any potential styling of subsequent letters. It’s an effective way to draw attention to the beginning of a text passage, and it works well in editorial design.
h1::first-letter {
    font-size: 2em;
    color: blue;
}
Introduction And SetupSelectorsType SelectorClass SelectorId SelectorAttribute SelectorsUniversal SelectorGrouping SelectorsCombinatorsDescendant CombinatorChild CombinatorAdjacent Sibling CombinatorGeneral Sibling CombinatorPseudo ClassesHoverNth ChildNth Of TypeFocusVisitedActiveFirst ChildLast ChildOnly ChildPseudo ElementsBeforeAfterFirst LetterFirst LineBox ModelMarginPaddingBorderWidthHeightBox SizingPositioningStaticRelativeAbsoluteFixedStickyZ IndexDisplayInlineBlockInline BlockFlexGridNoneFloatClearTypographyFont FamilyFont SizeFont WeightFont StyleLine HeightLetter SpacingText AlignText DecorationText TransformVertical AlignOverflowOverflow XOverflow YVisibilityClip PathBackgroundsBackground ColorBackground ImageBackground SizeBackground PositionBackground RepeatBackground AttachmentGradientsBordersBorder WidthBorder ColorBorder StyleBorder RadiusShadowsBox ShadowText ShadowFlexboxFlex DirectionJustify ContentAlign ItemsAlign SelfFlex GrowFlex ShrinkFlex BasisOrderGridGrid Template ColumnsGrid Template RowsGrid GapGrid Auto FlowAlign ContentCss VariablesCustom PropertiesAnimationKeyframesTransitionTransformRotateScaleTranslateSkewMedia QueriesMin WidthMax WidthOrientationAspect RatioUnitsPxEmRemVhVwPercentages