Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i put image tag into bootstrap grid?

I'm beginner in css and bootstrap,and have document whit this instruction:

Throughout the enitre website a 12 column grid is used. This allows for maximum flexibility and to serve all devices available. Within the 12 columns grid
The content is placed within the 12 column grid (1). The grid is scaled between two fixed margins (2). Grid and margins fill the entire screen width minus the width of the main navigation (3).


for that purpose write this:

<div class="row">

            <div class="col-md-1 col-sm-1 col-lg-1">A</div>
            <div class="col-md-1 col-sm-1 col-lg-1">B</div>
            <div class="col-md-1 col-sm-1 col-lg-1">C</div>
            <div class="col-md-1 col-sm-1 col-lg-1">D</div>
            <div class="col-md-1 col-sm-1 col-lg-1">E</div>
            <div class="col-md-1 col-sm-1 col-lg-1">F</div>
            <div class="col-md-1 col-sm-1 col-lg-1">G</div>
            <div class="col-md-1 col-sm-1 col-lg-1">H</div>
            <div class="col-md-1 col-sm-1 col-lg-1">I</div>
            <div class="col-md-1 col-sm-1 col-lg-1">J</div>
            <div class="col-md-1 col-sm-1 col-lg-1">K</div>
            <div class="col-md-1 col-sm-1 col-lg-1">L</div>

        </div>


now want put image tag into A div:

<img src="http://hearstcommerce.ca/customcontent/members/premium/sample.jpg"/>


but now page not responsive,want that image show center of <div class="row">,how can i solve that?thanks all.

like image 735
chert chertopert Avatar asked Feb 19 '17 06:02

chert chertopert


People also ask

How do I add a grid image in Bootstrap?

Approach: First set the value display: grid; of the div wrapping all the images to transform it into to a grid layout. Then set the value grid-template-columns: auto; of the grid container to specify the number of columns in the grid layout. Now set the value width: 100%; of the image to get a perfect grid.

How do I customize Bootstrap grid?

Just check the Grid System block on the Customize page. The @grid-columns field allows to set a different number of columns, and the @grid-gutter-width field lets you change the gutter width. Customizers are convenient when bootstrap. css is the only file you need and when you don't work with preprocessors.

How do I move an image in Bootstrap?

Place the image at the required line inside the <body> tag. Wrap the image element in . float-left class for aligning towards left, . float-right to align towards right.

How do you make images responsive in Bootstrap?

Images in Bootstrap are made responsive with . img-fluid . max-width: 100%; and height: auto; are applied to the image so that it scales with the parent element.


1 Answers

Well, your question is not really clear. Please have a look at this Fiddle and elaborate more on that what you exactly want to do or send us a design or any visual things can help.

Cheers

img {
    display: block;
    margin-left: auto;
    margin-right: auto
}
<div class="row">
  <div class="col-sm-1">A</div>
  <div class="col-sm-12">
    <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS2Xjhc-NPN5UAWzKdY3Kpl29Tyt-zCC8aOd3Gez8i2zrF3BS9bSQ" />
  </div>
  <div class="col-sm-1">B</div>
  <div class="col-sm-1">C</div>
  <div class="col-sm-1">D</div>
  <div class="col-sm-1">E</div>
  <div class="col-sm-1">F</div>
  <div class="col-sm-1">G</div>
  <div class="col-sm-1">H</div>
  <div class="col-sm-1">I</div>
  <div class="col-sm-1">J</div>
  <div class="col-sm-1">K</div>
  <div class="col-sm-1">L</div>
</div>
like image 186
Negin Avatar answered Oct 03 '22 00:10

Negin