6
votes

Span n'allage pas verticalement du texte au milieu

Tout, J'ai le code suivant:

<span style="width:450px; height:207px; display:inline-block; vertical-align:middle; padding:0 0 0 10px; text-align:left;">
<b>Recipe Added By:</b> Test Person<br>
<b>Prep Time:</b> aljsdf<br>
<b>Cook Time:</b> asldfjdsf<br>
<b>Recipe Yield:</b> asflja<br>
<b>Recipe Category:</b> Main Dish   
</span>


0 commentaires

4 Réponses :


19
votes

Utiliser dans le style d'envoi Hauteur de ligne: 207px Pour aligner verticalement.


1 commentaires

Yup, cela, mais je pense qu'il voulait dire span et non div . Et éloignez-vous également des et les balises et remplacez-les par et de marge / remplissage respectivement.



10
votes

Utilisez un DIV et Affichage: Cellule de table CODE>

<div style="width:450px; height:207px; display:table-cell; vertical-align:middle; padding:0 0 0 10px; text-align:left;border:1px solid #ff0000">
<b>Recipe Added By:</b> Test Person<br>
<b>Prep Time:</b> aljsdf<br>
<b>Cook Time:</b> asldfjdsf<br>
<b>Recipe Yield:</b> asflja<br>
<b>Recipe Category:</b> Main Dish   
</div>


0 commentaires

0
votes

Cela l'obtiendra. J'ai ajouté une bordure pour le rendre plus visible. XXX


0 commentaires

3
votes
<style>
span {
    width: 450px;
    height: 207px;
    display: table-cell;
    padding-left: 10px;
    text-align: left;
    vertical-align: middle;
}
</style>
<span>
<b>Recipe Added By:</b> Test Person<br>
<b>Prep Time:</b> aljsdf<br>
<b>Cook Time:</b> asldfjdsf<br>
<b>Recipe Yield:</b> asflja<br>
<b>Recipe Category:</b> Main Dish
</span>

0 commentaires