{"id":709,"date":"2023-05-19T14:54:14","date_gmt":"2023-05-19T14:54:14","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.com\/?p=709"},"modified":"2023-05-19T14:54:14","modified_gmt":"2023-05-19T14:54:14","slug":"compare-grouping-and-nesting-in-css","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2023\/05\/19\/compare-grouping-and-nesting-in-css\/","title":{"rendered":"Compare Grouping and Nesting in CSS ?"},"content":{"rendered":"\n<p>Grouping:&nbsp; Selectors can be grouped having the same values of property and the code be reduced.<br>E.g. :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">h1 {\n\ncolor: blue;\n\n}\n\nh2 {\n\ncolor: blue;\n\n}\n\np {\n\ncolor: blue;\n\n}\n\n\n\n\nIt can be seen from the code that every element shares the same property. Rewriting can be avoided by writing each selector separated by a comma.\r\n\r\nNesting: Specifying a selector within a selector is called nesting.\r\n\r\nP\r\n\r\n{\r\n\r\ncolor: red;\r\n\r\ntext-align: left;\r\n\r\n}\r\n\r\n.marked\r\n\r\n{\r\n\r\nbackground-color: blue;\r\n\r\n}\r\n\r\n.marked p\r\n\r\n{\r\n\r\ncolor: green;\r\n\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Grouping:&nbsp; Selectors can be grouped having the same values of property and the code be&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/709"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=709"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/709\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/709\/revisions\/710"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}