“Justifier le contenu CSS” Réponses codées

Justifier le contenu

<div class="d-flex justify-content-start">...</div>
<div class="d-flex justify-content-end">...</div>
<div class="d-flex justify-content-center">...</div>
<div class="d-flex justify-content-between">...</div>
<div class="d-flex justify-content-around">...</div>
Alive Albatross

Justifier le texte CSSS

text-align: justify;
Prickly Pony

Justifier le contenu CSS

/* Positional alignment */
justify-content: center;     /* Pack items around the center */
justify-content: start;      /* Pack items from the start */
justify-content: end;        /* Pack items from the end */
justify-content: flex-start; /* Pack flex items from the start */
justify-content: flex-end;   /* Pack flex items from the end */
justify-content: left;       /* Pack items from the left */
justify-content: right;      /* Pack items from the right */

/* Baseline alignment */
/* justify-content does not take baseline values */

/* Normal alignment */
justify-content: normal;

/* Distributed alignment */
justify-content: space-between; /* Distribute items evenly
                                   The first item is flush with the start,
                                   the last is flush with the end */
justify-content: space-around;  /* Distribute items evenly
                                   Items have a half-size space
                                   on either end */
justify-content: space-evenly;  /* Distribute items evenly
                                   Items have equal space around them */
justify-content: stretch;       /* Distribute items evenly
                                   Stretch 'auto'-sized items to fit
                                   the container */

/* Overflow alignment */
justify-content: safe center;
justify-content: unsafe center;

/* Global values */
justify-content: inherit;
justify-content: initial;
justify-content: unset;
Poised Peccary

Justifier le contenu CSS

<!DOCTYPE html>
<html>
<head>
   <style>
   	.flex-container{
   	    display: flex;
        justify-content: center;
   	    background: coral;
   	}
   	.flex-item{
   	    width: 100px;
   	    height: 100px;
   	    margin: 10px;
   	    text-align: center;
   	    line-height: 100px;
   	    font-size: 25px;
   	    background: white;
   	}
   </style>
</head>
<body>
	<h1>CSS justify-content Property</h1>
	<h2>justify-content: center</h2>
    <div class="flex-container">
        <div class="flex-item">1</div>
        <div class="flex-item">2</div>
        <div class="flex-item">3</div>
    </div>
    
    <p><b>Note: </b>Notice that the flex items are aligned in the center of the flex container.</p>
</body>
</html>
Cautious Centipede

Réponses similaires à “Justifier le contenu CSS”

Questions similaires à “Justifier le contenu CSS”

Plus de réponses similaires à “Justifier le contenu CSS” dans CSS

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code