{"id":7575,"date":"2013-01-28T11:55:59","date_gmt":"2013-01-28T11:55:59","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=7575"},"modified":"2024-04-12T14:17:05","modified_gmt":"2024-04-12T08:47:05","slug":"advanced-selectors-pseudo-classes-pseudo-elements-etc","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/","title":{"rendered":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.)"},"content":{"rendered":"<p><strong>Attribute selectors<\/strong> \u2013 They may match in four ways:<\/p>\n[att] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Match when the element sets the &#8220;att&#8221; attribute, whatever the value of the attribute.<\/p>\n[att=val] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Match when the element&#8217;s &#8220;att&#8221; attribute value is exactly &#8220;val&#8221;.<\/p>\n[att~=val] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Represents an element with the att attribute whose value is a white space-separated list of words, one of which is exactly &#8220;val&#8221;.<\/p>\n[att|=val] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Represents an element with the att attribute, its value either being exactly &#8220;val&#8221; or beginning with &#8220;val&#8221; immediately followed by &#8220;-&#8221; .<\/p>\n<p><strong>:first-child pseudo-class<\/strong> &#8211; It matches an element that is the first child element of some other element. In the following example, the selector matches any P element that is the first child of a DIV element. The rule suppresses indentation for the first paragraph of a DIV:<\/p>\n<p>div &gt; p:first-child { text-indent: 0 }<\/p>\n<p>This selector would match the P inside the DIV of the following fragment:<\/p>\n<p>&lt;P&gt; The last P before the note.<\/p>\n<p>&lt;DIV class=&#8221;note&#8221;&gt;<\/p>\n<p>&lt;P&gt; The first P inside the note.<\/p>\n<p>&lt;\/DIV&gt;<\/p>\n<p><strong>:link and :visited pseudo-class<\/strong> &#8211; The :link pseudo-class applies for links that have not yet been visited. The :visited pseudo-class applies once the link has been visited by the user. &nbsp;The two states are mutually exclusive. They are used as<\/p>\n<p>a:link { color: red }<\/p>\n<p>:link&nbsp; { color: red }<\/p>\n<p><strong>:hover, :active, and :focus pseudo-classes<\/strong> &#8211; The :hover pseudo-class applies while the user designates an element (with some pointing device), but does not activate it like when mouse pointer hovers over a box generated by the element. The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it. The :focus pseudo-class applies while an element has the focus (accepts keyboard events or other forms of text input).<\/p>\n<p><strong>The :first-line pseudo-element<\/strong> &#8211; It applies special styles to the contents of the first formatted line of a paragraph. For instance:<\/p>\n<p>p:first-line { text-transform: uppercase }<\/p>\n<p>The above rule means &#8220;change the letters of the first line of every paragraph to uppercase&#8221;. However, the selector &#8220;P:first-line&#8221; does not match any real HTML element. It does match a pseudo-element that conforming user agents will insert at the beginning of every paragraph.<\/p>\n<p><strong>The :first-letter pseudo-element<\/strong> &#8211; It must select the first letter of the first line of a block, if it is not preceded by any other content (such as images or inline tables) on its line.<\/p>\n<p><strong>The :before and :after pseudo-elements<\/strong> &#8211; The &#8216;:before&#8217; and &#8216;:after&#8217; pseudo-elements can be used to insert generated content before or after an element&#8217;s content as<\/p>\n<p>h1:before {content: counter(chapno, upper-roman) &#8220;. &#8220;}<\/p>\n<p>When the :first-letter and :first-line pseudo-elements are applied to an element having content generated using :before and :after, they apply to the first letter or line of the element including the generated content.<\/p>\n<p>p.special:before {content: &#8220;Special! &#8220;}<\/p>\n<p>p.special:first-letter {color: #ffd800}<\/p>\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/dhtml-and-javascript-developer\/\" target=\"_blank\" rel=\"noreferrer noopener\">Back to Tutorial<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Attribute selectors \u2013 They may match in four ways: [att] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Match when the element sets the &#8220;att&#8221; attribute, whatever the value of the attribute. [att=val] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Match when the element&#8217;s &#8220;att&#8221; attribute value is exactly &#8220;val&#8221;. [att~=val] &#8211; &nbsp;&nbsp;&nbsp;&nbsp;Represents an element with the att attribute whose value is a white space-separated list of words,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3352],"tags":[2796,2752,2750,2751,604,2797],"class_list":["post-7575","page","type-page","status-publish","hentry","category-dhtml-and-javascript","tag-advanced-selectors-pseudo-classes","tag-dhtml-and-java-script","tag-dhtml-and-java-script-developer","tag-dhtml-and-javascript-developer-certification","tag-etc","tag-pseudo-elements"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial<\/title>\n<meta name=\"description\" content=\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:47:05+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/\",\"name\":\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-01-28T11:55:59+00:00\",\"dateModified\":\"2024-04-12T08:47:05+00:00\",\"description\":\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced Selectors (pseudo-classes, pseudo-elements, etc.)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial","description":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.","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:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/","og_locale":"en_US","og_type":"article","og_title":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial","og_description":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:47:05+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/","name":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.) - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-01-28T11:55:59+00:00","dateModified":"2024-04-12T08:47:05+00:00","description":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.). Govt of India Certification for DHTML and Javascript professionals. Get Certified and improve employability. Certification assesses candidates in DHTML.","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/advanced-selectors-pseudo-classes-pseudo-elements-etc\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Advanced Selectors (pseudo-classes, pseudo-elements, etc.)"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=7575"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7575\/revisions"}],"predecessor-version":[{"id":82868,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/7575\/revisions\/82868"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=7575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=7575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=7575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}