Skip to main content
HTML Validation

CSS: “align-items”: “auto” is not a “align-items” value.

About This HTML Issue

The issue you’re encountering indicates that the CSS property align-items is being set to a value of auto, which is not a valid value for this property according to the CSS specification. The align-items property is used in flexbox and grid layouts to define how items are aligned along the cross axis.

Fixing the Issue:

  • Understand Valid Values: The valid values for the align-items property include:

    /* Basic keywords */
    align-items: normal;
    align-items: stretch;
    
    /* Positional alignment */
    /* align-items does not take left and right values */
    align-items: center;
    align-items: start;
    align-items: end;
    align-items: flex-start;
    align-items: flex-end;
    align-items: self-start;
    align-items: self-end;
    align-items: anchor-center;
    
    /* Baseline alignment */
    align-items: baseline;
    align-items: first baseline;
    align-items: last baseline; /* Overflow alignment (for positional alignment only) */
    align-items: safe center;
    align-items: unsafe center;
    
    /* Global values */
    align-items: inherit;
    align-items: initial;
    align-items: revert;
    align-items: revert-layer;
    align-items: unset;
    
  • Choose a Correct Value: Based on the desired alignment, choose one of the valid values. For instance:

    • Use flex-start to align items to the start of the container.
    • Use center to align items in the center.
    • Use stretch to stretch items to fill the container.
  • Example Correction: If your original CSS was:

     .container {
       display: flex;
       align-items: auto; /* This is invalid */
     }

    You could change it to:

     .container {
       display: flex;
       align-items: center; /* This is valid */
     }

Conclusion:

Replace the invalid auto value with a valid option that suits the design you aim for, making sure to test the layout after applying changes to confirm that the items align as intended.

Learn more:

Last reviewed: September 23, 2024

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.