乐闻世界logo
搜索文章和话题

What Options Does Tailwind CSS Provide to Control Element Maximum Width?

2024年7月14日 14:23

The following utility classes can be used to control the maximum width of elements in Tailwind CSS:

  1. max-w-xs: Sets the maximum width to 20rem.
  2. max-w-sm: Sets the maximum width to 24rem.
  3. max-w-md: Sets the maximum width to 28rem.
  4. max-w-lg: Sets the maximum width to 32rem.
  5. max-w-xl: Sets the maximum width to 36rem.
  6. max-w-2xl: Sets the maximum width to 42rem.
  7. max-w-3xl: Sets the maximum width to 48rem.
  8. max-w-4xl: Sets the maximum width to 56rem.
  9. max-w-5xl: Sets the maximum width to 64rem.
  10. max-w-6xl: Sets the maximum width to 72rem.
  11. max-w-7xl: Sets the maximum width to 80rem.

Additionally, Tailwind CSS supports setting maximum width using percentages, such as:

  • max-w-full: Sets the maximum width to 100%.
  • max-w-screen-sm: Sets the maximum width to the width of a small screen.
  • max-w-screen-md: Sets the maximum width to the width of a medium screen.
  • max-w-screen-lg: Sets the maximum width to the width of a large screen.
  • max-w-screen-xl: Sets the maximum width to the width of an extra-large screen.

These classes can be applied to any element to restrict its maximum width as needed.

标签:Tailwind CSS