I'm looking for the most terse way to document sections of my page, e.g. div sections.
Anything wrong with using the title attribute, e.g.
<div title="Payment Area" class="form">
...
</div>
?
P.S. In case relevant, I'm using the IntelliJ IDE, but new to its various capabilities, e.g. automatic formatting control and other ways to be able to easily understand sections of my pages.
according to http://www.w3schools.com/tags/tag_DIV.asp, DIVs do have a title property which gives you ability to create tooltips without jquery. In fact, most HTML tags that can be used inside <body> do have title property that can be used for tooltips.
The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element. The title attribute can be used on any HTML element (it will validate on any HTML element. However, it is not necessarily useful).
Appropriate information to include in a link title can be: name of the site the link will lead to (if different from the current site) name of the subsite the link will lead to (if staying within the current site but moving to a different part of the site)
The title attribute is used to provide additional information to help clarify or further describe the purpose of a link.
If an element has a title
attribute, most browsers show a tooltip with the attribute’s value when you hover over it. In this case, they’ll show a “Payment Area” tooltip when you hover anywhere over that div
.
HTML attributes, in general, have a purpose. HTML has comments for documentation! Try them:
<div class="form"> <!-- Payment Area -->
...
</div>
You mentioned that you didn't want the overhead of comments. If you count up the characters (including the required space before the attribute, they're actually the same length:
title="Payment Area" <!-- Payment Area -->
(But, I agree, they do look bigger!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With