/ / Comment aligner des éléments centraux dans cette CodePen? - html, css, css3

Comment aligner les éléments centraux dans ce CodePen? - html, css, css3

http://codepen.io/leongaban/pen/ACJta
^ Mise à jour (je ne parviens jamais à faire fonctionner SASS correctement dans Codepen)

Je ne peux pas aligner au milieu mes éléments ci-dessus. En utilisant SASS, je veux éviter d’utiliser position hacks

<main>
<div class="gradient">
<div class="hero">
<img src="/images/http://placehold.it/350x150" alt=""/>
</div>
</div>

<section class="tagline">
<h1>Hi there Lorem Ipsum <em>My name is Bob</em></h1>
<button>Learn More</button>
</section>
</main>


body {
font-family:Arial
}

.hero {
display: table-cell;
//position: relative;
margin: 0 auto;
// top: 42%;
// left: 10%;
text-align: center;
width: auto;
height: 447px;
vertical-align: bottom;

img {
width: 300px;
height: 280px;
text-align: center;
vertical-align: bottom;
border:0;
}
}

.tagline {
position: relative;
margin: 0 auto;
width: 100%;
height: 300px;
text-align: center;
color: blue;
background: gray;
z-index: 2;

h1 {
margin: 0 auto;
padding-top: 5%;
width: 80%;
font-size: 42px;
text-align: center;
}

em {
font-weight: bold;
}

button {
margin-top: 25px;
padding: 10px 20px;
font-family: Arial;
font-size: em(21);
color: white;
border: 0;
background: orange;
}
}

Réponses:

0 pour la réponse № 1

J'ai pu centrer vos éléments au-dessus de mes tâches:

.hero {
margin: 0 auto;
text-align: center;
width: 50%;
height: 447px;
vertical-align: bottom;
}

Il semble qu’il ne veuille pas se centrer parce que vous aviez spécifié width: auto