Adjust horizontal and vertical orientation on Bootstrap

Asked

Viewed 1,400 times

2

My horizontal page is the way I want it:

pag na horiz

But if you leave the vertical cell phone she’s getting like this:

pag na vert

How to make it vertical as follows?

layout desejado

Follows my code:

   <div class="row">
        <div class="col-xs-4 col-sm-4 col-md-4">
            <a href="#">
                <img src="~/Content/Images/btnHome.png" />
            </a>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4">
            <a href="#">
                <img src="~/Content/Images/btnProduto.png" />
            </a>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4">
            <a href="#">
                <img src="~/Content/Images/btnContato.png" />
            </a>
        </div>
    </div>

2 answers

3

No need to mecher in css, just remove the class col-Xs-4 that refers to "Extra Small Devices", and so the Divs stay in rows and not in columns on devices smaller than 768px. Here comes the edited code:

   <div class="row">
    <div class="col-sm-4 col-md-4">
        <a href="#">
            <img src="~/Content/Images/btnHome.png" />
        </a>
    </div>
    <div class="col-sm-4 col-md-4">
        <a href="#">
            <img src="~/Content/Images/btnProduto.png" />
        </a>
    </div>
    <div class="col-sm-4 col-md-4">
        <a href="#">
            <img src="~/Content/Images/btnContato.png" />
        </a>
    </div>
</div>
  • I had a question seeing your code. The use two classes col (Sm and Md), helps responsiveness on screens of different sizes? Until then, I only used one class. Thank you if you can clear up my question. Abs

  • 1

    @Angeloscali Yes, you can change the size of the grid columns according to the width of the device. The table of values of the widths and their prefixes you see here: http://getbootstrap.com/css/#grid-options

-2

Place float:left in the last two divs.

  • Put it on and it didn’t help Rafael..

  • nothing has changed?

  • No, nothing has changed..

  • I managed to solve using media queries, following what I did: @media (min-width: 500px) { . opcoesHome . Row . col-Md-4 { width: 33.33333333%; float: left; } }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.