Ich kann meine bootstrap thumbnail images nicht zentrieren, egal was ich auf Tablet-Größe und kleiner versuche. Sobald Thumbnails diese Größe erreichen, scrollen sie nicht mehr, um in der Mitte des Bildschirms zu bleiben. Ich habe versucht, alles, was ich denken kann von Center-Block zu meiner Miniatur-Klasse und meine IMG responsive Klasse HTML zu Text-Algin-Center und Rand Auto 0 hinzufügen. Nichts ändert sich.bootstrap thumbnail images ignorieren zentrieren css
Hier ist mein html
<div class="portfolio">
<div class="container">
<a name="porty"></a>
<h1 class="text-center" id = "port">My Work</h1>
<div class="row">
<div class="col-md-4">
<div class="thumbnail ">
<div class="caption">
<h4 class="text-center">A Berine Sanders Tribute page made with HTML,CSS, and Bootstrap</h4> <a href="http://codepen.io/kgoode517/full/WwjNqp/"><i class="fa fa-codepen fa-5x fa-fw" id="first"></i> </a>
</div>
<img src="http://goodedevelopment.com/images/Bernie.PNG" class="img-responsive center-block" alt="tribute">
</div>
<legend>Tribute page</legend>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class="caption">
<h4 class="text-center">Google mockup page made with HTML,CSS,and Bootstrap</h4>
<a href="http://codepen.io/kgoode517/full/yYddbb/"><i class="fa fa-codepen fa-5x fa-fw" id ="second"></i> </a>
</div>
<img src="http://goodedevelopment.com/images/google.png" class="img-resposive center-block" alt="google">
</div>
<legend>Google homepage</legend>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class="caption">
<h4 class="text-center">A cannon game made with HTML,CSS, and Javascript</h4>
<a href="http://codepen.io/kgoode517/full/LNdxKE/"><i class="fa fa-codepen fa-5x fa-fw" id ="icon"></i> </a>
</div>
<img src="http://goodedevelopment.com/images/cannon.png" class="img-responsive center-block" alt="cannon">
</div>
<legend>Cannon game</legend>
</div>
</div>
Hier ist meine CSS
/*Portfolio*/
.portfolio {
background-color:#706C61;
padding-top: 50px;
padding-bottom: 100px;
display: inline-block;
width: 100%;
height: 800px;
position:relative;
}
.portfolio h1 {
font-size: 65px;
font-family: "Roboto",serif !important;
color: #0d0d0d !important;
}
.row {
padding-top: 100px;
}
.thumbnail {
height: 250px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
overflow: hidden;
border: 1px solid black !important;
border-radius: 5px !important;
}
.caption img {
flex-shrink: 0;
max-width 100%;
max-height: 100%;
}
.caption {
position: absolute;
top: 0;
right: 0;
background: rgba(128, 128, 128, 0.75);
width: 100%;
height: 100%;
padding: 2%;
display: none;
text-align: center;
color: #fff !important;
z-index: 2;
font-family: "Montserrat",serif !important;
}
.caption a {
text-decoration: none;
color: white;
}
.caption h4 {
position: relative;
left: 5px;
bottom: 10px;
font-size: 25px;
}
.caption i:hover {
color: orange !important;
}
legend {
font-family: "Roboto",serif !important;
border-bottom: none !important;
color: #0d0d0d !important;
font-size:22px; !important;
height:200px;
}
#first {
position: relative !important;
bottom: -35px !important;
}
#second {
position: relative !important;
bottom: -35px !important;
}
#icon {
position: relative;
top: 30px;
}
@media screen and (min-width:767px) and (max-width:1199px) {
#first {
position: relative;
bottom: 20px;
}
#icon {
top: 50px !important;
}
.caption h4 {
font-size: 20px;
}
}
@media screen and (min-width:767px) and (max-width:991px) {
#first {
position: relative;
top: 50px;
}
.caption h4 {
font-size: 30px;
}
.caption {
font-size: 15px;
}
.caption i {
position: relative;
top: 50px;
}
#icon {
position: relative;
top: 65px !important;
}
.caption .fa {
font-size: 50px;
}
}
@media screen and (max-width: 1200px) {
.portfolio h1 {
font-size: 55px;
}
}
@media screen and (max-width: 991px){
.thumbnail {
height: 369px;
width: 440px;
position: relative;
right: -142px;
bottom: 48px;
}
.portfolio{
height: 2650px;
}
#profile li {
position: relative;
left: 60px;
}
.caption h4 {
font-size: px !important;
}
.caption .fa {
font-size: 80px !important;
}
legend {
height: 80px;
position: relative;
left: 139px;
bottom: 53px;
}
}
@media screen and (max-width: 965px) {
.portfolio {
margin-top: -150px !important;
}
}
@media screen and (max-width:767px) {
#first {
position: relative;
top: 25px;
}
.caption h4 {
font-size: 30px;
}
.caption {
font-size: 15px;
}
#port{
width: 50%;
height: 50%;
overflow: auto;
margin: auto;
position: absolute;
top: -1285px;
left: 0;
bottom: 0;
right: 0;
}
.thumbnail {
position: relative;
bottom: 0px;
}
legend
{
position: relative;
bottom: 13px;
}
}
@media screen and (max-width: 454px){
.caption h4{
font-size:25px;
}
#first{
top:15px;
}
#second{
top:15px;
}
}
@media screen and (max-width:400px) {
#icon {
position: relative;
bottom: 20px;
}
}
@media screen and (max-width:397px) {
#icon {
position: relative;
top: 0px;
}
}
@media screen and (max-width:390px) {
#first{
top:5px;
}
}
@media screen and (max-width:325px) {
.caption .fa {
font-size:60px;
}
}
@media screen and (max-width:307px) {
#first{
top:-5px;
}
}
/*End Portfolio*/
Und schließlich ist hier ein Screenshot von dem, was ich Hilfe erlebe stark dank würde geschätzt!
Sie versuchen, Dinge mit Pixeln zu zentrieren, rechts: -142px; funktioniert nur für diese eine Bildschirmgröße. Sie möchten Rand 0 Auto verwenden; stattdessen für die Zentrierung div's – Bosc
Vielen Dank, ich habe versucht, und das hat die Dinge nicht behoben. Ja, ich habe momentan Dinge relativiert, weil das die einzige Möglichkeit ist, die Thumbnails zu bewegen, wo ich will, und ja, es funktioniert nur für diese Bildschirmgröße irgendwelche anderen Ideen? – kgoode517
Es gibt so viel in Ihrem Code zu beheben, aber die Hauptsache scheint Ihre benutzerdefinierte CSS zu sein, Ihr Bootstrap-Stil für die Containerbreite in Zeile 404 überschrieben und dies setzt Ihre Container auf kleineren Bildschirmgrößen auf 970px – Bosc