<custom> html tags without function?

I have seen this before on several sites.

I want to use the type of tag <header>and <description>and <contact>without any comments, instead of attributes, since it looks much cleaner.

However, I am wondering if there will be any consequences for them, and will it be safe?

+5
source share
6 answers

Short answer; no. It is invalid (except for XHTML, where you can add such tags)

It will not only break in some browsers, but for other people it will be confused.

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

+2
source
  • HTML ( , )
  • Internet Explorer (, , 9) JavaScript-
  • , ( ) , DOM (, ).
  • HTML , , , .
+2

, :

document.createElement("custom")

javascript,

<custom>bla bla bla</custom>

CSS :

custom { display:none;}

, HTML,

0

W3C, , . , HTML, CSS JavaScript. HTML-, , . , . , .

, .. HTML- .

CSS CSS HTML, CSS - XML (, CSS XML). , .

, . HTML5, ? data . Ex. <a href='...' data-custom-attribute='custom-value'></a>.

0

-, <header> HTML5. , , , , .

, .

, , , "" , . HTML <description>. , , . <header>, , . .

, HTML- , . , , .

, , , . , . , , , , .

. HTML5 , , . ( ) IE, .

IE , . Javascript, HTML5Shiv, HTML5. IE quirk, , , , Javascript, script. , .

, , , IE. IE Javascript createElement(), , . CSS reset, .

. - .

0

:

  • IE 6-8 → JavaScript , , : document.createElement('custom-tag') , - JavaScript
  • <span>, , CSS, custom-tag { display: block }
  • , , . Google Angular.js, (<pane> <tab>) a href= "http://angularjs.org/" rel= "nofollow" > .
  • HTML HTML, .
  • - HTML ( , .)

:

  • , , <div> HTML 4/5 . -, DOM // (, Angular.js).
  • , , - , HTML. , JavaScript.
  • If you are building a web application where custom tags can really help make the source cleaner and express special semantics, use them. All the negative consequences mentioned above (JavaScript must be enabled / CSS declaration) will not be of great importance for these cases, since your web application will not work without them. The same rules apply to user attributes.
0
source

All Articles