Search code examples
htmlsemantic-markup

Do <header>, <nav>, <main>, etc have any impact if no styles are assigned to them?


If I have no:

nav {
    color: red;
}

and use it as <nav>, i.e.with no class= or style=, does it have any impact on layout and/or style?

Reading it, I assume there is no impact (same for the other Semantic Elements). And of course, marking parts with these then help for accessibility, etc.


Solution

  • These html elements that you are listing (header, nav, main) all have the same styling as a normal div when rendered.

    The only purpose of their naming being different to a div is for semantic reason which is useful for screen readers or other developers reading your code.

    It will not affect the styling at all.