Search code examples
csstwitter-bootstrapgrid-layout

Bootstrap: Is it OK to assign column classes to heading tags


Is it OK to do this?

<div class="row">
    <h3 class="col-md-12"> ... </h3>
    <div class="col-md-6"> ... </div>
    <div class="col-md-6"> ... </div>
</div>

I mean, is there any reason why assigning Bootstrap grid class to heading tags would be considered bad practice? I can't think of any such reason, but I always see such classes used only for div's.


Solution

  • That's not a good idea. I'd do this instead:

    <div class="row">
        <div class="col-md-12">
            <h3> ... </h3>
        </div>
        <div class="col-md-6"> ... </div>
        <div class="col-md-6"> ... </div>
    </div>
    

    The .col-*-* classes should be used only for layout purposes!