Convention, though there isn’t a definite rule of which order you should put these things in.
There’s things, like this style guide from one of the creators of Bootstrap which suggests an order - but the actual HTML parser won’t care what order they’re in.
If you pick an order that makes sense, and you apply it consistently, that’s fine. If you’re working with others on an established project, you’d go with whatever the prevailing style there was.
The reason that the Codecademy material has you put CSS-related attributes, like
style, in a specific order is because of the specificity of those rulesets.
id selectors are more specific than class selectors, which is why CC has you put