{"componentChunkName":"component---src-templates-tailwindclass-js","path":"/tailwindcss/classes/tailwind-background-repeat/","result":{"data":{"site":{"siteMetadata":{"title":"Resources to help developers | Contrast | Devwares","docsLocation":""}},"mdx":{"fields":{"id":"0e37d840-0c95-51e3-b03a-0a8610a9d354","title":"Tailwind CSS Background Repeat","slug":"/classes/tailwind-background-repeat/"},"body":"var _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"lastUpdated\": \"20 May 2024\",\n  \"title\": \"Tailwind CSS Background Repeat\",\n  \"metaTitle\": \"Tailwind Background Repeat\",\n  \"metaDescription\": \"The bg-{repeat} utility class in Tailwind CSS allows you to control the repetition behavior of background images applied to elements. With Tailwind background repeat class, you can easily adjust how background images are repeated to achieve the desired visual effect.\",\n  \"canonicalUrl\": \"https://windframe.dev/tailwind/classes/tailwind-background-repeat\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h1\", null, \"Tailwind Background Repeat\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"bg-{repeat}\"), \" utility class in Tailwind CSS allows you to control the repetition behavior of background images applied to elements. With Tailwind background repeat class, you can easily adjust how background images are repeated to achieve the desired visual effect.\"), mdx(\"h2\", null, \"Applying Tailwind Background Repeat\"), mdx(\"p\", null, \"To apply a specific tailwind background repeat behavior to an element, you can use the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"bg-{repeat}\"), \" utility class, where \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{repeat}\"), \" represents the desired background repeat behavior. Here are some common values you can use:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-repeat\"), \": The background image is repeated both horizontally and vertically.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-no-repeat\"), \": The background image is not repeated, appearing only once.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-repeat-x\"), \": The background image is repeated horizontally but not vertically.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-repeat-y\"), \": The background image is repeated vertically but not horizontally.\\nHere's an example:\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-html\"\n  }, \"<div class=\\\"bg-repeat\\\">\\n  This element has a background image that is repeated both horizontally and vertically.\\n</div>\\n\")), mdx(\"h2\", null, \"Preview\"), mdx(\"div\", {\n    className: \"rounded-xl overflow-hidden bg-gray-100 p-10\"\n  }, mdx(\"div\", {\n    className: \"w-full mx-auto max-w-xl h-80 border-4 bg-repeat bg-center shadow-xl rounded-lg\",\n    style: {\n      \"backgroundImage\": \"url('https://images.unsplash.com/photo-1687789903431-54cdeb56bb43?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=256&h=256&q=80')\"\n    }\n  }, \" \")), mdx(\"h2\", null, \"Responsive Tailwind Background Repeat\"), mdx(\"p\", null, \"Tailwind CSS allows you to apply background repeat classes responsively at different breakpoints. To use responsive tailwind background repeat classes, you can append the breakpoint prefix to the utility class. For example, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"md:bg-no-repeat\"), \" sets the background to not repeat starting from the medium breakpoint and above.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-html\"\n  }, \"<div class=\\\"bg-no-repeat md:bg-repeat\\\">\\n  This element has a background image that doesn't repeat by default, but starting from the medium\\n  breakpoint and above, it repeats both horizontally and vertically.\\n</div>\\n\")), mdx(\"p\", null, \"In the above example, the tailwind background repeat behavior of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<div>\"), \" element is set to not repeat by default \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(bg-no-repeat)\"), \", but starting from the medium breakpoint and above, it changes to repeat both horizontally and vertically \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(md:bg-repeat)\"), \".\"), mdx(\"h2\", null, \"Tailwind Background Repeat Class Table\"), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Class\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Properties\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-repeat\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: repeat;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-no-repeat\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: no-repeat;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-repeat-x\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: repeat-x;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-repeat-y\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: repeat-y;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-repeat-round\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: round;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-repeat-space\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-repeat: space;\")))), mdx(\"h2\", null, \"Windframe Tailwind blocks\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://app.windframe.dev/editor?id=timelines1\"\n  }, \"Timeline\")));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#tailwind-background-repeat","title":"Tailwind Background Repeat","items":[{"url":"#applying-tailwind-background-repeat","title":"Applying Tailwind Background Repeat"},{"url":"#preview","title":"Preview"},{"url":"#responsive-tailwind-background-repeat","title":"Responsive Tailwind Background Repeat"},{"url":"#tailwind-background-repeat-class-table","title":"Tailwind Background Repeat Class Table"},{"url":"#windframe-tailwind-blocks","title":"Windframe Tailwind blocks"}]}]},"parent":{"__typename":"File","relativePath":"classes/tailwind-background-repeat.md"},"frontmatter":{"githubUrl":null,"metaTitle":"Tailwind Background Repeat","lastUpdated":"20 May 2024","metaDescription":"The bg-{repeat} utility class in Tailwind CSS allows you to control the repetition behavior of background images applied to elements. With Tailwind background repeat class, you can easily adjust how background images are repeated to achieve the desired visual effect."}}},"pageContext":{"id":"0e37d840-0c95-51e3-b03a-0a8610a9d354"}},"staticQueryHashes":["2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","3309287076","3309287076","3706406642","3706406642","3706406642","4045616534","4045616534","956403285"]}