{"id":69882,"date":"2025-09-23T03:01:00","date_gmt":"2025-09-22T17:01:00","guid":{"rendered":"https:\/\/www.rjmprogramming.com.au\/ITblog\/?p=69882"},"modified":"2025-09-22T17:36:50","modified_gmt":"2025-09-22T07:36:50","slug":"css-tooltip-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/css-tooltip-primer-tutorial\/","title":{"rendered":"CSS Tooltip Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS Tooltip Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage_tooltip.png\" title=\"CSS Tooltip Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">CSS Tooltip Primer Tutorial<\/p><\/div>\n<p>Again, CSS themes of interest regarding yesterday&#8217;s <a title='CSS Image Clip and Shape Outside Primer Tutorial' href='#cssicsopt'>CSS Image Clip and Shape Outside Primer Tutorial<\/a> are here for today&#8217;s <i>Tooltip<\/i> tutorial, where we have chosen the day before&#8217;s <a title='CSS Variables Textarea Tutorial' href='#cssvtt'>CSS Variables Textarea Tutorial<\/a>&#8216;s web application to be the one to work with and expand.<\/p>\n<p>What&#8217;s a tooltip?  <a target=\"_blank\" title='Tooltip information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Tooltip' rel=\"noopener\">Wikipedia<\/a> says &#8230;<\/p>\n<blockquote cite='https:\/\/en.wikipedia.org\/wiki\/Tooltip'><p>\nThe tooltip, also known as infotip or hint, is a common graphical user interface (GUI) element in which, when hovering over a screen element or component, a text box displays information about that element, such as a description of a button&#8217;s function, what an abbreviation stands for, or the exact absolute time stamp over a relative time (&#8220;\u2026 ago&#8221;). In common practice, the tooltip is displayed continuously as long as the user hovers over the element or the text box provided by the tool.[1] It is sometimes possible for the mouse to hover within the text box provided to activate a nested tooltip, and this can continue to any depth, often with multiple text boxes overlapped.\n<\/p><\/blockquote>\n<p>And what interests us the most about the concept?<\/p>\n<blockquote><p>\nWell, we&#8217;re always looking for ways to explain the workings of web applications via their webpage HTML elements&#8217; <i>title<\/i> attributes, which, on non-mobile can happen hovering over the element.  But this does not work for mobile.  There, and for mobile, we, more and more, use textbox <i>placeholder<\/i> attributes to help.  <br \/>\nTooltips are another approach and call on CSS like &#8230;<br \/>\n<code><br \/>\n\/* Show the tooltip text on hover *\/<br \/>\n.tooltip:hover .tooltiptext {<br \/>\n  opacity: 0.3;<br \/>\n  visibility: visible;<br \/>\n}<br \/>\n<\/code><br \/>\n &#8230; thanks to <a target=\"_blank\" id=\"myatwo\" href='\/\/www.w3schools.com\/css\/css_tooltip.asp' rel=\"noopener\">W3schools<\/a> here, to go somewhere <strike>down<\/strike><sup>up<\/sup> the <strike>road<\/strike><sup>avenue<\/sup>, for some types of HTML elements, like the ones with a proper <i>innerHTML<\/i> attribute <font size=1>(but not textarea with it&#8217;s special relationship between <i>innerHTML<\/i> and <i>value<\/i> &#8230; so there, we had to nest the textarea in a div element)<\/font>\n<\/p><\/blockquote>\n<p>You could statically arrange the <i>tooltips<\/i>, but, for us here today, we&#8217;ve allowed for a dropdown selection to make a dynamically created <font color=blue><i>class<sup>Name<\/sup><\/i> association happen<\/font> &#8230;<\/p>\n<p><code><br \/>\n  function anal(selo) {<br \/>\n    var newst='';<br \/>\n    if (selo.value.trim() != '') {<br \/>\n      newst='&lt;style&gt; @property --my' + selo.value.toLowerCase() + 'Color {  syntax: \"&lt;color&gt;\";  inherits: true;   initial-value: ' + ('#' + document.getElementById('mycolourpicker').value).replace('##','#') + '; } #' + selo.value.toLowerCase() + ' {  background-color: var(--my' + selo.value.toLowerCase() + 'Color); }  .tooltip {  position: relative;  border-bottom: 1px dotted black;   cursor: pointer; } .tooltiptext {  visibility: hidden;   width: 130px;  background-color: black;  color: #ffffff;  text-align: center;  padding: 5px 0;  border-radius: 6px;  position: absolute;  z-index: 1;  } .tooltip:hover .tooltiptext {  opacity: 0.3; visibility: visible; }  &lt;\/style&gt;';<br \/>\n      if (selo.value == selo.value.toUpperCase()) {<br \/>\n        document.getElementById('myta').value=newst.replace(\/\\{\/g,'{ ' + String.fromCharCode(10)).replace(\/\\}\/g,'} ' + String.fromCharCode(10) + String.fromCharCode(10)).replace(\/\\;\/g,'; ' + String.fromCharCode(10))<br \/>\n        doit(document.getElementById('myta').value);<br \/>\n      } else if (selo.value == selo.value.toLowerCase()) {<br \/>\n        document.getElementById('myta').value=newst.replace(\/\\{\/g,'{ ' + String.fromCharCode(10)).replace(\/\\}\/g,'} ' + String.fromCharCode(10) + String.fromCharCode(10)).replace(\/\\;\/g,'; ' + String.fromCharCode(10))<br \/>\n      <font color=blue>} else if (('' + document.getElementById(selo.value.toLowerCase()).className) != '') {<br \/>\n        if (('' + document.getElementById(selo.value.toLowerCase()).className).indexOf('tooltip') == -1) {<br \/>\n        document.getElementById(selo.value.toLowerCase()).className+=' tooltip';<br \/>\n        if (('' + document.getElementById(selo.value.toLowerCase()).title) == '') {<br \/>\n        document.getElementById(selo.value.toLowerCase()).title='Hovering over ' + selo.value.toLowerCase();<br \/>\n        }<br \/>\n        document.getElementById(selo.value.toLowerCase()).innerHTML+='&lt;span id=myspan' + lastttnum + ' class=\"tooltiptext\"&gt;Hovering over ' + selo.value.toLowerCase().replace(\/^divta$\/g,'myta') + '&lt;br&gt;&lt;\/span&gt;';<br \/>\n        lastttnum++;<br \/>\n        }<br \/>\n      } else {<br \/>\n        document.getElementById(selo.value.toLowerCase()).className='tooltip';<br \/>\n        if (('' + document.getElementById(selo.value.toLowerCase()).title) == '') {<br \/>\n        document.getElementById(selo.value.toLowerCase()).title='Hovering over ' + selo.value.toLowerCase();<br \/>\n        }<br \/>\n        document.getElementById(selo.value.toLowerCase()).innerHTML+='&lt;span id=myspan' + lastttnum + ' class=\"tooltiptext\"&gt;Hovering over ' + selo.value.toLowerCase().replace(\/^divta$\/g,'myta') + '&lt;br&gt;&lt;\/span&gt;';<br \/>\n        lastttnum++;<br \/>\n      }<\/font><br \/>\n    }<br \/>\n  }<br \/>\n<\/code><\/p>\n<p> &#8230; to make an existant HTML element one that the mobile user taps (to :hover) and the non-mobile user just hovers over, to see the resultant <i>tooltip<\/i> adjacent to the HTML element being explained, in <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html-GETME\" rel=\"noopener\">this changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html-GETME\" rel=\"noopener\">second draft<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html\" rel=\"noopener\">CSS @property variables and tooltips web application<\/a>, <a href='#myifcss'>also below<\/a> &#8230;<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/css-tooltip-primer-tutorial\/' rel=\"noopener\">CSS Tooltip Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='cssicsopt'>Previous relevant <a target=\"_blank\" title='CSS Image Clip and Shape Outside Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/css-image-clip-and-shape-outside-primer-tutorial\/' rel=\"noopener\">CSS Image Clip and Shape Outside 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\/shape_outside.html\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS Image Clip and Shape Outside Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/shape_outside.gif\" title=\"CSS Image Clip and Shape Outside Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">CSS Image Clip and Shape Outside Primer Tutorial<\/p><\/div>\n<p>Further to the CSS themes of interest regarding yesterday&#8217;s <a title='CSS Variables Textarea Tutorial' href='#cssvtt'>CSS Variables Textarea Tutorial<\/a>, today we continue that &#8220;theme&#8221; regarding &#8230;<\/p>\n<p><code><br \/>\nCSS Image Clip and Shape Outside<br \/>\n<\/code><\/p>\n<p> &#8230; inspiration we got from <a target=\"_blank\" title='CSS Image Clip and Shape Outside' href='https:\/\/www.w3schools.com\/css\/css3_image_shapes.asp' rel=\"noopener\">this W3school very useful webpage<\/a>, thanks.<\/p>\n<p>With this work, there are two display aspects at play &#8230;<\/p>\n<table style=width:95%;>\n<tr>\n<th>CSS Property<\/th>\n<th colspan=2>Applicability regarding Shape &#8230;<\/th>\n<\/tr>\n<tr>\n<th><\/th>\n<th>Circle<\/th>\n<th>Ellipse<\/th>\n<th>Polygon<\/th>\n<\/tr>\n<tr>\n<td>clip-path<\/td>\n<td>Yes<\/td>\n<td>Yes<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td>shape-outside<\/td>\n<td>Yes<\/td>\n<td>Yes<\/td>\n<td>No<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; which you can play around <font size=1>(again involving user input textarea CSS styling elements)<\/font> with <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/shape_outside.html_GETME\" rel=\"noopener\">this first draft<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/shape_outside.html\" rel=\"noopener\">CSS Image Clip and Shape Outside web application<\/a> &#8230;<\/p>\n<p><iframe style=\"zoom:0.6;width:100%;height:1100px;\" src='\/\/www.rjmprogramming.com.au\/HTMLCSS\/shape_outside.html'><\/iframe><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/css-image-clip-and-shape-outside-primer-tutorial\/' rel=\"noopener\">CSS Image Clip and Shape Outside Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='cssvtt'>Previous relevant <a target=\"_blank\" title='CSS Variables Textarea Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/css-variables-textarea-tutorial\/' rel=\"noopener\">CSS Variables Textarea 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\/css_property_usage.html\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS Variables Textarea Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.png\" title=\"CSS Variables Textarea Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">CSS Variables Textarea Tutorial<\/p><\/div>\n<p>Today we&#8217;ve got a &#8220;proof of concept&#8221; CSS web application idea that is inspired by <a target=\"_blank\" title='https:\/\/www.w3schools.com\/css\/css3_property.asp' href='https:\/\/www.w3schools.com\/css\/css3_property.asp' rel=\"noopener\">this W3school&#8217;s webpage<\/a>, thanks, but adding user interaction functionality, regarding &#8230;<\/p>\n<p><code><br \/>\nCSS @property variables<br \/>\n<\/code><\/p>\n<p> &#8230; bringing some Javascript feeling logic excitement to CSS styling smarts.  You can try this user interactive approach with <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html_GETME\" rel=\"noopener\">this first draft<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html\" rel=\"noopener\">CSS @property variables web application<\/a> &#8230;<\/p>\n<p><iframe id=myifcss style=\"width:100%;height:1300px;\" src='\/\/www.rjmprogramming.com.au\/HTMLCSS\/css_property_usage.html'><\/iframe><\/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='#d69862' onclick='var dv=document.getElementById(\"d69862\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/textarea\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d69862' 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='#d69871' onclick='var dv=document.getElementById(\"d69871\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/image\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d69871' 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='#d69882' onclick='var dv=document.getElementById(\"d69882\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/tooltip\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d69882' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Again, CSS themes of interest regarding yesterday&#8217;s CSS Image Clip and Shape Outside Primer Tutorial are here for today&#8217;s Tooltip tutorial, where we have chosen the day before&#8217;s CSS Variables Textarea Tutorial&#8216;s web application to be the one to work &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/css-tooltip-primer-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,14],"tags":[224,228,281,367,997,2232,1209,1212,1262,3201,1319,1891,3214,1721],"class_list":["post-69882","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","tag-colour","tag-colour-picker","tag-css","tag-dropdown","tag-programming","tag-property","tag-style","tag-styling","tag-textarea","tag-tooltip","tag-tutorial","tag-user","tag-user-interaction","tag-variable"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/69882"}],"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=69882"}],"version-history":[{"count":9,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/69882\/revisions"}],"predecessor-version":[{"id":69892,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/69882\/revisions\/69892"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=69882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=69882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=69882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}