CSS background-repeat Property
CSS background-repeat Property
CSS background-repeat
property sets how background images are repeated.
Example
Syntax
Using CSS
Using Javascript
Animatable
No, background-repeat property is not animatable. CSS Animatable Properties Reference.
Default Value
Default value for CSS background-repeat property is repeat.
Property Value
The following table provides a list of values for CSS background-repeat
property.
Value | Explanation |
---|---|
repeat | Specifies the background image is repeated both vertically and horizontally. |
repeat-x | Specifies the background image is repeated only in x-axis (horizontally). |
repeat-y | Specifies the background image is repeated only in y-axis (vertically). |
no-repeat | Specifies the background-image is not repeated. |
space | Specifies the background-image is repeated as much as possible without clipping. |
round | Specifies the background-image is repeated and squished or stretched to fill the space (no gaps). |
Using repeat-x
In the following example, we will repeat the background-image
only horizontally.
Example
Using repeat-y
In the following example, we will repeat the background-image
only vertically.
Example
Using space
In the following example, we will repeat the background-image
as much as possible without clipping.
Example
Using round
In the following example, we will repeat and squish or stretch the background-image
to fill the space (no gaps).
Example
Using JavaScript
In the following example, we will demonstrate how to change the CSS background-repeat
property of an element using JavaScript.
Example
Reminder
Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in CSS.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.