When Stubbornella published

Semantic CSS

Another day, another attempt on my part to make a point, and another derailment and ignoring of my point because people want to argue over definitions. It’s particularly ironic (and meta!) this time because the disagreement seems to be over my use of the word “semantic”.

Define: semantic

The dictionary says that “semantic” has to do with the definition or meaning of words. Sure, that’s true.

But is that really what we as developers are talking about when we use the word “semantic” in relation to elements in our web pages? I don’t think that the dictionary definition quite encompasses what we mean.

So, what do we developers mean by “semantic”? I think we mean the intent. I think if we use an

element in our markup, if we’re doing this correctly, the more important part is what we mean with that element, and not so much what that element will end up looking like. Keep that distinction in mind — I’ll come back to it in a moment.

HTML

So, let’s talk first about the stuff most people can agree on: the semantics of some HTML element in the markup.

The

element has a pretty clear intent when used, and that is that it be treated as a main-level heading. But, treated by who? Ah, that’s the question!

Most developers seem to stop at defining “semantic” markup to be the meanings that an accessibility tool or search engine crawler will pull out of the markup.

Example? I worked at a company where we had an entire SEO team, and any time we went to put out a new HTML page, we had to send our markup to the SEO team for “review”. They would often come back and tell us to insert

or

elements in seemingly random places in our markup, and then we’d have to go back in and “un-style” the default stylings of those elements so they didn’t look different to real users, only different to search engines.

It’s probably no surprise that I think this sort of thing is stupid. I don’t care if it’s “proven” to work in SEO. I don’t even want to debate the value of it, so please save your typing. I just think it’s dumb. Or, to put it another way, I would call it a hack.

meaning = intent

I want for the markup I use to convey a bigger meaning that to just the accessibility or search engine crawler tools. I want the choices I make in markup to mean something to my future self and to other developers, those on my team or those who may look at my “code” later. As a writer/developer, I want to use a header to convey my intent with organizing my content into sections and groups and a hierarchy.

I don’t want to overload or conflate what I mean/intend by the use of an element with some “proven” set of conventions about how to trick other tools into presenting or interpreting things in some alternate way to get some other side-effect.

Don’t get me wrong. Accessibility assistance is not bad. Search engine indexability is not bad. But those tasks shouldn’t be overloaded onto me as a developer expressing my intent by the choices I make in my markup.

CSS

Now, enter CSS. CSS is supposed to take all the presentation questions out of our markup and hide them away in our stylesheets, which on the surface should separate our semantics from our presentation.

In many cases, I agree this is true, but it’s not as perfect as it sounds.

Let’s imagine that CSS added a feature called display:header (or even worse, display:h1 or display:header-level-1). The styling behavior of this rule would be to give it the same default stylings as if you’d used the corresponding

See also:
You might also like
HTML & CSS - semantic structure
HTML & CSS - semantic structure
Semantic HTML and Skinnable CSS (Joe Sondow) Java Posse
Semantic HTML and Skinnable CSS (Joe Sondow) Java Posse ...
35 HTML CSS Layout Semantic
35 HTML CSS Layout Semantic
Cherish Art Cherish Art 100% Hand Painted Oil Paintings Gift Full Blossom 5-Piece Wood Inside Framed Hanging Wall Decoration
Home (Cherish Art)
  • Size:10x24Inchx3 (25x60CMx5)
  • Gallery wrapped and stretched with wooden frame on the back. Ready to hang. Edges are painted. A perfect wall decoration for living room, bedroom, office, hotel...
  • Hand-painted high quality canvas oil painting painted by professional artists with years of oil painting experiences. A great gift idea for your relatives and friends.
  • Actual painting may be slightly different from the product image due to the different brand of monitors,Please refer to the colors shown in the photo. Materials/Milieu:...
  • Why Hesitating? Just Choose to decorate your house to be much more warming during every day! Once you choose Cherish Art oil paitings, we will send you the official...
Sangu Gift 100% Hand-painted Hot Selling Framed 5-Piece Yellow Lily Bottle Oil Paintings Canvas Wall Art for Home Decoration(10x16Inchx2, 8x20Inchx2, 8x24Inchx1)
Home (Eve's Temptation)
  • Size: 10x16Inchx2, 8x20Inchx2, 8x24Inchx1 (25x40CMx2,20x50CMx2,20x60CMx1).
  • Subject: Yellow Lily Bottle, 5 Panels.
  • Materials/Milieu: Thick Canvas, high quality oil or Acrylic colors. The depth is 2/3Inch (1.8CM).
  • 100% hand painted. Actual painting may be slightly different from the product image.
  • Gallery wrapped and stretched with wooden frame on the back. Ready to hang. Edges are painted. A perfect wall decoration for living room and bed room.
(8/25) Semantic HTML and Stylish CSS
(8/25) Semantic HTML and Stylish CSS
CSS3 Tricks: Sleek, Semantic, Sliding Buttons!
CSS3 Tricks: Sleek, Semantic, Sliding Buttons!
06. Core UI - using Semantic UI for HTML/CSS Grid and more
06. Core UI - using Semantic UI for HTML/CSS Grid and more
Eve's Temptation Sangu 100% Hand Painted Wood Framed Giraffe Meeting in Middle Africa Home Decoration Paintings For Living Room Gift on Canvas 5-piece Art Wall Decor
Home (Eve's Temptation)
  • Size: 12x20Inchx2, 8x24Inchx2, 8x28Inchx1 (30x50CMx2, 20x60CMx2, 20x70CMx1).
  • Gallery wrapped and stretched with wooden frame on the back. Ready to hang.
  • Edges are painted. A perfect wall decoration for living room and bed room.
  • 100% hand painted. Actual painting may be slightly different from the product image.
  • Materials/Milieu: Thick Canvas, high quality oil or Acrylic colors.
Eve's Temptation Sangu 100% Hand Painted Wood Framed Delicate Words Abstract Paintings For Living Room Modern Oil Paintings Gift on Canvas 4-piece Art Wall Decor
Home (Eve's Temptation)
  • Size: 10x15Inchx1, 8x24Inchx1, 10x20Inchx1, 10x12Inchx1 (25x37.5CMx1,20x60x1CM,25x50CMx1,25x31CMx1).
  • Gallery wrapped and stretched with wooden frame on the back. Ready to hang.
  • Edges are painted. A perfect wall decoration for living room and bed room.
  • 100% hand painted. Actual painting may be slightly different from the product image.
  • Materials/Milieu: Thick Canvas, high quality oil or Acrylic colors.
Eve's Temptation Sangu 100% Hand Painted Wood Framed 2-piece Hot Sale Twilight Woods For Abstract Oil Paintings Gift Canvas Wall Art Paintings For Living Room.
Home (Eve's Temptation)
  • Size: 12x24Inchx2 (30CMx60CMx2).
  • Subject: Trees in two colors
  • Materials/Milieu: Thick Canvas, high quality oil or Acrylic colors. The depth is 2/3Inch (1.8CM).
  • 100% hand painted. Actual painting may be slightly different from the product image.
  • Gallery wrapped and stretched with wooden frame on the back. Ready to hang. Edges are painted. A perfect wall decoration for living room and bed room.
Related Posts