DEV Community

loading...

Discussion on: HTML is not a programming language and that's the best thing about it

Collapse
loouislow profile image
Loouis Low • Edited

Yeah, HTML is not a programming language. But this is my joke below... (try the silly code at Codepen)

<style>
  :root {
    --err-1: "(?) state is true ";
    --err-2: "(!) invalid boolean";
    --err-3: "(!) <return> is empty";
    --err-4: "(!) <if> missing <return>";
    --err-5: "(!) <if> missing state";
  }
  if, return { display: block }
  if[state="true"] > return { color: blue }
  if[state="true"] > return:before { content: var(--err-1) }
  if[state="false"] > return { display: none }
  if[state]:not([state="true"]) > return:before { content: var(--err-2) }
  if > return:empty:after { content: var(--err-3) }
  if:empty:after, if[state]:empty:after { content: var(--err-4) }
  if:not([state]):after { content: var(--err-5)}
</style>

<if state="true">
  <return></return>
</if>

<if state="true"></if>

<if state=""></if>

<if></if>

<if state="true">
  <return>
    Hello World!
  </return>
</if>

<if state="false">
  <return>
    Hello World!
  </return>
</if>
Enter fullscreen mode Exit fullscreen mode
Collapse
jfbrennan profile image
Jordan Brennan

Haha that's cool

Collapse
bcalou profile image
Collapse
elmuerte profile image
Michiel Hendriks • Edited

HTML+CSS is a programming language. Together they provide state and operations, making it Turing complete.
Some really early examples:
cssplay.co.uk/menu/amazing.html
cssplay.co.uk/menu/tictactoe.html

(Use previous and next for more nice demos)

Collapse
bcalou profile image
Bastien Calou Author

I love these demos, HTML/CSS is certainly a powerful combination.
Well of course, in the article I meant "programming languages usable with a standard human brain" :p