Skip to content Skip to sidebar Skip to footer

Html5 & Bootstrap Class="container", Can It Be Applied To Body Or Only Div?

I keep bumping into this issue where everyone keeps: a) wanting to wrap HTML5 semantic tags with divs, and b) wants to apply class selectors to the divs and not the semantic tags.

Solution 1:

I recommend sticking to the

<body><divclass="container"><divclass="row"><divclass="col-md-12"> ...

format.

If you intend to work with a lot other developers or with bootstrap templates- you will see that the container classes typically nest row class divs.

Since we are talking about markup there is no right answer, but following this convention is strongly recommended.

  1. For consistency
  2. For easy changes to styling & reusability with other projects- this even opens the door to drop-in replacements of css stylesheets from other projects or bootstrap templates. (I have had some surprisingly good results with this).

However, if you insist on giving non-div tags "container" and "col-X" tags, be consistent. I wouldn't recommend it though and would consider any template that follows its own convention to be an indicator of poor code quality.

Post a Comment for "Html5 & Bootstrap Class="container", Can It Be Applied To Body Or Only Div?"