Meine Seite hat 3 div (s) innerhalb einer div. In Tablet- und Desktopbildschirmen sehen sie gut aus (zentriert), aber auf einem sehr kleinen Gerät wie einem Mobiltelefon sind die inneren div (s) ausgerichtet (ich möchte, dass sie horizontal mittig ausgerichtet sind). Ich habe Textcenter und Mittelblock auf das äußere div angewendet, aber es funktioniert nicht. Irgendein Vorschlag? Hier sind die HTML- und CSS-Codes.horizontal mehrere Divs in einem Div in kleinen Geräten (xs)
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
portfolio-caption {
max-width: 281px;
background-color: #994ACC;
text-align: center;
padding: 10px;
border-top: 3px solid #ffffff;
margin-bottom: 10px;
}
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div style="max-width: 281px">
<a href="#" ">
<img src="./x/pilotproject1.jpg " class="img-responsive " style="margin: 0 auto; " alt=" ">
</a>
<div class="portfolio-caption text-center ">
<strong><h4>Project Name</h4></strong>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12 ">
<div style="max-width: 281px ">
<a href="# ">
<img src="./x/pilotproject2.jpg " class="img-responsive "
style="margin: 0 auto; " alt=" ">
</a>
<div class="portfolio-caption text-center ">
<strong><h4>Project Name</h4></strong>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12 ">
<div style="max-width: 281px ">
<a href="# " class="pilot-link ">
<img src="./x/pilotproject3.jpg " class="img-responsive "
style="margin: 0 auto; " alt=" ">
</a>
<div class="portfolio-caption text-center ">
<strong><h4>Project Name</h4></strong>
</div>
</div>
</div>
</div>
Der Grund, dass ich habe, ist, dass die Breite der Bilder ist 281 Pixel, wenn ich nicht setzen die Breite, die die Breite des div, die nach der img größer werden einen als 281 px, was ich nicht möchte. as you can see in this picture, the images are all left-aligned
Thanks @ Daniel H :) – NinaDev
@NinaDev glücklich = helfen D –