{"id":21,"date":"2024-01-17T00:04:00","date_gmt":"2024-01-17T00:04:00","guid":{"rendered":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/?p=21"},"modified":"2024-03-27T14:51:28","modified_gmt":"2024-03-27T14:51:28","slug":"advanced-css-selectors-class-and-id","status":"publish","type":"post","link":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/","title":{"rendered":"CSS Selectors: Class and ID basic filtering for HTML elements"},"content":{"rendered":"\n<p>We\u2019ve seen the basics of selectors.CSS selectors offer versatile ways to target specific HTML elements for styling. While we&#8217;ve covered basic tag selectors, let&#8217;s delve into class and id selectors, showcasing their syntax and usage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"class-selectors\">Class Selectors<\/h3>\n\n\n\n<p>To target elements with a specific class, use the class selector syntax: <code>.class {}<\/code>. Here&#8217;s an example:<\/p>\n\n\n\n<p>HTML:<\/p>\n\n\n\n<pre class=\"wp-block-code lang-html\"><code>&lt;p class=\"dog-name\"&gt;Roger&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<p>CSS:<\/p>\n\n\n\n<pre class=\"wp-block-code lang-css\"><code>.dog-name {\n  color: yellow;\n}\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code lang-html\"><code>&lt;p class=\"dog-name\"&gt;Roger&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"repeating-classes-vs-unique-ids\">Repeating Classes vs. Unique IDs<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Repeating Classes:<\/strong> You can repeat the same class value across multiple elements within an HTML document. For example, several elements can share the class &#8220;dog-name.&#8221;<\/li>\n\n\n\n<li><strong>Unique IDs:<\/strong> An id must be unique within an HTML document. It can only be used once. For instance, an id like &#8220;dog-name&#8221; should be assigned to a single element.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"id-selectors\">ID Selectors<\/h3>\n\n\n\n<p>To target elements with a specific id, use the id selector syntax: <code>#id {}<\/code>. Here&#8217;s an example:<\/p>\n\n\n\n<p>HTML:<\/p>\n\n\n\n<pre class=\"wp-block-code lang-html\"><code>&lt;p id=\"dog-name\"&gt;Roger&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<p>CSS:<\/p>\n\n\n\n<pre class=\"wp-block-code lang-css\"><code>#dog-name {\n  color: yellow;\n}\n<\/code><\/pre>\n\n\n\n<p>Understanding the nuances of class and id selectors provides you with powerful tools for styling specific elements or groups of elements within your <strong>HTML <\/strong>documents. As you progress, you&#8217;ll discover more advanced selectors and techniques to enhance your <strong>CSS styling capabilities<\/strong>. Stay tuned for further exploration into the world of CSS.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve seen the basics of selectors.CSS selectors offer versatile ways to target specific HTML elements for styling. While we&#8217;ve covered basic tag selectors, let&#8217;s delve&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,17,22],"tags":[],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-code","category-3-css","category-2-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CSS Selectors: Class and ID basic filtering for HTML elements - Zento<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Selectors: Class and ID basic filtering for HTML elements - Zento\" \/>\n<meta property=\"og:description\" content=\"We\u2019ve seen the basics of selectors.CSS selectors offer versatile ways to target specific HTML elements for styling. While we&#8217;ve covered basic tag selectors, let&#8217;s delve...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/\" \/>\n<meta property=\"og:site_name\" content=\"Zento\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-17T00:04:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-27T14:51:28+00:00\" \/>\n<meta name=\"author\" content=\"Jonathan Doe\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan Doe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/\",\"url\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/\",\"name\":\"CSS Selectors: Class and ID basic filtering for HTML elements - Zento\",\"isPartOf\":{\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#website\"},\"datePublished\":\"2024-01-17T00:04:00+00:00\",\"dateModified\":\"2024-03-27T14:51:28+00:00\",\"author\":{\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/73c40f6ccae14171f66e46de64b7ba55\"},\"breadcrumb\":{\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS Selectors: Class and ID basic filtering for HTML elements\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#website\",\"url\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/\",\"name\":\"Zento\",\"description\":\"Thoughts, stories and ideas.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/73c40f6ccae14171f66e46de64b7ba55\",\"name\":\"Jonathan Doe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a726515546b3cba9511994084a492b5a58cf40acd8faff68586319f1844de21a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a726515546b3cba9511994084a492b5a58cf40acd8faff68586319f1844de21a?s=96&d=mm&r=g\",\"caption\":\"Jonathan Doe\"},\"description\":\"Actively writing articles for this website. I really like traveling and photography, follow me on @Twitter i share content there everyday.\",\"sameAs\":[\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\"],\"url\":\"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Selectors: Class and ID basic filtering for HTML elements - Zento","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:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/","og_locale":"en_US","og_type":"article","og_title":"CSS Selectors: Class and ID basic filtering for HTML elements - Zento","og_description":"We\u2019ve seen the basics of selectors.CSS selectors offer versatile ways to target specific HTML elements for styling. While we&#8217;ve covered basic tag selectors, let&#8217;s delve...","og_url":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/","og_site_name":"Zento","article_published_time":"2024-01-17T00:04:00+00:00","article_modified_time":"2024-03-27T14:51:28+00:00","author":"Jonathan Doe","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathan Doe","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/","url":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/","name":"CSS Selectors: Class and ID basic filtering for HTML elements - Zento","isPartOf":{"@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#website"},"datePublished":"2024-01-17T00:04:00+00:00","dateModified":"2024-03-27T14:51:28+00:00","author":{"@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/73c40f6ccae14171f66e46de64b7ba55"},"breadcrumb":{"@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/advanced-css-selectors-class-and-id\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/"},{"@type":"ListItem","position":2,"name":"CSS Selectors: Class and ID basic filtering for HTML elements"}]},{"@type":"WebSite","@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#website","url":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/","name":"Zento","description":"Thoughts, stories and ideas.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/73c40f6ccae14171f66e46de64b7ba55","name":"Jonathan Doe","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a726515546b3cba9511994084a492b5a58cf40acd8faff68586319f1844de21a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a726515546b3cba9511994084a492b5a58cf40acd8faff68586319f1844de21a?s=96&d=mm&r=g","caption":"Jonathan Doe"},"description":"Actively writing articles for this website. I really like traveling and photography, follow me on @Twitter i share content there everyday.","sameAs":["https:\/\/themes.estudiopatagon.com\/wordpress\/zento"],"url":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/author\/admin\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":1,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/posts\/21\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themes.estudiopatagon.com\/wordpress\/zento\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}