{"id":19110,"date":"2020-07-06T22:34:57","date_gmt":"2020-07-07T05:34:57","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19110"},"modified":"2020-12-29T11:47:18","modified_gmt":"2020-12-29T19:47:18","slug":"css-specificity","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/css-specificity\/","title":{"rendered":"CSS Specificity"},"content":{"rendered":"\n<p>The CSS Specificity concept is not only a little bit of a tongue twister (try to say it three times fast!), but it can also be a bit of a mind bender too! It\u2019s one of the more difficult concepts in CSS to grasp. In this article, we\u2019ll cover what we mean by specificity, how it\u2019s calculated, and how the ranking of selectors determines the style that is rendered on the page. So fret not! You\u2019ll be a specificity expert in no time.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What does \u2018specificity\u2019 mean?<\/h3>\n\n\n\n<p>CSS specificity basically refers to how important a selector is. Each selector is assigned a specificity depending on what type it is. The higher the number of the selector, the more specific it is and the likelier that that particular block of CSS will win the styling wars.&nbsp;<br><\/p>\n\n\n\n<p>Specificity is represented by four numbers, each separated by a comma:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Selector specificity = 0, 0, 0, 0<\/pre><\/div>\n\n\n\n<p>When we look at the specificity as a string of four numbers without the commas (i.e. 0000, 0101, 1001, etc.), the <strong><em>higher<\/em><\/strong> the number is, the <strong><em>more specific<\/em><\/strong> it is.&nbsp;<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Selectors\u2019 specificity by rank (low &#8211; high):<\/h3>\n\n\n\n<p>Let\u2019s walk through the different types of elements based on rank:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\uff0a&nbsp;<\/li><\/ul>\n\n\n\n<p>The universal selector. It\u2019s specificity is 0, 0, 0, 0. Usually you will see these at the top of style sheets. It\u2019s the lowest on the rank in terms of importance. Pretty much anything will override it or add to the universal selector CSS.&nbsp;<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\uff1e, &nbsp; \u2795,&nbsp; \u2018 &nbsp; \u2018 , &nbsp;\u223c&nbsp;<\/li><\/ul>\n\n\n\n<p>The combinators, usually seen when selecting a sibling of a child of a type selector or class selector, have no effect on specificity and do not count toward the overall number. Negation pseudo classes (:not) also fit into this specificity category.&nbsp;<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>div, form, ul, li, etc.<\/li><\/ul>\n\n\n\n<p>These are <strong>type<\/strong> selectors. These selectors pretty much encompass anything that could be considered a tag in your HTML. It\u2019s specificity weight is 0, 0, 0, 1. If you have multiple type selectors after another separated by a combinator, you\u2019ll add the selectors together:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>div li {} \u21d0 the specificity is 0,0,0,2\n\ndiv li p {} \u21d0 the specificity is 0,0,0,3<\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>.main-container, .navbar, [type=\u201dtext\u201d], :hover<\/li><\/ul>\n\n\n\n<p>Next in line for specificity is class, attribute and pseudo-class selectors.&nbsp;<\/p>\n\n\n\n<p>Class selectors are indicated by the dot (\u201c.\u201d) at the beginning. Attribute selectors have an attribute inside square brackets next to its type selector. The pseudo-class selector is reserved for special elements that need more specific styling. These have a specificity of 0, 0, 1, 0.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>div.navlink a {}<\/pre><\/div>\n\n\n\n<p>\u2013  The specificity is 0, 0, 1, 1 because we have one class selector and we have one type selector.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>div.header li.list-item-disc button[type=&quot;submit&quot;] {} <\/pre><\/div>\n\n\n\n<p>\u2013  The specificity is 0, 0, 3, 3 because we have 3 type selectors and 2 class selector + 1 attribute selector. If we took the attribute selector off, the specificity would be 0, 0, 2, 3. Because 23 is less than 33, the CSS selector with the 0, 0, 3, 3 specificity would win out because it has the higher specificity.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>#blue, #hidden, etc.&nbsp;<\/li><\/ul>\n\n\n\n<p>ID selectors have the highest specificity amongst the CSS selectors:&nbsp; 1, 0, 0, 0. Because of the unique nature of the ID attribute definition, we are usually styling a really specific element when we call up the ID in our CSS.&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>div#orange {}<\/pre><\/div>\n\n\n\n<p>\u2013  The specificity is 1, 0, 0, 1 because we have a type selector and an ID selector. Which style wins according to our specificity rules out of the following?&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>div#orange {\n\tbackground-color: orange;\n}\ndiv.square {\n\tbackground-color: green;\n\twidth: 150px;\n\theight: 150px;\n}<\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\"><li>The first div has a type selector and an ID selector, making it\u2019s overall specificity 1, 0, 0, 1.<\/li><li>The second div has a type selector and a class selector, making it\u2019s overall specificity 0, 0, 1, 1.&nbsp;<\/li><\/ol>\n\n\n\n<p>Since 1001 is greater than 11, the first div wins and the background-color will be orange, contrary to the cascading nature of the CSS.&nbsp;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Inline-style<\/li><\/ul>\n\n\n\n<p>How does inline-styling fit into all of this? It is even <em>more<\/em> specific than ID selectors. An inline-style will trump just about anything in your CSS file. It\u2019s weighted the highest in terms of specificity.&nbsp;<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>!important<\/code> rule<\/li><\/ul>\n\n\n\n<p>The <code>!important<\/code> keyword trumps everything. It is the most specific and will overwrite any previous rules set by CSS.&nbsp;<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Practice<\/h3>\n\n\n\n<p>In the code editor below, I created a page of sample containers with some random class names and ID names. I would like for you to take a moment and practice using your CSS skills to change specific elements to a different color while all other divs stay the same color. How would you write those rules in CSS? What would you use to get the highest specificity if that\u2019s what you needed to use to target a certain element.&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n   &lt;head&gt;\n       &lt;meta charset=&quot;UTF-8&quot; \/&gt;\n       &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; \/&gt;\n       &lt;title&gt;CSS Specificity&lt;\/title&gt;\n       &lt;style&gt;\n           body {\n               width: 100%;\n               max-width: 800px;\n               margin: 0 auto;\n           }\n \n           main {\n               width: 100%;\n               height: 800px;\n               display: flex;\n               flex-wrap: wrap;\n               flex-direction: column;\n           }\n \n           div {\n               text-align: center;\n           }\n           *.square {\n               \/* what does the star mean here? Does it add to the specificity number at all? How can you test your hypothesis?  *\/\n               height: 150px;\n               width: 150px;\n               background-color: black;\n               color: white;\n               margin: 20px;\n           }\n \n           div.flex {\n               \/* Does this compete with the other class at all? Or does it work in conjunction with the .square class? What would happen if we added a width and a height to this selector? Why does that happen?\n          \n               Does this override the div selector? Why? How does its specificity compare to the div selector's specificity?\n          \n               *\/\n               display: flex;\n               justify-content: center;\n               align-items: center;\n           }\n           div#red {\n               \/* why does this one win out? What is the specificity of this div? *\/\n               background-color: darkred;\n           }\n           #red {\n               \/* What would happen if we took the 'div' out of the previous selector? Which one wins?  *\/\n               background-color: red;\n           }\n \n           main &gt; div {\n               font-size: 55px;\n               font-weight: bold;\n           }\n \n           div#self-align {\n               \/*  What happens here?  *\/\n               align-self: center;\n           }\n       &lt;\/style&gt;\n   &lt;\/head&gt;\n   &lt;body&gt;\n       &lt;main&gt;\n           &lt;div id=&quot;self-align&quot; class=&quot;square flex&quot;&gt;1&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;2&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;3&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;4&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;5&lt;\/div&gt;\n           &lt;div id=&quot;red&quot; class=&quot;square flex&quot;&gt;6&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;7&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;8&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;9&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;10&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;11&lt;\/div&gt;\n           &lt;div class=&quot;square flex&quot;&gt;12&lt;\/div&gt;\n       &lt;\/main&gt;\n   &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<iframe loading=\"lazy\" frameborder=\"0\" width=\"100%\" height=\"400px\" src=\"https:\/\/repl.it\/@careerkarma\/CSS-Specificity?lite=true\"><\/iframe>\n<br>\n<br>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In this article we discussed CSS Specificity \u2013 specifically what selectors are more specific than others and how we figure out the actual specificity number. Don\u2019t be discouraged if it doesn\u2019t immediately come to you on the first read through. This is a lot of information to digest. Keep at it and you\u2019ll get it soon enough!<br><\/p>\n","protected":false},"excerpt":{"rendered":"The CSS Specificity concept is not only a little bit of a tongue twister (try to say it three times fast!), but it can also be a bit of a mind bender too! It\u2019s one of the more difficult concepts in CSS to grasp. In this article, we\u2019ll cover what we mean by specificity, how&hellip;","protected":false},"author":77,"featured_media":19111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17287],"tags":[],"class_list":{"0":"post-19110","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-css"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"CSS","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>CSS Specificity: A Step By Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/css-specificity\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Specificity\" \/>\n<meta property=\"og:description\" content=\"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/css-specificity\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T05:34:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-29T19:47:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christina Kopecky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"CSS Specificity\",\"datePublished\":\"2020-07-07T05:34:57+00:00\",\"dateModified\":\"2020-12-29T19:47:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/\"},\"wordCount\":785,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg\",\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/css-specificity\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/\",\"name\":\"CSS Specificity: A Step By Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg\",\"datePublished\":\"2020-07-07T05:34:57+00:00\",\"dateModified\":\"2020-12-29T19:47:18+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/css-specificity\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg\",\"width\":1020,\"height\":680,\"caption\":\"CSS Variables in Action\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/css-specificity\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/careerkarma.com\/blog\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSS Specificity\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\/\/www.linkedin.com\/in\/cmvnk\"],\"url\":\"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"CSS Specificity: A Step By Step Guide | Career Karma","description":"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/css-specificity\/","og_locale":"en_US","og_type":"article","og_title":"CSS Specificity","og_description":"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.","og_url":"https:\/\/careerkarma.com\/blog\/css-specificity\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-07T05:34:57+00:00","article_modified_time":"2020-12-29T19:47:18+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"CSS Specificity","datePublished":"2020-07-07T05:34:57+00:00","dateModified":"2020-12-29T19:47:18+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/"},"wordCount":785,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg","articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/css-specificity\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/","url":"https:\/\/careerkarma.com\/blog\/css-specificity\/","name":"CSS Specificity: A Step By Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg","datePublished":"2020-07-07T05:34:57+00:00","dateModified":"2020-12-29T19:47:18+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"When two or more CSS instructions point to the same element, there are some rules that are followed to determine which rule wins out. We\u2019ll learn how specificity is determined in this tutorial.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/css-specificity\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-4oAFasAPftg-unsplash.jpg","width":1020,"height":680,"caption":"CSS Variables in Action"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/css-specificity\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/careerkarma.com\/blog\/css\/"},{"@type":"ListItem","position":3,"name":"CSS Specificity"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19110"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19110\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19111"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}