Ich habe ein DIV mit einem BG-Bild, und ich möchte nur zwei Absätze vertikal und horizontal innerhalb dieser DIV zentrieren. Hier ist der Code:Vertikale und horizontale Ausrichtung in einem DIV
Code:
#dark-table-carol {
background-color: #2e2e2e;
width: 100%;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 40px;
padding-right: 40px;
text-align: left;
margin-top: 30px;
margin-bottom: 30px;
background-image: url(http://scott.ewarena.com/blog/wp-content/themes/bootstrapstarter/carol-candy-carts-quote.jpg);
height: 600px;
background-repeat: no-repeat;
background-position: center bottom;
margin: auto;
/*
position: absolute;
background-size:contain;
top: 0;
left: 0;
bottom: 0;
right: 0;
*/
}
<div id="dark-table-carol">
<h3 id="dark-table-head-style" align="center">"It was like Scott reached into my head and saw exactly what I wanted to achieve. He brought my ideas to life very quickly!</h3>
<p id="dark-table-paragraph" align="center">
Carol Davies - Carol's Candy Carts
</p>
</div>
Ich habe ein paar Dinge ausprobiert, offensichtlich vertical-align:middle;
, Polsterung zu 50% für Top & unten einstellen, aber kein Glück.
Jeder Rat wäre toll :) Danke! Scott
Das funktionierte eine Festlichkeit. Vielen Dank! Ich hatte versucht, vertikal auszurichten: Mitte; aber nicht das display: table-cell; Möglichkeit. Ich werde über seine Verwendung lesen müssen. Vielen Dank! –
Vergnügen, ich bin froh, dass es für dich funktioniert :). – Gezzasa