{"componentChunkName":"component---src-templates-tailwindclass-js","path":"/tailwindcss/classes/tailwind-background-origin/","result":{"data":{"site":{"siteMetadata":{"title":"Resources to help developers | Contrast | Devwares","docsLocation":""}},"mdx":{"fields":{"id":"662730a0-323b-5f0f-a03d-ab058de91d3d","title":"Tailwind CSS Background Origin","slug":"/classes/tailwind-background-origin/"},"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\": \"17 May 2024\",\n  \"title\": \"Tailwind CSS Background Origin\",\n  \"metaTitle\": \"Tailwind Background Origin\",\n  \"metaDescription\": \"The bg-{origin} utility class in Tailwind CSS allows you to control the position origin of background images applied to elements. With Tailwind background origin class, you can easily adjust where the background image originates within the element box model.\",\n  \"canonicalUrl\": \"https://windframe.dev/tailwind/classes/tailwind-background-origin\"\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 Origin\"), mdx(\"p\", null, \"The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"bg-{origin}\"), \" utility class in Tailwind CSS allows you to control the position origin of background images applied to elements. With Tailwind background origin class, you can easily adjust where the background image originates within the element's box model.\"), mdx(\"h2\", null, \"Applying Tailwind Background Origin\"), mdx(\"p\", null, \"To apply a specific tailwind background origin to an element, you can use the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"bg-{origin}\"), \" utility class, where \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{origin}\"), \" represents the desired background origin. Here are some common values you can use:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-origin-border\"), \": The background image originates from the border box.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-origin-padding\"), \": The background image originates from the padding box.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"bg-origin-content\"), \": The background image originates from the content box.\\nHere's an example:\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-html\"\n  }, \"<div class=\\\"bg-origin-padding\\\">\\n  This element has a background image that originates from the padding box.\\n</div>\\n\")), mdx(\"h2\", null, \"Preview\"), mdx(\"div\", {\n    className: \"rounded-t-xl overflow-hidden bg-green-100 p-10\"\n  }, mdx(\"div\", {\n    className: \"flex flex-row justify-center items-center align-middle\"\n  }, mdx(\"div\", {\n    className: \"bg-origin-padding w-64 h-64 p-6 rounded-md bg-green-600 border-4 border-green-300 border-dashed font-extrabold text-white flex justify-center items-center\"\n  }, \" This element has a background image that originates from the padding box.\"))), mdx(\"h2\", null, \"Responsive Tailwind Background Origin\"), mdx(\"p\", null, \"Tailwind CSS allows you to apply background origin classes responsively at different breakpoints. To use responsive tailwind background origin classes, you can append the breakpoint prefix to the utility class. For example, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"md:bg-origin-content\"), \" sets the background origin to the content box starting from the medium breakpoint and above.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-html\"\n  }, \"<div class=\\\"bg-origin-border md:bg-origin-content\\\">\\n  This element has a background image that originates from the border box by default, but starting\\n  from the medium breakpoint and above, it changes to originate from the content box.\\n</div>\\n\")), mdx(\"p\", null, \"In the above example, the tailwind background origin of the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"<div>\"), \" element is set to the border box by default \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(bg-origin-border)\"), \", but starting from the medium breakpoint and above, it changes to originate from the content box \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(md:bg-origin-content)\"), \".\"), mdx(\"h2\", null, \"Tailwind Background Origin 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-origin-border\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-origin: border-box;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-origin-padding\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-origin: padding-box;\")), mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"bg-origin-content\"), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"background-origin: content-box;\")))), 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-origin","title":"Tailwind Background Origin","items":[{"url":"#applying-tailwind-background-origin","title":"Applying Tailwind Background Origin"},{"url":"#preview","title":"Preview"},{"url":"#responsive-tailwind-background-origin","title":"Responsive Tailwind Background Origin"},{"url":"#tailwind-background-origin-class-table","title":"Tailwind Background Origin Class Table"},{"url":"#windframe-tailwind-blocks","title":"Windframe Tailwind blocks"}]}]},"parent":{"__typename":"File","relativePath":"classes/tailwind-background-origin.md"},"frontmatter":{"githubUrl":null,"metaTitle":"Tailwind Background Origin","lastUpdated":"17 May 2024","metaDescription":"The bg-{origin} utility class in Tailwind CSS allows you to control the position origin of background images applied to elements. With Tailwind background origin class, you can easily adjust where the background image originates within the element box model."}}},"pageContext":{"id":"662730a0-323b-5f0f-a03d-ab058de91d3d"}},"staticQueryHashes":["2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","2619113677","3309287076","3309287076","3706406642","3706406642","3706406642","4045616534","4045616534","956403285"]}