DEV Community

Calin Baenen
Calin Baenen

Posted on

What do you think about strongly-annotated HTML?

I want to know what you all think about strongly-annotated HTML?
Let me know!




What is strongly-annotated HTML?


Strongly-annotated HTML is where you don't leave any optional attributes unset, even if they have a default value.
E.g.

<!DOCTYPE html>

<html lang="en-US" dir="ltr">
  <head>
    <title>Hello!</title>
    <style language="css" type="text/css">
      /* ... */
    </style>
    <link href="./icon.png" type="image/png" rel="icon"/>
    <link language="css" href="./_.css" type="text/css" rel="stylesheet"/>
  </head>
  <body>
    <p>Hello World!</p>
    <img type="image/png" alt="An image of Katty." src="./katty.png"/>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

An example of non-annotated HTML:

<!DOCTYPE html>

<html lang="en">
  <head>
    <title>Hello!</title>
    <style>
      /* ... */
    </style>
    <link href="./icon.png" rel="icon"/>
    <link href="./_.css" rel="stylesheet"/>
  </head>
  <body>
    <p>Hello World!</p>
    <img alt="An image of Katty." src="./katty.png"/>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (4)

Collapse
 
lexlohr profile image
Alex Lohr

Why would you want to add noise that does not help in the understanding of your code? Also, in some cases, this will break functionality, e.g. in a media tag, you may have either src or srcObject, but not both.

Collapse
 
nicolus profile image
Nicolus • Edited

I hate it !

I mean :

<link language="css" href="./_.css" type="text/css" rel="stylesheet"/>
Enter fullscreen mode Exit fullscreen mode

That would be fine if I could use any other language than css and serve it in anything other than plain text... Maybe

<link language="sass" href="./_.sass.zip" type="application/zip" rel="stylesheet"/>
Enter fullscreen mode Exit fullscreen mode

But as it is what else am I going to write my styles in ?

Collapse
 
dannyengelman profile image
Danny Engelman • Edited

You forgot <p align="left">, and 427 other attributes

The Meaning of HTML Life - Just one more attribute

youtube.com/watch?v=eAUYO6AY1ow

Collapse
 
joas8211 profile image
Jesse Sivonen

Just why? I can't see any advantage except teaching beginners what arguments there are.