CSS align self

Created By: chatGPT

The align-self property in CSS allows you to override the align-items property for specific flex items within a flex container. It enables individual flex items to be positioned independently along the cross axis. Here's how it works:

You can set the align-self property to one of several values:

  • flex-start: Aligns the item at the start of the cross axis.
  • flex-end: Aligns the item at the end of the cross axis.
  • center: Centers the item along the cross axis.
  • baseline: Aligns the item along the baseline of the container.
  • stretch: Stretches the item to fill the container (this is the default).
Here’s an example demonstrating the use of align-self:
Item 1
Item 2
Item 3

In this example, we have a flex container with three items. Each item uses a different align-self value:

  • Item 1 is aligned at the start of the container.
  • Item 2 is centered.
  • Item 3 is aligned at the end of the container. You can see how this property allows for great flexibility when arranging items within a flex layout.
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