{"id":24020,"date":"2016-08-11T03:01:35","date_gmt":"2016-08-10T17:01:35","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=24020"},"modified":"2016-08-11T06:39:05","modified_gmt":"2016-08-10T20:39:05","slug":"css-and-html-complex-attribute-selectors-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/css-and-html-complex-attribute-selectors-tutorial\/","title":{"rendered":"CSS and HTML Complex Attribute Selectors Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS and HTML Complex Attribute Selectors Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.jpg\"  \/><\/a><p class=\"wp-caption-text\">CSS and HTML Complex Attribute Selectors Tutorial<\/p><\/div>\n<p>In the spirit of CSS itself, as the study of <a target=_blank title='Cascading Style Sheet information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Cascading_Style_Sheets'>Cascading Style Sheets<\/a>, we want to add an &#8220;onion layer&#8221; on top of what we started doing back at <a title='CSS and HTML Complex Selectors Primer Tutorial' href='#cahcspt'>CSS and HTML Complex Selectors Primer Tutorial<\/a> as shown below, today.  That &#8220;onion layer&#8221;, in our <a target=_blank title='Onions' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/?s=onions'>&#8220;onions of the 4th dimension&#8221;<\/a> feeling here, relates to HTML element <a target=_blank title='http:\/\/www.w3schools.com\/html\/html_attributes.asp' title='HTML element attribute information from w3schools'><i>attributes<\/i><\/a> &#8230;<\/p>\n<blockquote cite='http:\/\/www.w3schools.com\/html\/html_attributes.asp'><p>\nAttributes provide additional information about HTML elements.<br \/>\n<b><\/b><br \/>\n    All HTML elements can have attributes<br \/>\n    Attributes provide additional information about an element<br \/>\n    Attributes are always specified in the start tag<br \/>\n    Attributes usually come in name\/value pairs like: name=&#8221;value&#8221;\n<\/p><\/blockquote>\n<p>Now, as you can imagine, there is no end to the level of (fine) granularity of &#8220;selection&#8221; this gives you as a tool, in relation to picking out really specific subsets of HTML (elements) for your CSS styling attention.  Perhaps the most everyday HTML element with important &#8220;attributes&#8221; that we can think of, is the HTML <i>a<\/i> tag, as a link to &#8220;somewhere&#8221; &#8230; <font size=1>though &#8220;somewhere&#8221; can also be <a target=_blank title='HTML a Tag Navigation Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-a-tag-navigation-primer-tutorial\/'>&#8220;nowhere&#8221;<\/a> &#8230; chortle, chortle<\/font> &#8230; and today&#8217;s work replaces the HTML <i>p<\/i> (child) element types of the previous tutorial and replaces them with HTML <a target=_blank title='HTML a tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_a.asp'><i>a<\/i><\/a> (child) element types, for our purposes today.<\/p>\n<p>If you clicked that last link you&#8217;d have seen a myriad of HTML <i>a<\/i> tag &#8220;attribute&#8221; possibilities for you to think about &#8230; at the time of writing, namely &#8230;<\/p>\n<ul>\n<li>charset<\/li>\n<li>coords<\/li>\n<li>download<\/li>\n<li>href<\/li>\n<li>hreflang<\/li>\n<li>media<\/li>\n<li>name<\/li>\n<li>rel<\/li>\n<li>rev<\/li>\n<li>shape<\/li>\n<li>target<\/li>\n<li>type<\/li>\n<\/ul>\n<p> &#8230; which seems like a lot of scope for (fine granular selector) definition.  However, this &#8220;attribute&#8221; selection does not apply to inferred default values.  In other words, if the default <i>target=&#8221;_self&#8221;<\/i> is not actually written in your HTML for a given HTML <i>a<\/i> tag that you want to hone in on for particular styling, don&#8217;t expect CSS like <i>a[target=&#8221;_self&#8221;] { font-weight: bold; }<\/i> to catch these, as this &#8220;attribute&#8221; selector CSS only applies to specifically defined and &#8220;attributed&#8221; HTML.<\/p>\n<p>And so, today, we have links to &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Tutorial picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.jpg'>Tutorial picture<\/a> today, again, curiously, may be more useful to you than &#8230;<\/li>\n<li><a target=_blank title='Click picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.html'>Live run<\/a> &#8230; made up of &#8230;<\/li>\n<li>HTML and CSS programming source code you could call <a target=_blank title='complex_attribute_selectors.html' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.html-GETME'>complex_attribute_selectors.html<\/a> (that got derived in <a target=_blank title='complex_attribute_selectors.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_attribute_selectors.html-GETME'>this way<\/a>)<\/li>\n<\/ul>\n<p> &#8230; for your perusal, and thought.  Once again, thanks to this <a target=_blank title='Great link' href='http:\/\/learn.shayhowe.com\/advanced-html-css\/complex-selectors\/'>wonderful inspiring link<\/a>.<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>As you might suspect there is a &#8220;contains&#8221; way to define &#8220;attribute&#8221; selectors.  Where we have, today &#8230;<\/p>\n<p><code><br \/>\na[href=\"http:\/\/www.rjmprogramming.com.au\"]<br \/>\n<\/code><\/p>\n<p> &#8230; we could widen its scope (of cover) via the &#8220;contains&#8221; version &#8230;<\/p>\n<p><code><br \/>\na[href*=\"rjmprogramming.com.au\"]<br \/>\n<\/code><\/p>\n<p> &#8230; to cover any URL from this domain.<\/p>\n<hr>\n<p id='cahcspt'>Previous relevant <a target=_blank title='CSS and HTML Complex Selectors Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/css-and-html-complex-selectors-primer-tutorial\/'>CSS and HTML Complex Selectors Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_selectors.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS and HTML Complex Selectors Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_selectors.jpg\"  \/><\/a><p class=\"wp-caption-text\">CSS and HTML Complex Selectors Primer Tutorial<\/p><\/div>\n<p>Today, as with WordPress 4.1.1&#8217;s <a target=_blank title='CSS and HTML Complex Selectors Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/css-and-html-complex-selectors-primer-tutorial\/'>CSS and HTML Complex Selectors Primer Tutorial<\/a>, we want to delve deeper into the less obvious aspects of CSS, encouraged as we were to find this <a target=_blank title='Great link' href='http:\/\/learn.shayhowe.com\/advanced-html-css\/complex-selectors\/'>wonderful inspiring link<\/a> &#8230; thanks.  But hold off on the &#8220;bounce&#8221; now, because we are value adding the wonderful information from the link with practical and self explanatory HTML and CSS web applications that all show &#8230;<\/p>\n<ul>\n<li>CSS involved &#8230; is inline CSS shown and available in the HTML programming source you can optionally download &#8230; and &#8230;<\/li>\n<li>HTML subset of relevance that the CSS acts on &#8230; above &#8230;<\/li>\n<li>The resultant HTML webpage result<\/li>\n<\/ul>\n<p> &#8230; all these three components on the one webpage, to help with &#8220;cause and effect&#8221; regarding these more complex CSS concepts.  Perhaps, that way, they&#8217;ll &#8220;sink in&#8221; quite well?!<\/p>\n<p>So what &#8220;Complex Selector&#8221; types are we trying to highlight in today&#8217;s web application &#8230;<\/p>\n<ol>\n<li>Direct Child &#8230; child in parent\/child relationship &#8230; (Today&#8217;s) eg. <i>article &gt; p<\/i> { &#8230; }<\/li>\n<li>General Sibling &#8230; elements at the same hierarchical layer &#8230; (Today&#8217;s) eg. <i>h2 ~ p<\/i> { &#8230; }<\/li>\n<li>Adjacent Sibling &#8230; first elements at the same hierarchical layer &#8230; (Today&#8217;s) eg. <i>h2 + p<\/i> { &#8230; }<\/li>\n<\/ol>\n<p>Knowing about some of these more esoteric selectors could help you pinpoint specific elements within complex &#8220;container&#8221; elements, we hope you get out of today&#8217;s work.<\/p>\n<p>So this leaves us leaving you with links to &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Tutorial picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_selectors.jpg'>Tutorial picture<\/a> today, curiously, may be more useful to you than &#8230;<\/li>\n<li><a target=_blank title='Click picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_selectors.html'>Live run<\/a> &#8230; made up of &#8230;<\/li>\n<li>HTML and CSS programming source code you could call <a target=_blank title='complex_selectors.html' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/complex_selectors.html_GETME'>complex_selectors.html<\/a><\/li>\n<\/ul>\n<p> &#8230; and we&#8217;ll get back to you with more CSS of this ilk as time goes on.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d19034' onclick='var dv=document.getElementById(\"d19034\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/css\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d19034' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d24020' onclick='var dv=document.getElementById(\"d24020\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/attribute\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d24020' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the spirit of CSS itself, as the study of Cascading Style Sheets, we want to add an &#8220;onion layer&#8221; on top of what we started doing back at CSS and HTML Complex Selectors Primer Tutorial as shown below, today. &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/css-and-html-complex-attribute-selectors-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[112,1688,281,327,1549,564,576,1968,997,1953,1209,1319],"class_list":["post-24020","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-attribute","tag-attributes","tag-css","tag-did-you-know","tag-element","tag-hierarchy","tag-html","tag-onions","tag-programming","tag-selector","tag-style","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/24020"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=24020"}],"version-history":[{"count":12,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/24020\/revisions"}],"predecessor-version":[{"id":24055,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/24020\/revisions\/24055"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=24020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=24020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=24020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}