-9

Currently, code snippets are displayed JavaScript first, then CSS and finally HTML. Regardless of the order they appear in the post source or anything.

This does not make any sense to me. Does it for you? I guess it does, since I haven't found that feature request on another post. I found this order mentioned here and there, but not really complained about. Or perhaps just everyone goes with it, because it doesn't matter that much but still everyone would want it to be the other way around?

Anyway, I am suggesting to change it to show HTML first, then CSS then JavaScript, as the logical order of things.

5
  • 1
    Why does it not make any sense you? What order would you like to see? And why? Feb 6, 2022 at 16:34
  • 1
    The CSS and the JS are applied to the HTML, so I think the HTML should appear first. That's how it is inside the snippet editor and in CodePen editor, JSFiddle editor, etc.
    – Noam
    Feb 6, 2022 at 17:07
  • 4
    "logical order of things" is quite a bold statement to make. Even if we, for a second, assume that CSS and JS are applied to HTML (which is not true to begin with - JS is executed regardless of the markup), who is to say that the thing they are applied to should not go last? I think this is the logical order of things, any objections? VTC'd as opinion-based - preferences cannot be debated authoritatively and with citations Feb 6, 2022 at 18:04
  • Well, alright \_o_/
    – Noam
    Feb 6, 2022 at 19:22
  • 2
    Actually the current "correct order" is CSS - HTML - JS. If you inspect the rendered page you'll see that the CSS part is injected in the <head> of the document, while both the HTML and JS parts are injected in the <body> (in this order). I could see a point in making the post order match this order as this may not be obvious.
    – Kaiido
    Feb 7, 2022 at 5:42

1 Answer 1

12

"HTML first, then CSS then JavaScript, as the logical order of things."

Logical, by what metric?

is the largest tag on Stack Overflow.

More often than not, JavaScript questions only need a bare minimum of HTML, and the primary focus of the Q&A is on the JavaScript ...

I think it's very logical that the JavaScript is displayed first.

2
  • If there is no HTML or CSS in the snippet the other blocks won't show. Since the CSS and HTML blocks will be injected before the JS one it makes sense to want to have these in this order. I agree with OP that the current order may be confusing e.g with JS: console.log(1); HTML: <script>console.log(2)</script> will output 2 then 1. So while OP's order was confused, "tag popularity" is definitely not the correct metric.
    – Kaiido
    Feb 7, 2022 at 5:49
  • 1
    All your comment does, is illustrate that there are a lot of opinions about how comments should be sorted. Which was exactly the point of my answer. If you think it should be sorted differently, submit an answer.
    – Cerbrus
    Feb 7, 2022 at 8:58

Not the answer you're looking for? Browse other questions tagged .