- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - margin-block-start Property
An element's logical block start margin is specified via the CSS property margin-block-start. The writing style, directionality, and text orientation of the element define its real physical margin.
Depending on the values specified for writing-mode, direction, and text-orientation, it corresponds to the margin-left, margin-top, margin-right, or margin-bottom property.
It's related to margin-block-end, margin-inline-start, and margin-inline-end, which together specify the element's remaining margins.
Possible Values
The following list covers all the possible values of margin-block-start property which are similar to margin-left property.
<length> - The fixed value of the margin's size.
<percentage> - The percentage of the margin measured in relation to the contained block's inline size, or the writing-mode defined width in a horizontal language.
auto - A percentage of the available horizontal space is allocated to the left margin, with the layout option selected playing a crucial part.
The spacing between the margin-left and margin-right values is equal when both of them are set to auto.
Applies to
All elements, except elements with table display types other than table-caption, table and inline-table. It also applies to ::first-letter.
Syntax
margin-block-start = <'margin-top'>
CSS margin-block-start - Length Value
The following example demonstrates the usage of margin-block-start with length value.
<html> <head> <style> body { background-color: #dfe4ed; } #customDIV { height: 400px; background-color: #edecb7; padding: 20px; } .marginDemo { width: 250px; background-color: #6c7cf5; border: 2px dashed black; margin-block-start: 25px; } .marginBox { width: 250px; background-color: #f5d902; text-align: center; padding: 10px; } </style> </head> <body> <h1>Explore the margin-block-start property</h1> <div id="customDIV"> <p>Yellow div elements emphasize margins around the blue box.</p> <div class="marginBox">box</div> <div class="marginDemo"> Example of margin-block-start property. </div> <div class="marginBox">box</div> </div> </body> </html>
CSS margin-block-start - Percentage Value
The following example demonstrates the usage of margin-block-start with percentage value.
<html> <head> <style> body { background-color: #dfe4ed; } #customDIV { height: 400px; background-color: #f0f0c5; padding: 20px; } .marginDemo { width: 250px; background-color: #db26de; border: 2px dashed black; margin-block-start: 5%; } .marginBox { width: 250px; background-color: #e8a53a; text-align: center; padding: 10px; } </style> </head> <body> <h1>Explore the margin-block-start property</h1> <div id="customDIV"> <p>Orange div elements emphasize margins around the purple box.</p> <div class="marginBox">box</div> <div class="marginDemo"> Example of margin-block-start property. </div> <div class="marginBox">box</div> </div> </body> </html>
CSS margin-block-start - auto Value
The following example demonstrates the usage of margin-block-start with auto value.
<html> <head> <style> body { background-color: #F2EFEF; } #customDIV { height: 400px; background-color: #FFEEA8; padding: 20px; } .marginDemo { width: 250px; background-color: #6495ED; border: 4px dashed #4682B4; margin-block-start: auto; } .marginBox { width: 250px; background-color: #FFA07A; text-align: center; padding: 10px; } </style> </head> <body> <h1>Explore the margin-block-start property</h1> <div id="customDIV"> <p>Orange div elements emphasize margins around the blue box.</p> <div class="marginBox">box</div> <div class="marginDemo"> Example of margin-block-start property. </div> <div class="marginDemo">box</div> </div> </body> </html>
CSS margin-block-start - writing-mode
The following example demonstrates the usage of margin-block-start with length value and writing-mode: vertical-rl.
<html> <head> <style> body { background-color: #F1ECEC; } #customDIV { height: 400px; background-color: #FFF7B0; padding: 20px; } .marginDemo { width: 50px; background-color: #8B78B6; border: 2px dashed black; margin-block-start: 25px; writing-mode: vertical-rl; } .marginBox { width: 250px; background-color: #F3994D; text-align: center; padding: 10px; } </style> </head> <body> <h1>Explore the margin-block-start property</h1> <div id="customDIV"> <p>Orange div elements emphasize margins around the purple box.</p> <div class="marginBox">box</div> <div class="marginDemo"> Example of margin-block-start property. </div> <div class="marginBox">box</div> </div> </body> </html>
To Continue Learning Please Login
Login with Google