Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Code it correctly: Is “sidebar” really an appropriate id name? Re: Code it correctly: Is “sidebar” really an appropriate id name?

#103312
jonedwards
Participant

I reckon it depends on your own semantics…

In WordPress, you can have multiple dynamic “sidebars”, so in that instance, a class .sidebar might be more appropriate for the wrapper.

If you’re using HTML5, one would give the content heirachy by wrapping sections in section tags and secondary content in aside tags, etc, etc, so an ID like secondaryContent might be less appropriate.

Also, an ID secondaryContent doesn’t allow for much re-use. I prefer using separate classes like .secondary and .content. That way, I can target elements like so .content.secondary {} and .content.primary {} – far more flexible.

It’s always going to depend on your workflows and methodologies and how much you want to relate your own semantics to HTML semantics.