- 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 - offset-position Property
The CSS property offset-position is used to provide an element's starting location along a route.
Often used in combination with the offset-path attribute, it produces a motion effect.
If the offset-path function does not define its own beginning position, offset-position is utilized to determine the element's initial placement.
A motion system that includes offset related features like offset-anchor, offset-distance, and offset-path also includes the offset-position property.
Together, these characteristics provide a variety of motion effects along a set path.
Possible Values
The following list of values are accepted by offset-position property.
normal - This option places the element at (50%, 50%) with respect to the contained block, indicating that it does not have an initial offset position.
auto - This value indicates that the top-left corner of the element's box is the initial offset position, the default option.
<length-percentage> - The offset-position property determines an element's position relative to its box edges using x/y coordinates, with values ranging from one to four representing horizontal and vertical positions.
Applies to
Transformable elements
Syntax
offset-position = normal | auto | <position>
CSS offset-position - Initializing an offset-path's offset-position
The following example demonstrates the usage of offset-position property.
<html> <head> <style> .container { width: 80%; height: 400px; position: relative; overflow: hidden; background-color: #c6d8f5; } .object { width: 50px; height: 50px; background-color: #1169f7; position: absolute; border-radius: 20%; offset-path: path("M 50, 200 C 50, 100 250, 100 250, 200 S 450, 300 450, 200"); offset-position: top 10%; animation: moveObject 5s linear infinite; } @keyframes moveObject { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } </style> </head> <body> <div class="container"> <div class="object"></div> </div> </body> </html>
CSS offset-position - Comparing offset positions
The following example demonstrates the usage of offset-position property's various offset positions.
<html> <head> <style> .container { position: relative; height: 300px; background-color: #f0f0f0; margin: 50px auto; padding: 20px; } .box { width: 90px; height: 90px; background-color: #3477eb; position: absolute; border-radius: 40%; animation: moveObject 5s linear infinite; display: flex; justify-content: center; align-items: center; font-size: 16px; color: white; } @keyframes moveObject { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } .box-normal::after { content: "Normal"; } .box-center::after { content: "Center"; } .box-left-top::after { content: "Left Top"; } .box-right-bottom::after { content: "Right Bottom"; } .box-custom::after { content: "Custom (30% 70%)"; } .box-normal { offset-position: normal; top: 20px; left: 20px; } .box-center { offset-position: center; top: 20px; left: calc(50% - 25px); } .box-left-top { offset-position: left top; top: 20px; left: 20px; } .box-right-bottom { offset-position: right bottom; bottom: 20px; right: 20px; } .box-custom { offset-position: 30% 70%; top: calc(30% - 25px); left: calc(70% - 25px); } </style> </head> <body> <div class="container"> <div class="box box-normal"></div> <div class="box box-center"></div> <div class="box box-left-top"></div> <div class="box box-right-bottom"></div> <div class="box box-custom"></div> </div> </body> </html>
To Continue Learning Please Login
Login with Google