Skip to main content

8 HTML Elements You’re Not Using (and Should Be)

In today's web, the word semantic gets thrown around a lot. But what does semantic mean? Why is it important?
Semantic HTML expresses the meaning of the document. It's less about how the text looks and more about what it is. Good semantic markup helps both people and machines understand the content and its context.
Semantic markup is much more accessible and easier for screen readers to interpret. It's SEO friendly. It works better with modern browsers. It reduces the amount of code needed to express the content and increases the clarity of the code for other people that have to read it.
Okay, so semantic content is great, but how do you use it? One of the best ways to start writing better markup is to replace generic tags with more expressive elements. Let's take a look at eight that you can use to step up your game.

<q>

Like it's blockier cousin <blockquote>, the <q> tag is used for quoted text.
Why not just use quotation marks? Quotation marks don't always imply a quote. Sometimes they're used for emphasis, irony, or to identify the name of something. In those cases, using quotation marks directly in the content is perfectly valid. However, if you're quoting someone, <q> explicitly shows your meaning.

<i> and <b>

Back in the good old days, <i> and <b> were used to identify italic and bold text. When the idea of separating semantic content from presentation started to gain traction, using <i> and <b>became frowned upon because they represented how the text was displayed, instead of what it meant. They were replaced by <em> and <strong>, which indicates emphasized and strongly emphasized text.
With HTML5, <i> and <b> now have shiny new semantic meanings. The <i> tag is used for text that is in a separate tone or mood. This is useful for things like thoughts and technical terms. The <b> tag identifies text that is stylistically different than normal text, but doesn't have any semantically different meaning. How is this different than using <span>? The key is that <b>communicates a lack of semantic meaning.

<abbr>

<abbr>'s are used for abbreviations! This can be really handy in documents with several short abbreviations. <abbr>'s have an optional title attribute that contains the unabbreviated version of the text.
<abbr title="laugh out loud">lol</abbr>
<abbr title="I don't know">idk</abbr>
<abbr title="got to go">g2g</abbr>
<abbr title="talk to you later">ttyl</abbr>

<time>

Let's take a look at a classic localization problem: dates. In the United States, October 5th, 2013 is represented by 10/05/13. In the United Kingdom, it's 05/10/13. In the Netherlands, October 5th would be written 05-10-13; in South Africa it would be 2013/10/05 and in Russia it's 05.10.13. With all of these possibilities, it's difficult for a machine to correctly read dates in all of these locales.
The <time> tag allows you to represent time and dates in a machine-readable format. The above example could be written as <time datetime="2013-10-05">10/05/13</time>. A HTML parser can use this to determine the exact time we meant, regardless of how it is formatted. The<time> tag also allows an optional 24-hour formatted time to be appended to the date: <time datetime="2013-10-05 22:00">10/05/13 at 10 PM</time>;

<mark>

Ever do something like this?
<p>
  Three hundred pages of boring, useless text. <span class="highlight">The one thing you need to know and will never be able to find again if you don't highlight it.</span> More boring stuff…
</p>
Well, now you don't need to. HTML5 introduced the <mark> element, which represents highlighted text that is, text that's marked for referential purposes due to its relevance in another context.

<input>

Yes, <input>. You've probably used <input type="text"><input type="submit">and maybe even <input type="hidden"> at some point, but have you used any of the other types? With HTML5, <input>'s can now be used with a range of types, including:
  • email
  • tel
  • number
  • range
  • date
  • time
  • search
  • color
These are great, but make sure they meet your browser requirements before you use them. Some types still aren't supported by all major browsers.

<menu>

Have you ever marked up a menu with an unordered list?
<ul class="menu-toolbar">
  <li class="new">New</li>
  <li class="open">Open</li>
  <li class="save">Save</li>
  <li class="quit">Quit</li>
</ul>
Well stop! menu is designed for this purpose. The <menu> element represents an unordered list of commands. It has a type attribute, which can be set to popup or toolbar.
<menu type="toolbar">
  <li class="new">New</li>
  <li class="open">Open</li>
  <li class="save">Save</li>
  <li class="quit">Quit</li>
</menu>

Bonus

Most front end developers have used &nbsp; when writing HTML, but many don't know the real meaning of the character. A non-breaking space will not break on a new line. This means that if you have two words separated by a non-breaking space, then both words will stick together at the end of a sentence. This is handy when breaking the words might be disruptive. Some great examples are:
  • Units: 12 m/s
  • Time: 8 PM
  • Proper nouns: Dairy Queen
Also, be sure to check out the non-breaking hyphen (&#8209;), which lets you use a hyphen character that won't break.

Comments

Popular posts from this blog

உடல் எடையை குறைக்க வேண்டுமா ?

இன்றைய அவசர உலகின் மிக பெரிய பிரச்சனையாக இருப்பது உடல் எடை அதிகரிப்பது தான்.மனம் போன போக்கில் உணவு கட்டு பாடு இல்லாமல் கண்டதையும் உள்ளே தள்ளுவதும்,உக்காந்த இடத்திலேயே கணணி முன் நேரத்தை விரயமாக்குவதும் தான் இந்த பிரச்சனைக்கு மூல காரணமாகும். அது சரி இந்த பிரச்சனையை எப்படி இல்லாமல் செய்வது அல்லது உடல் எடையை எவ்வாறு குறைப்பது என்பதை பற்றி பாப்போம் , பல வருட ஆரய்சிக்குபின் மருத்துவர்கள்   உடல் எடைய குறைக்க மிகவும் சுலபமான உடற்பயிற்சியை கண்டுபிடித்துள்ளனர்.இது  100% பயனளிக்க கூடியது, எந்த இடத்திலும் எந்தநேரத்திலும் மிக சுலபமா செய்ய கூடிய உடற் பயிற்சியாகும்.இந்த உடற்பயிற்சிகள் படத்துடன் கீழே தரப்பட்டுள்ளது நீங்களும் முயற்சித்து பாருங்கள கண்டிப்பாக பலன் கிடைக்கும்... முதலில் நாற்காலியில் உட்கார்ந்து இட  பக்கம் பார்கவும் .. ..        அடுத்து  நாற்காலியில் உட்கார்ந்து வல  பக்கம் பார்கவும்  ....  நண்பர்கள் யாரவது மச்சி வாடா சின்ன பீஸ் ,இங்க பாரு சூப்பர் அய்டம்னு சொல்லி கால்ல விழுந்து கூப்பிட்டலோ மேற்கூறிய உடற் பயி...

(Loot again) Get Mi Earphones & Mi Backpack In Just Rs.1

How to Get Mi Band , Mi Earphones & Mi Backpack In Just Rs.1 1, First Of All Just  Click On Below Links 1 By 1  Click 1->  Mi City Backpack Dark Grey Minimalist sleek design  -In Just Rs.1 Click 2->  Mi Earphones Silver Dynamic bass sound  -In Just Rs.1 2. Now Open All Links 1 By 1 3. After Opening The Link Click On “ Click to Bring The Price Down ” Then Click “ I Want it too ” 4. Login into Your Mi Account ( Or Sign Up  –  New Mi Account Giving Huge Price drop Like Rs.50 Or Rs.70 Drop , So Recommend You to Make New Account ) 5. Now You will See 3 Products There In this  Mi 24 Hour Madness Sale  6. Click On “ Participate ” Now Button & Share The Link With Your Friends When Each Friend Click On Your Link , You Will See Some Price cut in Your Products… Finally After Enough Click Your Product Will be Available For Just Rs.1  7. Start Referring , Start Looting MI

20 Best Themes For Windows XP

Have you been using  Windows XP  since a long time and tired of it’s dull looks? Then it’s time to give a facelift to XP by changing it’s look and feel. There are lots of  free visual style themes  available based on  Windows Vista ,  Windows 7 , Mac OSX ,  XBox ,  Linux  etc. In this article, we present the best of them. If you are installing a Visual Theme for the first time on your Windows XP, then you might want to check our article How to install visual themes in Windows XP?  first before applying the themes. Here goes our handpicked list of  Twenty Best Windows XP Themes  for your PC. If you are looking for more  Windows XP  Themes, you might want to check our other article:  20 Awesome  Windows XP Themes . 1.  Vista Live Pack One of the best Windows Vista based themes with a touch of Windows Live. There are many color variants, including Vista Live Blue (shown above), Vista Live Green, Vista Liv...