Sydeny PC & Technology User Group

Web Design User Group

We Meet the third Saturday of each month
 at the Sydney Mechanics Institute 240 Pitt St Sydney from 2 pm

What we did

September 2025 : This month we investigated "The Fundamentals of CSS Alignment".

September was all about Alignment. Aligning items in HTML was rather difficulty. Who remembers “floats” or margin right 50% margin left 50% to align an item in the middle of a container. Then Flexbox was introduced to CSS to make alignment easier. It helped us align items either vertical or horizonal. Then they introduced Grid which gave us alignment in both directions. A key aspect of both of these methods is the justify selectors which are used in both options.

I found an article “The Fundamentals of CSS Alignment” from Temani Afi. It a very comprehensive summary of the state of alignment in CSS. Dealing with both Grid and Flex but Temani didn’t forget the original block or inline alignment.

Below is the summaries of each section;

The alignment theory;

Then the Grid summary;

The Flex summary;

And finally, a sum up of the block containment;

  • There is no stretch behavior for content A block container can either contain inline elements or block elements.
  • When both are present, the browser will create “anonymous block boxes” to encapsulate the inline elements.
  • We cannot align the “anonymous block boxes”. When a block container contains inline elements, there is no “item level” alignment horizontally. You can use text-align to align the inline elements horizontally.
  • Have a look and try the quiz.

    Steve South

     

     

     

    Steve South
    Web Design leader

    Back