- Tailwind CSS Tutorial
- Tailwind CSS - Home
- Tailwind CSS - Roadmap
- Tailwind CSS - Introduction
- Tailwind CSS - Installation
- Tailwind CSS - Editor Setup
- Tailwind CSS - Core Concepts
- Tailwind CSS - Utility-First Fundamentals
- Tailwind CSS - Hover, Focus, and Other States
- Tailwind CSS - Responsive Design
- Tailwind CSS - Dark Mode
- Tailwind CSS - Reusing Styles
- Tailwind CSS - Adding Custom Styles
- Tailwind CSS - Functions & Directives
- Tailwind CSS - Customization
- Tailwind CSS - Configuration
- Tailwind CSS - Content Configuration
- Tailwind CSS - Theme Configuration
- Tailwind CSS - Customizing Screens
- Tailwind CSS - Customizing Colors
- Tailwind CSS - Customizing Spacing
- Tailwind CSS - Plugins
- Tailwind CSS - Presets
- Tailwind CSS - Base Styles
- Tailwind CSS - Preflight
- Tailwind CSS - Layout
- Tailwind CSS - Aspect Ratio
- Tailwind CSS - Container
- Tailwind CSS - Columns
- Tailwind CSS - Break After
- Tailwind CSS - Break Before
- Tailwind CSS - Break Inside
- Tailwind CSS - Box Decoration Break
- Tailwind CSS - Box Sizing
- Tailwind CSS - Display
- Tailwind CSS - Floats
- Tailwind CSS - Clear
- Tailwind CSS - Isolation
- Tailwind CSS - Object Fit
- Tailwind CSS - Object Position
- Tailwind CSS - Overflow
- Tailwind CSS - Overscroll Behavior
- Tailwind CSS - Position
- Tailwind CSS - Top / Right / Bottom / Left
- Tailwind CSS - Visibility
- Tailwind CSS - Z-Index
- Tailwind CSS - Flexbox & Grid
- Tailwind CSS - Flex Basis
- Tailwind CSS - Flex Direction
- Tailwind CSS - Flex Wrap
- Tailwind CSS - Flex
- Tailwind CSS - Flex Grow
- Tailwind CSS - Flex Shrink
- Tailwind CSS - Order
- Tailwind CSS - Grid Template Columns
- Tailwind CSS - Grid Column Start / End
- Tailwind CSS - Grid Template Rows
- Tailwind CSS - Grid Row Start / End
- Tailwind CSS - Grid Auto Flow
- Tailwind CSS - Grid Auto Columns
- Tailwind CSS - Grid Auto Rows
- Tailwind CSS - Gap
- Tailwind CSS - Justify Content
- Tailwind CSS - Justify Items
- Tailwind CSS - Justify Self
- Tailwind CSS - Align Content
- Tailwind CSS - Align Items
- Tailwind CSS - Align Self
- Tailwind CSS - Place Content
- Tailwind CSS - Place Items
- Tailwind CSS - Place Self
- Tailwind CSS - Spacing
- Tailwind CSS - Padding
- Tailwind CSS - Margin
- Tailwind CSS - Space Between
- Tailwind CSS - Sizing
- Tailwind CSS - Width
- Tailwind CSS - Min-Width
- Tailwind CSS - Max-Width
- Tailwind CSS - Height
- Tailwind CSS - Min-Height
- Tailwind CSS - Max-Height
- Tailwind CSS - Size
- Tailwind CSS - Typography
- Tailwind CSS - Font Family
- Tailwind CSS - Font Size
- Tailwind CSS - Font Smoothing
- Tailwind CSS - Font Style
- Tailwind CSS - Font Weight
- Tailwind CSS - Font Variant Numeric
- Tailwind CSS - Letter Spacing
- Tailwind CSS - Line Clamp
- Tailwind CSS - Line Height
- Tailwind CSS - List Style Image
- Tailwind CSS - List Style Position
- Tailwind CSS - List Style Type
- Tailwind CSS - Text Align
- Tailwind CSS - Text Color
- Tailwind CSS - Text Decoration
- Tailwind CSS - Text Decoration Color
- Tailwind CSS - Text Decoration Style
- Tailwind CSS - Text Decoration Thickness
- Tailwind CSS - Text Underline Offset
- Tailwind CSS - Text Transform
- Tailwind CSS - Text Overflow
- Tailwind CSS - Text Wrap
- Tailwind CSS - Text Indent
- Tailwind CSS - Vertical Align
- Tailwind CSS - Whitespace
- Tailwind CSS - Word Break
- Tailwind CSS - Hyphens
- Tailwind CSS - Content
- Tailwind CSS - Backgrounds
- Tailwind CSS - Background Attachment
- Tailwind CSS - Background Clip
- Tailwind CSS - Background Color
- Tailwind CSS - Background Origin
- Tailwind CSS - Background Position
- Tailwind CSS - Background Repeat
- Tailwind CSS - Background Size
- Tailwind CSS - Background Image
- Tailwind CSS - Gradient Color Stops
- Tailwind CSS - Borders
- Tailwind CSS - Border Radius
- Tailwind CSS - Border Width
- Tailwind CSS - Border Color
- Tailwind CSS - Border Style
- Tailwind CSS - Divide Width
- Tailwind CSS - Divide Color
- Tailwind CSS - Divide Style
- Tailwind CSS - Outline Width
- Tailwind CSS - Outline Color
- Tailwind CSS - Outline Style
- Tailwind CSS - Outline Offset
- Tailwind CSS - Ring Width
- Tailwind CSS - Ring Color
- Tailwind CSS - Ring Offset Width
- Tailwind CSS - Ring Offset Color
- Tailwind CSS - Effects
- Tailwind CSS - Box Shadow
- Tailwind CSS - Box Shadow Color
- Tailwind CSS - Opacity
- Tailwind CSS - Mix Blend Mode
- Tailwind CSS - Background Blend Mode
- Tailwind CSS - Filters
- Tailwind CSS - Blur
- Tailwind CSS - Brightness
- Tailwind CSS - Contrast
- Tailwind CSS - Drop Shadow
- Tailwind CSS - Grayscale
- Tailwind CSS - Hue Rotate
- Tailwind CSS - Invert
- Tailwind CSS - Saturate
- Tailwind CSS - Sepia
- Tailwind CSS - Backdrop Blur
- Tailwind CSS - Backdrop Brightness
- Tailwind CSS - Backdrop Contrast
- Tailwind CSS - Backdrop Grayscale
- Tailwind CSS - Backdrop Hue Rotate
- Tailwind CSS - Backdrop Invert
- Tailwind CSS - Backdrop Opacity
- Tailwind CSS - Backdrop Saturate
- Tailwind CSS - Backdrop Sepia
- Tailwind CSS - Tables
- Tailwind CSS - Border Collapse
- Tailwind CSS - Border Spacing
- Tailwind CSS - Table Layout
- Tailwind CSS - Caption Side
- Tailwind CSS - Transitions & Animation
- Tailwind CSS - Transition Property
- Tailwind CSS - Transition Duration
- Tailwind CSS - Transition Timing Function
- Tailwind CSS - Transition Delay
- Tailwind CSS - Animation
- Tailwind CSS - Transform
- Tailwind CSS - Scale
- Tailwind CSS - Rotate
- Tailwind CSS - Translate
- Tailwind CSS - Skew
- Tailwind CSS - Transform Origin
- Tailwind CSS - Interactivity
- Tailwind CSS - Accent Color
- Tailwind CSS - Appearance
- Tailwind CSS - Cursor
- Tailwind CSS - Caret Color
- Tailwind CSS - Pointer Events
- Tailwind CSS - Resize
- Tailwind CSS - Scroll Behavior
- Tailwind CSS - Scroll Margin
- Tailwind CSS - Scroll Padding
- Tailwind CSS - Scroll Snap Align
- Tailwind CSS - Scroll Snap Stop
- Tailwind CSS - Scroll Snap Type
- Tailwind CSS - Touch Action
- Tailwind CSS - User Select
- Tailwind CSS - Will Change
- Tailwind CSS - SVG
- Tailwind CSS - Fill
- Tailwind CSS - Stroke
- Tailwind CSS - Stroke Width
- Tailwind CSS - Accessibility
- Tailwind CSS - Screen Readers
- Tailwind CSS - Forced Color Adjust
- Tailwind CSS - Bonus
- Tailwind CSS - Using with Preprocessors
- Tailwind CSS - Optimizing for Production
- Tailwind CSS - References
- Tailwind CSS - Core Concepts
- Tailwind CSS - Customization
- Tailwind CSS - Layout
- Tailwind CSS - Flexbox & Grid
- Tailwind CSS - Spacing
- Tailwind CSS - Sizing
- Tailwind CSS - Typography
- Tailwind CSS - Backgrounds
- Tailwind CSS - Borders
- Tailwind CSS - Effects
- Tailwind CSS - Filters
- Tailwind CSS - Tables
- Tailwind CSS - Transitions & Animation
- Tailwind CSS - Transforms
- Tailwind CSS - Interactivity
- Tailwind CSS - Resources
- Tailwind CSS - Discussion
- Tailwind CSS - Useful Resources
Tailwind CSS - Scroll Margin
Tailwind CSS Scroll Margin is a collection of predefined classes that control the spacing around elements when scrolled into view, improving their positioning and visibility within the viewport.
Tailwind CSS Scroll Margin Classes
Below is a list of Tailwind CSS Scroll Margin classes that allow you to set different scroll margins for elements.
Class | CSS Properties |
---|---|
scroll-m-0 | scroll-margin: 0px; |
scroll-mx-0 | scroll-margin-left: 0px; scroll-margin-right: 0px; |
scroll-my-0 | scroll-margin-top: 0px; scroll-margin-bottom: 0px; |
scroll-ms-0 | scroll-margin-inline-start: 0px; |
scroll-me-0 | scroll-margin-inline-end: 0px; |
scroll-mt-0 | scroll-margin-top: 0px; |
scroll-mr-0 | scroll-margin-right: 0px; |
scroll-mb-0 | scroll-margin-bottom: 0px; |
scroll-ml-0 | scroll-margin-left: 0px; |
scroll-m-px | scroll-margin: 1px; |
scroll-mx-px | scroll-margin-left: 1px; scroll-margin-right: 1px; |
scroll-my-px | scroll-margin-top: 1px; scroll-margin-bottom: 1px; |
scroll-ms-px | scroll-margin-inline-start: 1px; |
scroll-me-px | scroll-margin-inline-end: 1px; |
scroll-mt-px | scroll-margin-top: 1px; |
scroll-mr-px | scroll-margin-right: 1px; |
scroll-mb-px | scroll-margin-bottom: 1px; |
scroll-ml-px | scroll-margin-left: 1px; |
scroll-m-0.5 | scroll-margin: 0.125rem; /* 2px */ |
scroll-mx-0.5 | scroll-margin-left: 0.125rem; /* 2px */ scroll-margin-right: 0.125rem; /* 2px */ |
scroll-my-0.5 | scroll-margin-top: 0.125rem; /* 2px */ scroll-margin-bottom: 0.125rem; /* 2px */ |
scroll-ms-0.5 | scroll-margin-inline-start: 0.125rem; /* 2px */ |
scroll-me-0.5 | scroll-margin-inline-end: 0.125rem; /* 2px */ |
scroll-mt-0.5 | scroll-margin-top: 0.125rem; /* 2px */ |
scroll-mr-0.5 | scroll-margin-right: 0.125rem; /* 2px */ |
scroll-mb-0.5 | scroll-margin-bottom: 0.125rem; /* 2px */ |
scroll-ml-0.5 | scroll-margin-left: 0.125rem; /* 2px */ |
scroll-m-1 | scroll-margin: 0.25rem; /* 4px */ |
scroll-mx-1 | scroll-margin-left: 0.25rem; /* 4px */ scroll-margin-right: 0.25rem; /* 4px */ |
scroll-my-1 | scroll-margin-top: 0.25rem; /* 4px */ scroll-margin-bottom: 0.25rem; /* 4px */ |
scroll-ms-1 | scroll-margin-inline-start: 0.25rem; /* 4px */ |
scroll-me-1 | scroll-margin-inline-end: 0.25rem; /* 4px */ |
scroll-mt-1 | scroll-margin-top: 0.25rem; /* 4px */ |
scroll-mr-1 | scroll-margin-right: 0.25rem; /* 4px */ |
scroll-mb-1 | scroll-margin-bottom: 0.25rem; /* 4px */ |
scroll-ml-1 | scroll-margin-left: 0.25rem; /* 4px */ |
scroll-m-1.5 | scroll-margin: 0.375rem; /* 6px */ |
scroll-mx-1.5 | scroll-margin-left: 0.375rem; /* 6px */ scroll-margin-right: 0.375rem; /* 6px */ |
scroll-my-1.5 | scroll-margin-top: 0.375rem; /* 6px */ scroll-margin-bottom: 0.375rem; /* 6px */ |
scroll-ms-1.5 | scroll-margin-inline-start: 0.375rem; /* 6px */ |
scroll-me-1.5 | scroll-margin-inline-end: 0.375rem; /* 6px */ |
scroll-mt-1.5 | scroll-margin-top: 0.375rem; /* 6px */ |
scroll-mr-1.5 | scroll-margin-right: 0.375rem; /* 6px */ |
scroll-mb-1.5 | scroll-margin-bottom: 0.375rem; /* 6px */ |
scroll-ml-1.5 | scroll-margin-left: 0.375rem; /* 6px */ |
scroll-m-2 | scroll-margin: 0.5rem; /* 8px */ |
scroll-mx-2 | scroll-margin-left: 0.5rem; /* 8px */ scroll-margin-right: 0.5rem; /* 8px */ |
scroll-my-2 | scroll-margin-top: 0.5rem; /* 8px */ scroll-margin-bottom: 0.5rem; /* 8px */ |
scroll-ms-2 | scroll-margin-inline-start: 0.5rem; /* 8px */ |
scroll-me-2 | scroll-margin-inline-end: 0.5rem; /* 8px */ |
scroll-mt-2 | scroll-margin-top: 0.5rem; /* 8px */ |
scroll-mr-2 | scroll-margin-right: 0.5rem; /* 8px */ |
scroll-mb-2 | scroll-margin-bottom: 0.5rem; /* 8px */ |
scroll-ml-2 | scroll-margin-left: 0.5rem; /* 8px */ |
scroll-m-2.5 | scroll-margin: 0.625rem; /* 10px */ |
scroll-mx-2.5 | scroll-margin-left: 0.625rem; /* 10px */ scroll-margin-right: 0.625rem; /* 10px */ |
scroll-my-2.5 | scroll-margin-top: 0.625rem; /* 10px */ scroll-margin-bottom: 0.625rem; /* 10px */ |
scroll-ms-2.5 | scroll-margin-inline-start: 0.625rem; /* 10px */ |
scroll-me-2.5 | scroll-margin-inline-end: 0.625rem; /* 10px */ |
scroll-mt-2.5 | scroll-margin-top: 0.625rem; /* 10px */ |
scroll-mr-2.5 | scroll-margin-right: 0.625rem; /* 10px */ |
scroll-mb-2.5 | scroll-margin-bottom: 0.625rem; /* 10px */ |
scroll-ml-2.5 | scroll-margin-left: 0.625rem; /* 10px */ |
scroll-m-3 | scroll-margin: 0.75rem; /* 12px */ |
scroll-mx-3 | scroll-margin-left: 0.75rem; /* 12px */ scroll-margin-right: 0.75rem; /* 12px */ |
scroll-my-3 | scroll-margin-top: 0.75rem; /* 12px */ scroll-margin-bottom: 0.75rem; /* 12px */ |
scroll-ms-3 | scroll-margin-inline-start: 0.75rem; /* 12px */ |
scroll-me-3 | scroll-margin-inline-end: 0.75rem; /* 12px */ |
scroll-mt-3 | scroll-margin-top: 0.75rem; /* 12px */ |
scroll-mr-3 | scroll-margin-right: 0.75rem; /* 12px */ |
scroll-mb-3 | scroll-margin-bottom: 0.75rem; /* 12px */ |
scroll-ml-3 | scroll-margin-left: 0.75rem; /* 12px */ |
scroll-m-3.5 | scroll-margin: 0.875rem; /* 14px */ |
scroll-mx-3.5 | scroll-margin-left: 0.875rem; /* 14px */ scroll-margin-right: 0.875rem; /* 14px */ |
scroll-my-3.5 | scroll-margin-top: 0.875rem; /* 14px */ scroll-margin-bottom: 0.875rem; /* 14px */ |
scroll-ms-3.5 | scroll-margin-inline-start: 0.875rem; /* 14px */ |
scroll-me-3.5 | scroll-margin-inline-end: 0.875rem; /* 14px */ |
scroll-mt-3.5 | scroll-margin-top: 0.875rem; /* 14px */ |
scroll-mr-3.5 | scroll-margin-right: 0.875rem; /* 14px */ |
scroll-mb-3.5 | scroll-margin-bottom: 0.875rem; /* 14px */ |
scroll-ml-3.5 | scroll-margin-left: 0.875rem; /* 14px */ |
scroll-m-4 | scroll-margin: 1rem; /* 16px */ |
scroll-mx-4 | scroll-margin-left: 1rem; /* 16px */ scroll-margin-right: 1rem; /* 16px */ |
scroll-my-4 | scroll-margin-top: 1rem; /* 16px */ scroll-margin-bottom: 1rem; /* 16px */ |
scroll-ms-4 | scroll-margin-inline-start: 1rem; /* 16px */ |
scroll-me-4 | scroll-margin-inline-end: 1rem; /* 16px */ |
scroll-mt-4 | scroll-margin-top: 1rem; /* 16px */ |
scroll-mr-4 | scroll-margin-right: 1rem; /* 16px */ |
scroll-mb-4 | scroll-margin-bottom: 1rem; /* 16px */ |
scroll-ml-4 | scroll-margin-left: 1rem; /* 16px */ |
scroll-m-5 | scroll-margin: 1.25rem; /* 20px */ |
scroll-mx-5 | scroll-margin-left: 1.25rem; /* 20px */ scroll-margin-right: 1.25rem; /* 20px */ |
scroll-my-5 | scroll-margin-top: 1.25rem; /* 20px */ scroll-margin-bottom: 1.25rem; /* 20px */ |
scroll-ms-5 | scroll-margin-inline-start: 1.25rem; /* 20px */ |
scroll-me-5 | scroll-margin-inline-end: 1.25rem; /* 20px */ |
scroll-mt-5 | scroll-margin-top: 1.25rem; /* 20px */ |
scroll-mr-5 | scroll-margin-right: 1.25rem; /* 20px */ |
scroll-mb-5 | scroll-margin-bottom: 1.25rem; /* 20px */ |
scroll-ml-5 | scroll-margin-left: 1.25rem; /* 20px */ |
scroll-m-6 | scroll-margin: 1.5rem; /* 24px */ |
scroll-mx-6 | scroll-margin-left: 1.5rem; /* 24px */ scroll-margin-right: 1.5rem; /* 24px */ |
scroll-my-6 | scroll-margin-top: 1.5rem; /* 24px */ scroll-margin-bottom: 1.5rem; /* 24px */ |
scroll-ms-6 | scroll-margin-inline-start: 1.5rem; /* 24px */ |
scroll-me-6 | scroll-margin-inline-end: 1.5rem; /* 24px */ |
scroll-mt-6 | scroll-margin-top: 1.5rem; /* 24px */ |
scroll-mr-6 | scroll-margin-right: 1.5rem; /* 24px */ |
scroll-mb-6 | scroll-margin-bottom: 1.5rem; /* 24px */ |
scroll-ml-6 | scroll-margin-left: 1.5rem; /* 24px */ |
scroll-m-7 | scroll-margin: 1.75rem; /* 28px */ |
scroll-mx-7 | scroll-margin-left: 1.75rem; /* 28px */ scroll-margin-right: 1.75rem; /* 28px */ |
scroll-my-7 | scroll-margin-top: 1.75rem; /* 28px */ scroll-margin-bottom: 1.75rem; /* 28px */ |
scroll-ms-7 | scroll-margin-inline-start: 1.75rem; /* 28px */ |
scroll-me-7 | scroll-margin-inline-end: 1.75rem; /* 28px */ |
scroll-mt-7 | scroll-margin-top: 1.75rem; /* 28px */ |
scroll-mr-7 | scroll-margin-right: 1.75rem; /* 28px */ |
scroll-mb-7 | scroll-margin-bottom: 1.75rem; /* 28px */ |
scroll-ml-7 | scroll-margin-left: 1.75rem; /* 28px */ |
scroll-m-8 | scroll-margin: 2rem; /* 32px */ |
scroll-mx-8 | scroll-margin-left: 2rem; /* 32px */ scroll-margin-right: 2rem; /* 32px */ |
scroll-my-8 | scroll-margin-top: 2rem; /* 32px */ scroll-margin-bottom: 2rem; /* 32px */ |
scroll-ms-8 | scroll-margin-inline-start: 2rem; /* 32px */ |
scroll-me-8 | scroll-margin-inline-end: 2rem; /* 32px */ |
scroll-mt-8 | scroll-margin-top: 2rem; /* 32px */ |
scroll-mr-8 | scroll-margin-right: 2rem; /* 32px */ |
scroll-mb-8 | scroll-margin-bottom: 2rem; /* 32px */ |
scroll-ml-8 | scroll-margin-left: 2rem; /* 32px */ |
scroll-m-9 | scroll-margin: 2.25rem; /* 36px */ |
scroll-mx-9 | scroll-margin-left: 2.25rem; /* 36px */ scroll-margin-right: 2.25rem; /* 36px */ |
scroll-my-9 | scroll-margin-top: 2.25rem; /* 36px */ scroll-margin-bottom: 2.25rem; /* 36px */ |
scroll-ms-9 | scroll-margin-inline-start: 2.25rem; /* 36px */ |
scroll-me-9 | scroll-margin-inline-end: 2.25rem; /* 36px */ |
scroll-mt-9 | scroll-margin-top: 2.25rem; /* 36px */ |
scroll-mr-9 | scroll-margin-right: 2.25rem; /* 36px */ |
scroll-mb-9 | scroll-margin-bottom: 2.25rem; /* 36px */ |
scroll-ml-9 | scroll-margin-left: 2.25rem; /* 36px */ |
scroll-m-10 | scroll-margin: 2.5rem; /* 40px */ |
scroll-mx-10 | scroll-margin-left: 2.5rem; /* 40px */ scroll-margin-right: 2.5rem; /* 40px */ |
scroll-my-10 | scroll-margin-top: 2.5rem; /* 40px */ scroll-margin-bottom: 2.5rem; /* 40px */ |
scroll-ms-10 | scroll-margin-inline-start: 2.5rem; /* 40px */ |
scroll-me-10 | scroll-margin-inline-end: 2.5rem; /* 40px */ |
scroll-mt-10 | scroll-margin-top: 2.5rem; /* 40px */ |
scroll-mr-10 | scroll-margin-right: 2.5rem; /* 40px */ |
scroll-mb-10 | scroll-margin-bottom: 2.5rem; /* 40px */ |
scroll-ml-10 | scroll-margin-left: 2.5rem; /* 40px */ |
scroll-m-11 | scroll-margin: 2.75rem; /* 44px */ |
scroll-mx-11 | scroll-margin-left: 2.75rem; /* 44px */ scroll-margin-right: 2.75rem; /* 44px */ |
scroll-my-11 | scroll-margin-top: 2.75rem; /* 44px */ scroll-margin-bottom: 2.75rem; /* 44px */ |
scroll-ms-11 | scroll-margin-inline-start: 2.75rem; /* 44px */ |
scroll-me-11 | scroll-margin-inline-end: 2.75rem; /* 44px */ |
scroll-mt-11 | scroll-margin-top: 2.75rem; /* 44px */ |
scroll-mr-11 | scroll-margin-right: 2.75rem; /* 44px */ |
scroll-mb-11 | scroll-margin-bottom: 2.75rem; /* 44px */ |
scroll-ml-11 | scroll-margin-left: 2.75rem; /* 44px */ |
scroll-m-12 | scroll-margin: 3rem; /* 48px */ |
scroll-mx-12 | scroll-margin-left: 3rem; /* 48px */ scroll-margin-right: 3rem; /* 48px */ |
scroll-my-12 | scroll-margin-top: 3rem; /* 48px */ scroll-margin-bottom: 3rem; /* 48px */ |
scroll-ms-12 | scroll-margin-inline-start: 3rem; /* 48px */ |
scroll-me-12 | scroll-margin-inline-end: 3rem; /* 48px */ |
scroll-mt-12 | scroll-margin-top: 3rem; /* 48px */ |
scroll-mr-12 | scroll-margin-right: 3rem; /* 48px */ |
scroll-mb-12 | scroll-margin-bottom: 3rem; /* 48px */ |
scroll-ml-12 | scroll-margin-left: 3rem; /* 48px */ |
scroll-m-14 | scroll-margin: 3.5rem; /* 56px */ |
scroll-mx-14 | scroll-margin-left: 3.5rem; /* 56px */ scroll-margin-right: 3.5rem; /* 56px */ |
scroll-my-14 | scroll-margin-top: 3.5rem; /* 56px */ scroll-margin-bottom: 3.5rem; /* 56px */ |
scroll-ms-14 | scroll-margin-inline-start: 3.5rem; /* 56px */ |
scroll-me-14 | scroll-margin-inline-end: 3.5rem; /* 56px */ |
scroll-mt-14 | scroll-margin-top: 3.5rem; /* 56px */ |
scroll-mr-14 | scroll-margin-right: 3.5rem; /* 56px */ |
scroll-mb-14 | scroll-margin-bottom: 3.5rem; /* 56px */ |
scroll-ml-14 | scroll-margin-left: 3.5rem; /* 56px */ |
scroll-m-16 | scroll-margin: 4rem; /* 64px */ |
scroll-mx-16 | scroll-margin-left: 4rem; /* 64px */ scroll-margin-right: 4rem; /* 64px */ |
scroll-my-16 | scroll-margin-top: 4rem; /* 64px */ scroll-margin-bottom: 4rem; /* 64px */ |
scroll-ms-16 | scroll-margin-inline-start: 4rem; /* 64px */ |
scroll-me-16 | scroll-margin-inline-end: 4rem; /* 64px */ |
scroll-mt-16 | scroll-margin-top: 4rem; /* 64px */ |
scroll-mr-16 | scroll-margin-right: 4rem; /* 64px */ |
scroll-mb-16 | scroll-margin-bottom: 4rem; /* 64px */ |
scroll-ml-16 | scroll-margin-left: 4rem; /* 64px */ |
scroll-m-20 | scroll-margin: 5rem; /* 80px */ |
scroll-mx-20 | scroll-margin-left: 5rem; /* 80px */ scroll-margin-right: 5rem; /* 80px */ |
scroll-my-20 | scroll-margin-top: 5rem; /* 80px */ scroll-margin-bottom: 5rem; /* 80px */ |
scroll-ms-20 | scroll-margin-inline-start: 5rem; /* 80px */ |
scroll-me-20 | scroll-margin-inline-end: 5rem; /* 80px */ |
scroll-mt-20 | scroll-margin-top: 5rem; /* 80px */ |
scroll-mr-20 | scroll-margin-right: 5rem; /* 80px */ |
scroll-mb-20 | scroll-margin-bottom: 5rem; /* 80px */ |
scroll-ml-20 | scroll-margin-left: 5rem; /* 80px */ |
scroll-m-24 | scroll-margin: 6rem; /* 96px */ |
scroll-mx-24 | scroll-margin-left: 6rem; /* 96px */ scroll-margin-right: 6rem; /* 96px */ |
scroll-my-24 | scroll-margin-top: 6rem; /* 96px */ scroll-margin-bottom: 6rem; /* 96px */ |
scroll-ms-24 | scroll-margin-inline-start: 6rem; /* 96px */ |
scroll-me-24 | scroll-margin-inline-end: 6rem; /* 96px */ |
scroll-mt-24 | scroll-margin-top: 6rem; /* 96px */ |
scroll-mr-24 | scroll-margin-right: 6rem; /* 96px */ |
scroll-mb-24 | scroll-margin-bottom: 6rem; /* 96px */ |
scroll-ml-24 | scroll-margin-left: 6rem; /* 96px */ |
scroll-m-28 | scroll-margin: 7rem; /* 112px */ |
scroll-mx-28 | scroll-margin-left: 7rem; /* 112px */ scroll-margin-right: 7rem; /* 112px */ |
scroll-my-28 | scroll-margin-top: 7rem; /* 112px */ scroll-margin-bottom: 7rem; /* 112px */ |
scroll-ms-28 | scroll-margin-inline-start: 7rem; /* 112px */ |
scroll-me-28 | scroll-margin-inline-end: 7rem; /* 112px */ |
scroll-mt-28 | scroll-margin-top: 7rem; /* 112px */ |
scroll-mr-28 | scroll-margin-right: 7rem; /* 112px */ |
scroll-mb-28 | scroll-margin-bottom: 7rem; /* 112px */ |
scroll-ml-28 | scroll-margin-left: 7rem; /* 112px */ |
scroll-m-32 | scroll-margin: 8rem; /* 128px */ |
scroll-mx-32 | scroll-margin-left: 8rem; /* 128px */ scroll-margin-right: 8rem; /* 128px */ |
scroll-my-32 | scroll-margin-top: 8rem; /* 128px */ scroll-margin-bottom: 8rem; /* 128px */ |
scroll-ms-32 | scroll-margin-inline-start: 8rem; /* 128px */ |
scroll-me-32 | scroll-margin-inline-end: 8rem; /* 128px */ |
scroll-mt-32 | scroll-margin-top: 8rem; /* 128px */ |
scroll-mr-32 | scroll-margin-right: 8rem; /* 128px */ |
scroll-mb-32 | scroll-margin-bottom: 8rem; /* 128px */ |
scroll-ml-32 | scroll-margin-left: 8rem; /* 128px */ |
scroll-m-36 | scroll-margin: 9rem; /* 144px */ |
scroll-mx-36 | scroll-margin-left: 9rem; /* 144px */ scroll-margin-right: 9rem; /* 144px */ |
scroll-my-36 | scroll-margin-top: 9rem; /* 144px */ scroll-margin-bottom: 9rem; /* 144px */ |
scroll-ms-36 | scroll-margin-inline-start: 9rem; /* 144px */ |
scroll-me-36 | scroll-margin-inline-end: 9rem; /* 144px */ |
scroll-mt-36 | scroll-margin-top: 9rem; /* 144px */ |
scroll-mr-36 | scroll-margin-right: 9rem; /* 144px */ |
scroll-mb-36 | scroll-margin-bottom: 9rem; /* 144px */ |
scroll-ml-36 | scroll-margin-left: 9rem; /* 144px */ |
scroll-m-40 | scroll-margin: 10rem; /* 160px */ |
scroll-mx-40 | scroll-margin-left: 10rem; /* 160px */ scroll-margin-right: 10rem; /* 160px */ |
scroll-my-40 | scroll-margin-top: 10rem; /* 160px */ scroll-margin-bottom: 10rem; /* 160px */ |
scroll-ms-40 | scroll-margin-inline-start: 10rem; /* 160px */ |
scroll-me-40 | scroll-margin-inline-end: 10rem; /* 160px */ |
scroll-mt-40 | scroll-margin-top: 10rem; /* 160px */ |
scroll-mr-40 | scroll-margin-right: 10rem; /* 160px */ |
scroll-mb-40 | scroll-margin-bottom: 10rem; /* 160px */ |
scroll-ml-40 | scroll-margin-left: 10rem; /* 160px */ |
scroll-m-44 | scroll-margin: 11rem; /* 176px */ |
scroll-mx-44 | scroll-margin-left: 11rem; /* 176px */ scroll-margin-right: 11rem; /* 176px */ |
scroll-my-44 | scroll-margin-top: 11rem; /* 176px */ scroll-margin-bottom: 11rem; /* 176px */ |
scroll-ms-44 | scroll-margin-inline-start: 11rem; /* 176px */ |
scroll-me-44 | scroll-margin-inline-end: 11rem; /* 176px */ |
scroll-mt-44 | scroll-margin-top: 11rem; /* 176px */ |
scroll-mr-44 | scroll-margin-right: 11rem; /* 176px */ |
scroll-mb-44 | scroll-margin-bottom: 11rem; /* 176px */ |
scroll-ml-44 | scroll-margin-left: 11rem; /* 176px */ |
scroll-m-48 | scroll-margin: 12rem; /* 192px */ |
scroll-mx-48 | scroll-margin-left: 12rem; /* 192px */ scroll-margin-right: 12rem; /* 192px */ |
scroll-my-48 | scroll-margin-top: 12rem; /* 192px */ scroll-margin-bottom: 12rem; /* 192px */ |
scroll-ms-48 | scroll-margin-inline-start: 12rem; /* 192px */ |
scroll-me-48 | scroll-margin-inline-end: 12rem; /* 192px */ |
scroll-mt-48 | scroll-margin-top: 12rem; /* 192px */ |
scroll-mr-48 | scroll-margin-right: 12rem; /* 192px */ |
scroll-mb-48 | scroll-margin-bottom: 12rem; /* 192px */ |
scroll-ml-48 | scroll-margin-left: 12rem; /* 192px */ |
scroll-m-52 | scroll-margin: 13rem; /* 208px */ |
scroll-mx-52 | scroll-margin-left: 13rem; /* 208px */ scroll-margin-right: 13rem; /* 208px */ |
scroll-my-52 | scroll-margin-top: 13rem; /* 208px */ scroll-margin-bottom: 13rem; /* 208px */ |
scroll-ms-52 | scroll-margin-inline-start: 13rem; /* 208px */ |
scroll-me-52 | scroll-margin-inline-end: 13rem; /* 208px */ |
scroll-mt-52 | scroll-margin-top: 13rem; /* 208px */ |
scroll-mr-52 | scroll-margin-right: 13rem; /* 208px */ |
scroll-mb-52 | scroll-margin-bottom: 13rem; /* 208px */ |
scroll-ml-52 | scroll-margin-left: 13rem; /* 208px */ |
scroll-m-56 | scroll-margin: 14rem; /* 224px */ |
scroll-mx-56 | scroll-margin-left: 14rem; /* 224px */ scroll-margin-right: 14rem; /* 224px */ |
scroll-my-56 | scroll-margin-top: 14rem; /* 224px */ scroll-margin-bottom: 14rem; /* 224px */ |
scroll-ms-56 | scroll-margin-inline-start: 14rem; /* 224px */ |
scroll-me-56 | scroll-margin-inline-end: 14rem; /* 224px */ |
scroll-mt-56 | scroll-margin-top: 14rem; /* 224px */ |
scroll-mr-56 | scroll-margin-right: 14rem; /* 224px */ |
scroll-mb-56 | scroll-margin-bottom: 14rem; /* 224px */ |
scroll-ml-56 | scroll-margin-left: 14rem; /* 224px */ |
scroll-m-60 | scroll-margin: 15rem; /* 240px */ |
scroll-mx-60 | scroll-margin-left: 15rem; /* 240px */ scroll-margin-right: 15rem; /* 240px */ |
scroll-my-60 | scroll-margin-top: 15rem; /* 240px */ scroll-margin-bottom: 15rem; /* 240px */ |
scroll-ms-60 | scroll-margin-inline-start: 15rem; /* 240px */ |
scroll-me-60 | scroll-margin-inline-end: 15rem; /* 240px */ |
scroll-mt-60 | scroll-margin-top: 15rem; /* 240px */ |
scroll-mr-60 | scroll-margin-right: 15rem; /* 240px */ |
scroll-mb-60 | scroll-margin-bottom: 15rem; /* 240px */ |
scroll-ml-60 | scroll-margin-left: 15rem; /* 240px */ |
scroll-m-64 | scroll-margin: 16rem; /* 256px */ |
scroll-mx-64 | scroll-margin-left: 16rem; /* 256px */ scroll-margin-right: 16rem; /* 256px */ |
scroll-my-64 | scroll-margin-top: 16rem; /* 256px */ scroll-margin-bottom: 16rem; /* 256px */ |
scroll-ms-64 | scroll-margin-inline-start: 16rem; /* 256px */ |
scroll-me-64 | scroll-margin-inline-end: 16rem; /* 256px */ |
scroll-mt-64 | scroll-margin-top: 16rem; /* 256px */ |
scroll-mr-64 | scroll-margin-right: 16rem; /* 256px */ |
scroll-mb-64 | scroll-margin-bottom: 16rem; /* 256px */ |
scroll-ml-64 | scroll-margin-left: 16rem; /* 256px */ |
scroll-m-72 | scroll-margin: 18rem; /* 288px */ |
scroll-mx-72 | scroll-margin-left: 18rem; /* 288px */ scroll-margin-right: 18rem; /* 288px */ |
scroll-my-72 | scroll-margin-top: 18rem; /* 288px */ scroll-margin-bottom: 18rem; /* 288px */ |
scroll-ms-72 | scroll-margin-inline-start: 18rem; /* 288px */ |
scroll-me-72 | scroll-margin-inline-end: 18rem; /* 288px */ |
scroll-mt-72 | scroll-margin-top: 18rem; /* 288px */ |
scroll-mr-72 | scroll-margin-right: 18rem; /* 288px */ |
scroll-mb-72 | scroll-margin-bottom: 18rem; /* 288px */ |
scroll-ml-72 | scroll-margin-left: 18rem; /* 288px */ |
scroll-m-80 | scroll-margin: 20rem; /* 320px */ |
scroll-mx-80 | scroll-margin-left: 20rem; /* 320px */ scroll-margin-right: 20rem; /* 320px */ |
scroll-my-80 | scroll-margin-top: 20rem; /* 320px */ scroll-margin-bottom: 20rem; /* 320px */ |
scroll-ms-80 | scroll-margin-inline-start: 20rem; /* 320px */ |
scroll-me-80 | scroll-margin-inline-end: 20rem; /* 320px */ |
scroll-mt-80 | scroll-margin-top: 20rem; /* 320px */ |
scroll-mr-80 | scroll-margin-right: 20rem; /* 320px */ |
scroll-mb-80 | scroll-margin-bottom: 20rem; /* 320px */ |
scroll-ml-80 | scroll-margin-left: 20rem; /* 320px */ |
scroll-m-96 | scroll-margin: 24rem; /* 384px */ |
scroll-mx-96 | scroll-margin-left: 24rem; /* 384px */ scroll-margin-right: 24rem; /* 384px */ |
scroll-my-96 | scroll-margin-top: 24rem; /* 384px */ scroll-margin-bottom: 24rem; /* 384px */ |
scroll-ms-96 | scroll-margin-inline-start: 24rem; /* 384px */ |
scroll-me-96 | scroll-margin-inline-end: 24rem; /* 384px */ |
scroll-mt-96 | scroll-margin-top: 24rem; /* 384px */ |
scroll-mr-96 | scroll-margin-right: 24rem; /* 384px */ |
scroll-mb-96 | scroll-margin-bottom: 24rem; /* 384px */ |
scroll-ml-96 | scroll-margin-left: 24rem; /* 384px */ |
Functionality of Tailwind CSS Scroll Margin Classes
- scroll-m-*: Sets the scroll margin for all sides of an element.
- scroll-mx-*: Sets the horizontal scroll margin (left and right).
- scroll-my-*: Sets the vertical scroll margin (top and bottom).
- scroll-mt-*: Sets the top scroll margin.
- scroll-mr-*: Sets the right scroll margin.
- scroll-mb-*: Sets the bottom scroll margin.
- scroll-ml-*: Sets the left scroll margin.
- scroll-ms-*: Sets the scroll margin at inline start (left in LTR languages).
- scroll-me-*: Sets the scroll margin at the inline end.
In scroll-(className)-*, the * can be replaced with size values like 0, px, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96.
Size Increments:
- px: Size is 1px
- 0.5 to 4: Increases by 2px
- 4 to 12: Increases by 4px
- 12 to 16: Increases by 8px
- 16 to 64: Increases by 16px
- 64 to 80: Increases by 32px
- 80 to 96: Increases by 64px
Where 0 means no margin and 96 means a scroll margin of 24rem (384px).
Tailwind CSS Scroll Margin Class Examples
Below are examples of Tailwind CSS Scroll Margin classes, which show how to adjust the space around elements when they come into view, ensuring they are properly positioned and visible in the viewport.
Applying Scroll Margin Class with Tailwind CSS
This example shows how Tailwind CSS Scroll Margin classes can be used to apply different scroll margin styles. Use the scroll-* utilities to adjust the scroll margin appearance according to your needs. This shows how adding a bottom margin affects vertical scrolling and snapping behavior.
Example
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="p-4"> <h2 class="text-2xl font-bold mb-4"> Tailwind CSS Scroll Margin </h2> <h3 class="underline font-bold mb-4"> Scroll Margin Bottom Example </h3> <div class="max-h-32 snap-y overflow-y-auto border border-gray-300 p-2 bg-gray-100"> <div class="scroll-mb-6 h-48 bg-yellow-200 mb-6"> Section with Scroll Margin Bottom </div> <div class="scroll-mb-6 h-48 bg-blue-200 mb-6"> Another Section </div> <div class="scroll-mb-6 h-48 bg-green-200 mb-6"> Final Section </div> </div> <p class="mt-4 text-sm text-gray-700"> Scroll down to see the extra space below each box due to the <strong>scroll-mb-6</strong> class. </p> </body> </html>
Scroll Margin Right in Tailwind CSS
This example shows how to use the scroll-mr-6 class to add extra space to the right of each image in a horizontally scrollable container, creating space between the images while scrolling.
Example
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="p-4"> <h2 class="text-2xl font-bold mb-4"> Tailwind CSS Scroll Margin </h2> <h3 class="underline font-bold mb-4"> Scroll Margin Right Example </h3> <div class="flex overflow-x-auto border snap-x border-gray-300 p-2 bg-gray-100"> <div class="scroll-mr-6 mr-6 snap-end w-60 h-40 flex-shrink-0 bg-gray-300"> <img src="https://picsum.photos/600/400?random=1"> </div> <div class="scroll-mr-6 mr-6 snap-end w-60 h-40 flex-shrink-0 bg-gray-300"> <img src="https://picsum.photos/600/400?random=2"> </div> <div class="scroll-mr-6 mr-6 snap-end w-60 h-40 flex-shrink-0 bg-gray-300"> <img src="https://picsum.photos/600/400?random=3"> </div> <div class="scroll-mr-6 mr-6 snap-end w-60 h-40 flex-shrink-0 bg-gray-300"> <img src="https://picsum.photos/600/400?random=4"> </div> <div class="scroll-mr-6 mr-6 snap-end w-60 h-40 flex-shrink-0 bg-gray-300"> <img src="https://picsum.photos/600/400?random=5"> </div> </div> <p class="mt-4 text-sm text-gray-700"> Scroll horizontally to see the extra space between images due to <strong>scroll-mr-6</strong> class. </p> </body> </html>