{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/unknown-parts-of-css-the-all-property","result":{"data":{"markdownRemark":{"excerpt":"Hello... well, i'm back. This is my first post in 2020 and today i'm going to talk about the unknown parts of CSS or should i say \"lesser…","html":"<p>Hello... well, i'm back.</p>\n<p>This is my first post in 2020 and today i'm going to talk about the unknown parts of CSS or should i say \"lesser known\" parts of CSS. </p>\n<p>Maybe i will make this a long topic in near future named <strong>\"The Unknown Parts of CSS\"</strong> but lets get into it.</p>\n<p>Lets start with the <code class=\"language-text\">all</code> property. You might not heard of it but trust me CSS all property is really handy in some situations.</p>\n<p>So you might be thinking what does <code class=\"language-text\">all</code> property do?</p>\n<h2 id=\"What-it-does-\"><a href=\"#What-it-does-\" aria-label=\"What it does  permalink\" class=\"gatsby-remark-autolink\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What it does 🤔</h2>\n<p>CSS all property basically resets properties which are set previously in any element.</p>\n<p>It is useful for making component-scoped CSS where you might want to reset all the properties of an element and start from scratch, or maybe sometimes you need to reset some styles instead of using <code class=\"language-text\">!important</code> everywhere. </p>\n<p>Here's a typical scenario where you want to reset the <strong>a</strong> tag's styles.</p>\n<div class=\"gatsby-highlight\" data-language=\"css\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-css line-numbers\"><code class=\"language-css\"><span class=\"token selector\">a</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token property\">border</span><span class=\"token punctuation\">:</span> 1px solid black<span class=\"token punctuation\">;</span>\n  <span class=\"token property\">font-size</span><span class=\"token punctuation\">:</span> 24px<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token selector\">a</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token comment\">/* it will reset all the previous styles 🤯 */</span>\n  <span class=\"token property\">all</span><span class=\"token punctuation\">:</span> unset<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Yup! that is really useful and handy.\nthe <code class=\"language-text\">all</code> property could take one of the following values</p>\n<ul>\n<li><strong>initial</strong><br>\nSpecifies that all the element's properties should be changed to their initial values.</li>\n<li><strong>inherit</strong><br>\nSpecifies that all the element's properties should be changed to their inherited values.</li>\n<li><strong>unset</strong><br>\nSpecifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not. </li>\n</ul>\n<h2 id=\"Demo-🤯\"><a href=\"#Demo-%F0%9F%A4%AF\" aria-label=\"Demo 🤯 permalink\" class=\"gatsby-remark-autolink\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Demo 🤯</h2>\n<p><iframe src=\"https://codepen.io/anuraghazra/embed/preview/VwLxaGV?default-tab=results,css\" style=\"width:100%; height:300px;\"></iframe></p>\n<p>As you can see how the link is affected by the <code class=\"language-text\">all</code> property. and it resets the styles.</p>\n<h2 id=\"Browser-Support-\"><a href=\"#Browser-Support-\" aria-label=\"Browser Support  permalink\" class=\"gatsby-remark-autolink\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Browser Support 📊</h2>\n<p>Browser support is also pretty nice with the exception of IE11 and Opera Mini. (rip them)</p>\n<p><figure class=\"gatsby-resp-image-figure\" style=\"\">\n    <span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto;  max-width: 590px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/b905a79658fa14d85db6aef37144b882/7ae9c/caniuse_css_all.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 42.567567567567565%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAA7DAAAOwwHHb6hkAAACD0lEQVQoz3WS3UtTcRjHz//WhVQgdGO2RJCksiIMyUYRhBEU0WyxTNMQ3yjQlGyISTcWbtO92txx2zlnm565ne2cvfhyUVeffmdz0Y0XH57f+T58n/P9/XikgrpJUdviQNmioPow9wKclHc5MhIcl2RB4hS5oR0Wdxr1LCQ9vcl+KkBu14ee8qOn/WJwkFI2TDEToqCFMDLirAWpF+L/hp6FVEhvUFQCjSE2trmmb1PLn7IXFN9R6vlfHAnDsZ3ETvlf0lZ6uycdBlxUVC+GIVMSgiFSWKaMaSYxDmJU4xMc5n9SP9KpGnEqeoya6FWtJNZ+lIrArlXxc0v0pJwWJTUzjjr3nuz4CzIfx5GnJlBmR1FmRoTmIjPlYWfsFZm1efJJP8rCGInJlxSSAXTZTzzqI5vYQIusIm0O3eWxp4Ohdw4eDrfzfKybJ57LPH3byTNbc19iaMTBA3c73pVhqukQb6bv8Oh1O2GXk+1ZF6rmQ02uo6bWkb52tXFt5RZXv/RyztvBxYVOzi9foW2pgwtLnXR/66PHexPH99u4PdcJ9fdy79MNutb6GBh1MDDZg3NtkMHFfpyr95HK4v61XAxN+cFcaJTl2DSfo5PMRz6wKGo5G6SSi2DlwpiZIGWxYpbYAEto9hsX9QjF3JYg2EBq7prMSWmXP6bCbzMtahP73Oo3EPvZoOUxbF/T2+IvyChY8wi5emAAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Browser Support Chart For CSS all Property\"\n        title=\"Browser Support Chart For CSS all Property\"\n        src=\"/static/b905a79658fa14d85db6aef37144b882/fcda8/caniuse_css_all.png\"\n        srcset=\"/static/b905a79658fa14d85db6aef37144b882/12f09/caniuse_css_all.png 148w,\n/static/b905a79658fa14d85db6aef37144b882/e4a3f/caniuse_css_all.png 295w,\n/static/b905a79658fa14d85db6aef37144b882/fcda8/caniuse_css_all.png 590w,\n/static/b905a79658fa14d85db6aef37144b882/efc66/caniuse_css_all.png 885w,\n/static/b905a79658fa14d85db6aef37144b882/7ae9c/caniuse_css_all.png 972w\"\n        sizes=\"(max-width: 590px) 100vw, 590px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n  </a>\n    </span>\n    <figcaption class=\"gatsby-resp-image-figcaption\">Browser Support Chart For CSS all Property</figcaption>\n  </figure></p>\n<h3 id=\"Read-more-\"><a href=\"#Read-more-\" aria-label=\"Read more  permalink\" class=\"gatsby-remark-autolink\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Read more 📖</h3>\n<ul>\n<li><a href=\"https://css-tricks.com/almanac/properties/a/all/\">CSS Tricks All Property</a></li>\n<li><a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/all\">MDN Docs</a></li>\n<li><a href=\"https://caniuse.com/#feat=css-all\">CanIUse Browser Support</a></li>\n</ul>\n<p>🙏 Thanks for reading! hope you liked the post.\nI will be writing more short blogs about CSS's unknown parts so stay tuned. Have a nice day bye! 👋</p>\n<p><em>Comment down if you want to see more tricks and tricks about CSS</em></p>","timeToRead":2,"id":"c84619d2-94d9-53d9-ae34-f109e938686c","frontmatter":{"date":"March 15, 2020","title":"Unknown parts of CSS - The 'all' property"}}},"pageContext":{"slug":"/blog/unknown-parts-of-css-the-all-property"}},"staticQueryHashes":["1033876704","3435786681","550521386"]}