Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<custom> html tags with no function?

Tags:

html

css

I've seen this done before on multiple websites.

What I'm looking to do is use tags like <header> and <description> and <contact> without any attributes, in place of comments, as it looks much cleaner.

However, I'm wondering whether or not they'll be any repercussions for doing so, and whether or not it's safe to do?

like image 647
Fireworksable Avatar asked Oct 10 '22 13:10

Fireworksable


2 Answers

Short answer; don't. It will not be valid (except in XHTML where you can add such tags)

It will not only break in some browsers it will be confusing for other people to read as well.

See this qustion: https://stackoverflow.com/questions/211394/when-to-use-custom-html-tags

like image 140
Nicklas A. Avatar answered Oct 14 '22 01:10

Nicklas A.


  1. They aren't HTML (except for those which are)
  2. Internet Explorer (except maybe version 9) won't let you style them without JavaScript hacks
  3. You may get unexpected results, especially in non-visual user agents (such as search engines) and tools that work with the DOM in the browser (such as screen readers).
  4. If they get added to HTML in the future, they might not mean what you intended them to mean and default stylesheets might interact with your stylesheets in unwanted ways.
like image 28
Quentin Avatar answered Oct 14 '22 02:10

Quentin