Skip to content
DevMeme
4377 of 7590
Frontend Post #4793 · source on Telegram

Comic argues CSS is an object-oriented programming language with OOP analogies

Description

The meme is an eight-panel comic with a bright cyan background, a stone-faced grey NPC on the left column, and a cheerful white cartoon developer on the right column. Panel 1 shows the NPC saying "CSS is not a programming language" while the developer replies "Of course it is! What are the main concepts of OOP?". The developer then presents ".myClass { /* encapsulated! */ color: red; font-weight: bold; margin: 3rem; }" and explains "Encapsulation, like how all the CSS properties are constrained in a rule.", followed by ".red { /* color is inherited! */ color: red; } <div class=\"red\"> this is red <div>...this too!</div> </div>" with the comment "Inheritance, like how the CSS properties flow down to the children (+ the cascade).". He continues with "<button class=\"btn\"> styled button </button> .btn { ?????? }" saying "Abstraction, how we can use a classes to style without knowing what is inside.", then "<article class=\"awesome\"> awesome article </article> <section class=\"awesome\"> awesome section </section> .awesome { ... }" stating "Polymorphism, like using the same class on different HTML elements.". Concluding, the developer declares "CSS is not only a programming language, it is an object-oriented programming language." while the NPC remains speechless, humorously highlighting ongoing frontend language wars and mapping CSS behavior to classic OOP concepts

Comments

6
Anonymous ★ Top Pick Sure, call CSS OOP - just remember the cascade is multiple inheritance, specificity is the method-resolution order, and !important is the intern sprinkling global state into prod
  1. Anonymous ★ Top Pick

    Sure, call CSS OOP - just remember the cascade is multiple inheritance, specificity is the method-resolution order, and !important is the intern sprinkling global state into prod

  2. Anonymous

    Wait until they discover that CSS has variables, functions, conditionals, and loops - then watch them argue it's not Turing complete while accidentally implementing Conway's Game of Life in pure CSS animations

  3. Anonymous

    Ah yes, the classic 'CSS isn't a programming language' debate - until someone maps OOP principles onto it and suddenly your stylesheet has better encapsulation than your microservices. Next they'll be arguing CSS has dependency injection because of CSS variables and custom properties. Though to be fair, if CSS is object-oriented, then my 10,000-line legacy stylesheet with !important scattered everywhere is definitely practicing the 'God Object' anti-pattern

  4. Anonymous

    By that logic, CSS specificity is diamond inheritance, the cascade is method-resolution order, and !important is the executive's runtime override

  5. Anonymous

    Sure, CSS is OOP - specificity is your inheritance chain, cascade layers are abstract classes, Shadow DOM is encapsulation, and !important is the unsafe cast you ship on Friday

  6. Anonymous

    Rust: Doing C++'s job across the stack, minus the 'undefined behavior roulette' that keeps kernel devs employed

Use J and K for navigation