{"id":2136,"date":"2011-05-19T15:11:48","date_gmt":"2011-05-19T09:41:48","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2136"},"modified":"2011-05-19T15:11:48","modified_gmt":"2011-05-19T09:41:48","slug":"complete-css-selector-tutorial-for-the-beginners","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/complete-css-selector-tutorial-for-the-beginners\/","title":{"rendered":"Complete CSS Selector Tutorial for the beginners"},"content":{"rendered":"<p>Below table displays that in how many ways we can select any element in CSS to style them.<\/p>\n\n<table id=\"tablepress-2\" class=\"tablepress tablepress-id-2\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\"><div>Selector<\/div><\/th><th class=\"column-2\"><div>Description<\/div><\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">*<\/td><td class=\"column-2\">Any Element<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">A<\/td><td class=\"column-2\">Element of Type \"A\"<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">A.redColor<\/td><td class=\"column-2\">Element \"A\" whose class is \"redColor\"<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">A#India<\/td><td class=\"column-2\">Element \"A\" which have id as \"India\"<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">A[bar]<\/td><td class=\"column-2\">Element \"A\" with attribute \"bar\"<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">A[bar=\"Mum\"]<\/td><td class=\"column-2\">Element \"A\" which have attribute as \"bar\" whose value is exactly equal to \"Mum\"<\/td>\n<\/tr>\n<tr class=\"row-8\">\n\t<td class=\"column-1\">A[bar~=\"Mum\"]<\/td><td class=\"column-2\">Element \"A\" whose \"bar\" attribute value is a list of whitespace-separated values, one of which is exactly equal to \"Mum\"<\/td>\n<\/tr>\n<tr class=\"row-9\">\n\t<td class=\"column-1\">A[bar^=\"Mum\"]<\/td><td class=\"column-2\">Element \"A\" whose \"bar\" attribute value begins exactly with the string \"Mum\"<\/td>\n<\/tr>\n<tr class=\"row-10\">\n\t<td class=\"column-1\">A[bar$=\"Mum\"]<\/td><td class=\"column-2\">Element \"A\" whose \"bar\" attribute value ends exactly with the string \"Mum\"<\/td>\n<\/tr>\n<tr class=\"row-11\">\n\t<td class=\"column-1\">A[bar*=\"Mum\"]<\/td><td class=\"column-2\">Element \"A\" whose \"bar\" attribute value contains the substring \"Mum\"<\/td>\n<\/tr>\n<tr class=\"row-12\">\n\t<td class=\"column-1\">A:link, A:visited<\/td><td class=\"column-2\">Element \"A\" being the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited)<\/td>\n<\/tr>\n<tr class=\"row-13\">\n\t<td class=\"column-1\">A:active, A:hover, A:focus<\/td><td class=\"column-2\">Element \"A\" during certain user actions<\/td>\n<\/tr>\n<tr class=\"row-14\">\n\t<td class=\"column-1\">A::first-line<\/td><td class=\"column-2\">the first formatted line of an \"A\" element<\/td>\n<\/tr>\n<tr class=\"row-15\">\n\t<td class=\"column-1\">A:target<\/td><td class=\"column-2\">Element \"A\" being the target of the referring URI<\/td>\n<\/tr>\n<tr class=\"row-16\">\n\t<td class=\"column-1\">A::first-letter<\/td><td class=\"column-2\">the first formatted letter of an Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-17\">\n\t<td class=\"column-1\">A::before<\/td><td class=\"column-2\">generated content before an Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-18\">\n\t<td class=\"column-1\">A::after<\/td><td class=\"column-2\">generated content after Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-19\">\n\t<td class=\"column-1\">A:nth-child(n)<\/td><td class=\"column-2\">Element \"A\", the n-th child of its parent<\/td>\n<\/tr>\n<tr class=\"row-20\">\n\t<td class=\"column-1\">A:nth-last-child(n)<\/td><td class=\"column-2\">Element \"A\", the n-th child of its parent, counting from the last one<\/td>\n<\/tr>\n<tr class=\"row-21\">\n\t<td class=\"column-1\">A:nth-of-type(n)<\/td><td class=\"column-2\">Element \"A\", the n-th sibling of its type<\/td>\n<\/tr>\n<tr class=\"row-22\">\n\t<td class=\"column-1\">A:nth-last-of-type(n)<\/td><td class=\"column-2\">Element \"A\", the n-th sibling of its type, counting from the last one<\/td>\n<\/tr>\n<tr class=\"row-23\">\n\t<td class=\"column-1\">A:first-child<\/td><td class=\"column-2\">Element \"A\", first child of its parent<\/td>\n<\/tr>\n<tr class=\"row-24\">\n\t<td class=\"column-1\">A:last-child<\/td><td class=\"column-2\">Element \"A\", last child of its parent<\/td>\n<\/tr>\n<tr class=\"row-25\">\n\t<td class=\"column-1\">A:first-of-type<\/td><td class=\"column-2\">Element \"A\", first sibling of its type<\/td>\n<\/tr>\n<tr class=\"row-26\">\n\t<td class=\"column-1\">A:last-of-type<\/td><td class=\"column-2\">Element \"A\", last sibling of its type<\/td>\n<\/tr>\n<tr class=\"row-27\">\n\t<td class=\"column-1\">A:only-child<\/td><td class=\"column-2\">Element \"A\", only child of its parent<\/td>\n<\/tr>\n<tr class=\"row-28\">\n\t<td class=\"column-1\">A:only-of-type<\/td><td class=\"column-2\">Element \"A\", only sibling of its type<\/td>\n<\/tr>\n<tr class=\"row-29\">\n\t<td class=\"column-1\">A:empty<\/td><td class=\"column-2\">Element \"A\" that has no children <\/td>\n<\/tr>\n<tr class=\"row-30\">\n\t<td class=\"column-1\">A:root<\/td><td class=\"column-2\">Element \"A\", root of the document<\/td>\n<\/tr>\n<tr class=\"row-31\">\n\t<td class=\"column-1\">A:enabled, A:disabled<\/td><td class=\"column-2\">a user interface element \"A\" which is enabled or disabled<\/td>\n<\/tr>\n<tr class=\"row-32\">\n\t<td class=\"column-1\">A:checked<\/td><td class=\"column-2\">a user interface element \"A\" which is checked (for example a radio-button or checkbox)<\/td>\n<\/tr>\n<tr class=\"row-33\">\n\t<td class=\"column-1\">A:not(s)<\/td><td class=\"column-2\">Element \"A\" that does not match simple selector s<\/td>\n<\/tr>\n<tr class=\"row-34\">\n\t<td class=\"column-1\">A B<\/td><td class=\"column-2\">Element \"B\" descendant of Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-35\">\n\t<td class=\"column-1\">A > B<\/td><td class=\"column-2\">Element \"B\" child of Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-36\">\n\t<td class=\"column-1\">A + B<\/td><td class=\"column-2\">Element \"B\" immediately preceded by Element \"A\"<\/td>\n<\/tr>\n<tr class=\"row-37\">\n\t<td class=\"column-1\">A~B<\/td><td class=\"column-2\">Element \"B\" preceded by an Element \"A\"<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-2 from cache -->\n<p><a rel=\"nofollow\" title=\"Read more from w3 org\" href=\"http:\/\/www.w3.org\/TR\/CSS21\/selector.html\">Read more from w3 org.<\/a><\/p>\n<p>Drop a line if you have any feedback or question.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Complete CSS Selector Tutorial for the beginners<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[19],"tags":[67,338],"class_list":["post-2136","post","type-post","status-publish","format-standard","hentry","category-webtech","tag-css","tag-web"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2753,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/web\/complete-css-3-tutorial-transform-operations\/","url_meta":{"origin":2136,"position":0},"title":"Complete CSS 3 Tutorial &#8211; Transform Operations","author":"Jitendra","date":"March 5, 2012","format":false,"excerpt":"Complete CSS 3 Tutorial - Transform Operations - rotate, translate, scale, skew and matrix methods with Live Demo and source code","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"CSS 3 Tutorial Rotate","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/CSS-3-Tutorial-Rotate.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/CSS-3-Tutorial-Rotate.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/CSS-3-Tutorial-Rotate.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2856,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/web\/css-3-tutorial-rounded-corner-and-shadow-border-effect\/","url_meta":{"origin":2136,"position":1},"title":"CSS 3 Tutorial &#8211; Rounded Corner and Shadow Border effect","author":"Jitendra","date":"May 16, 2012","format":false,"excerpt":"Style the Border in HTML with the Help of CSS 3 Border Style","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"CSS 3 Border - Rounded Corner","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/CSS-3-Border-Rounded-Corner.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/CSS-3-Border-Rounded-Corner.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/05\/CSS-3-Border-Rounded-Corner.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2173,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/web\/create-pure-css-based-menu-step-by-step-tutorial\/","url_meta":{"origin":2136,"position":2},"title":"Create Pure CSS based Menu &#8211; Step by Step Tutorial","author":"Jitendra","date":"May 23, 2011","format":false,"excerpt":"Tutorial on creating step by step pure CSS based Menu without any javaScript and Why CSS Hover property is not working in Internet explorer","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"Pure CSS based menu","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/05\/Pure-CSS-based-menu.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":827,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/add-css-programatically-in-asp-net\/","url_meta":{"origin":2136,"position":3},"title":"Add CSS Programatically in ASP.NET","author":"Jitendra","date":"September 3, 2010","format":false,"excerpt":"Tutorial on adding the CSS file dynamically in ASP.NET and C# \/ VB.Net","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5364,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dynamically-instantiate-and-destroy-lightning-components-modal-dialog-component\/","url_meta":{"origin":2136,"position":4},"title":"Dynamically Instantiate and destroy Lightning Components &#8211; Modal dialog component","author":"Jitendra","date":"February 24, 2016","format":false,"excerpt":"Learn how to create advance lightning component (Modal dialog) and dynamically instantiate and destroy it","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce Ligtning Modal Window","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/02\/Ligtning-Modal-Window.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/02\/Ligtning-Modal-Window.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/02\/Ligtning-Modal-Window.gif?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5389,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/responsive-datagrid-component-in-lightning-basics\/","url_meta":{"origin":2136,"position":5},"title":"Responsive Datagrid component in Lightning &#8211; Basics","author":"Jitendra","date":"March 15, 2016","format":false,"excerpt":"This blog post explains simple use case of Nested Lightning Component. It goes through example on how to interact and combine nested components to be used in parent Lightning component.","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Using Nested Lightning component to create responsive DataGrid","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/03\/Lightning-Data-Grid-1.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/03\/Lightning-Data-Grid-1.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/03\/Lightning-Data-Grid-1.gif?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2136"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}