{"id":196155,"date":"2015-02-17T15:03:25","date_gmt":"2015-02-17T22:03:25","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=196155"},"modified":"2021-05-20T10:31:46","modified_gmt":"2021-05-20T17:31:46","slug":"background-repeat","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/b\/background-repeat\/","title":{"rendered":"background-repeat"},"content":{"rendered":"\n
If a These are the possible values for this property (besides the usual stuff like There is also the two value syntax:<\/p>\n\n\n\n Which makes the single-value syntaxes just shorthand for the two-value syntax. For example, You can also comma-separate multiple values if you’re dealing with multiple backgrounds<\/a>.<\/p>\n\n\nbackground-image<\/code> property is specified, the
background-repeat<\/code> property in CSS defines if (and how) it will repeat. Here’s an example:<\/p>\n\n\n\n
html {\n background-image: url(logo.png);\n background-repeat: repeat-x; \n}<\/code><\/pre>\n\n\n\n
inherit<\/code>):<\/p>\n\n\n\n
repeat<\/code>: tile the image in both directions. This is the default value.<\/li>
repeat-x<\/code>: tile the image horizontally<\/li>
repeat-y<\/code>: tile the image vertically<\/li>
no-repeat<\/code>: don’t tile, just show the image once<\/li>
space<\/code>: tile the image in both directions. Never crop the image unless a single image is too large to fit. If multiple images can fit, space them out evently images always touching the edges.<\/li>
round<\/code>: tile the image in both directions. Never crop the image unless a single image is too large to fit. If multiple images can fit with leftover space, squish them or stretch them to fill the space. If it’s less than half one image width left, stretch, if it’s more, stretch.<\/li><\/ul>\n\n\n\n
.element {\n\/* background-repeat: horizontal vertical *\/\n background-repeat: repeat space;\n background-repeat: repeat repeat;\n background-repeat: round space;\n}<\/code><\/pre>\n\n\n\n
round<\/code> is really
round round<\/code>.<\/p>\n\n\n\n
Demo<\/h3>\n\n\n