- 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 - background-position-y Property
The background-position-y property sets the initial vertical position of the element's background image. The position of the image is relative to the value set by background-origin property.
The value of background-position-y gets overridden if background or background-position declarations are made on the element after it.
Possible Values
The value for this property can be specified as one or more values, separated by commas.
top: Top edge of the background image is aligned with the top edge of background position layer.
center: Center of the background image is aligned with the center of the background position layer.
bottom: Bottom edge of the background image is aligned with the bottom edge of background position layer.
<length>: It is the offset of the horizontal edge of background image from the background position layer's top horizontal edge.
<percentage>: It is the offset of the vertical position of the background image relative to the containing element.
0%: top edge of the background image is aligned with top edge of the container.
100%: bottom edge of the background image is aligned with bottom edge of the container.
50%: vertically centered background image.
Applies to
All the HTML elements.
DOM Syntax
object.style.backgroundPositionY = "top 50px";
CSS background-position-y - top Value
Here is an example where the image is positioned vertically on top:
<html> <head> <style> .position-y-top { background-image: url('images/tutimg.png'); background-position-y: top; background-repeat: no-repeat; width: 500px; height: 300px; border: 3px solid black; position: relative; } </style> </head> <body> <div class="position-y-top"></div> </body> </html>
CSS background-position-y - bottom Value
Here is an example where the image is positioned vertically at bottom:
<html> <head> <style> .position-y-bottom { background-image: url('images/tutimg.png'); background-position-y: bottom; background-repeat: no-repeat; width: 500px; height: 300px; border: 3px solid black; position: relative; } </style> </head> <body> <div class="position-y-bottom"></div> </body> </html>
CSS background-position-y - center Value
Here is an example where the image is positioned vertically in center:
<html> <head> <style> .position-y-center { background-image: url('images/tutimg.png'); background-position-y: center; background-repeat: no-repeat; width: 500px; height: 300px; border: 3px solid black; position: relative; } </style> </head> <body> <div class="position-y-center"></div> </body> </html>
CSS background-position-y - <length> Value
Here is an example where the image is positioned vertically using a length value:
<html> <head> <style> .position-y-length { background-image: url('images/tutimg.png'); background-position-y: 100px; background-repeat: no-repeat; width: 500px; height: 300px; border: 3px solid black; position: relative; } </style> </head> <body> <div class="position-y-length"></div> </body> </html>
CSS background-position-y - <percentage> Value
Here is an example where the image is positioned vertically using a percentage value:
<html> <head> <style> .position-y-percent { background-image: url('images/tutimg.png'); background-position-y: 80%; background-repeat: no-repeat; width: 500px; height: 300px; border: 3px solid black; position: relative; } </style> </head> <body> <div class="position-y-percent"></div> </body> </html>
To Continue Learning Please Login
Login with Google