Ich habe Probleme mit der Zentrierung dieser zwei schwebenden linken Divs in einen Container mit einer Höhe von Auto und einem Display, das auf inline-block
eingestellt ist. Ich habe meinem Container eine maximale Breite von 1600px gegeben und wenn das Fenster breiter als 1600px gestreckt wird, bleibt der Container nach links fixiert. Ich habe versucht, Text align:center
, und margin:0 auto
, auf dem Container, aber ich bekomme nicht das Ergebnis, das ich suche.Wie zentriere ich diese zwei divs mit dem Container, der inline-block angezeigt wird?
Hier ist mein Code.
.keyfacts {
\t width: 94%;
\t height: auto;
\t max-width: 1600px;
\t padding: 60px 3% 60px 3%;
\t background-color: #634A4B;
\t display: inline-block;
}
.keyfactsleft {
\t float: left;
\t width: 47%;
\t height: auto;
\t padding-right: 3%;
}
.keyfactsleft p {
\t font-family: 'Raleway', san-serif;
\t font-size: 24px;
\t line-height: 32px;
\t font-weight: 100;
color: #58595b;
margin-bottom: 35px;
}
.keyfactsright {
float: left;
width: 50%;
height: 465px;
background-image: url(_images/meredith-manor-aerial.jpg);
background-size: cover;
background-position: center center;
background-color: #A05B5C;
}
<section class="keyfacts">
\t <div class="keyfactsleft">
\t <h3 class="red">When</h3>
<p>Saturday, October 14, 2017 at Five in the Evening</p>
<h3 class="red">Where</h3>
<p>Meredith Manor<br>2270 Pottstown Pike, Pottstown, PA 19465</p>
<p>Our convenient venue will host both our ceremony and our reception. Its location is only a few miles down the road from the Hilton Garden Inn, where you’ll be sleeping if you plan on getting wild and staying over.</p>
</div>
<div class="keyfactsright"></div>
</section>
Bingo! Vielen Dank! –
Ich bin froh, dass es geholfen hat! –