Skip to main content

Tailwind CSS


Layout
#

ClasseCSS
blockdisplay: block;
inline-blockdisplay: inline-block;
inlinedisplay: inline;
flexdisplay: flex;
inline-flexdisplay: inline-flex;
griddisplay: grid;
hiddendisplay: none;
staticposition: static;
relativeposition: relative;
absoluteposition: absolute;
fixedposition: fixed;
stickyposition: sticky;
top-0top: 0;
right-0right: 0;
bottom-0bottom: 0;
left-0left: 0;
inset-0top:0; right:0; bottom:0; left:0;
z-10z-index: 10;
float-leftfloat: left;
float-rightfloat: right;
clear-bothclear: both;
overflow-autooverflow: auto;
overflow-hiddenoverflow: hidden;
overflow-scrolloverflow: scroll;
overflow-x-autooverflow-x: auto;
overflow-y-hiddenoverflow-y: hidden;

Flexbox
#

ClasseCSS
flex-rowflex-direction: row;
flex-row-reverseflex-direction: row-reverse;
flex-colflex-direction: column;
flex-col-reverseflex-direction: column-reverse;
flex-wrapflex-wrap: wrap;
flex-nowrapflex-wrap: nowrap;
flex-wrap-reverseflex-wrap: wrap-reverse;
justify-startjustify-content: flex-start;
justify-centerjustify-content: center;
justify-endjustify-content: flex-end;
justify-betweenjustify-content: space-between;
justify-aroundjustify-content: space-around;
justify-evenlyjustify-content: space-evenly;
items-startalign-items: flex-start;
items-centeralign-items: center;
items-endalign-items: flex-end;
items-stretchalign-items: stretch;
items-baselinealign-items: baseline;
content-startalign-content: flex-start;
content-centeralign-content: center;
content-betweenalign-content: space-between;
self-autoalign-self: auto;
self-startalign-self: flex-start;
self-centeralign-self: center;
self-endalign-self: flex-end;
self-stretchalign-self: stretch;
flex-1flex: 1 1 0%;
flex-autoflex: 1 1 auto;
flex-initialflex: 0 1 auto;
flex-noneflex: none;
growflex-grow: 1;
grow-0flex-grow: 0;
shrinkflex-shrink: 1;
shrink-0flex-shrink: 0;
order-1order: 1;
order-firstorder: -9999;
order-lastorder: 9999;

Grid
#

ClasseCSS
grid-cols-3grid-template-columns: repeat(3, minmax(0, 1fr));
grid-rows-3grid-template-rows: repeat(3, minmax(0, 1fr));
col-span-2grid-column: span 2 / span 2;
col-start-1grid-column-start: 1;
col-end-3grid-column-end: 3;
row-span-2grid-row: span 2 / span 2;
gap-4gap: 1rem;
gap-x-4column-gap: 1rem;
gap-y-4row-gap: 1rem;

Espacement
#

ClasseCSS
p-4padding: 1rem;
px-4padding-left: 1rem; padding-right: 1rem;
py-4padding-top: 1rem; padding-bottom: 1rem;
pt-4padding-top: 1rem;
pr-4padding-right: 1rem;
pb-4padding-bottom: 1rem;
pl-4padding-left: 1rem;
m-4margin: 1rem;
mx-4margin-left: 1rem; margin-right: 1rem;
my-4margin-top: 1rem; margin-bottom: 1rem;
mt-4margin-top: 1rem;
mr-4margin-right: 1rem;
mb-4margin-bottom: 1rem;
ml-4margin-left: 1rem;
mx-automargin-left: auto; margin-right: auto;
space-x-4 > * + *margin-left: 1rem;
space-y-4 > * + *margin-top: 1rem;

Échelle numérique (n dans p-n, m-n, gap-n…) : 1=0.25rem, 2=0.5rem, 3=0.75rem, 4=1rem, 5=1.25rem, 6=1.5rem, 8=2rem, 10=2.5rem, 12=3rem, 16=4rem, 20=5rem, 24=6rem.


Dimensions
#

ClasseCSS
w-4width: 1rem;
w-1/2width: 50%;
w-1/3width: 33.333333%;
w-fullwidth: 100%;
w-screenwidth: 100vw;
w-autowidth: auto;
w-fitwidth: fit-content;
h-4height: 1rem;
h-fullheight: 100%;
h-screenheight: 100vh;
min-w-0min-width: 0px;
min-w-fullmin-width: 100%;
max-w-mdmax-width: 28rem;
max-w-xlmax-width: 36rem;
max-w-nonemax-width: none;
min-h-screenmin-height: 100vh;

Typographie
#

ClasseCSS
text-smfont-size: 0.875rem; line-height: 1.25rem;
text-basefont-size: 1rem; line-height: 1.5rem;
text-lgfont-size: 1.125rem; line-height: 1.75rem;
text-xlfont-size: 1.25rem; line-height: 1.75rem;
text-2xlfont-size: 1.5rem; line-height: 2rem;
font-thinfont-weight: 100;
font-normalfont-weight: 400;
font-mediumfont-weight: 500;
font-semiboldfont-weight: 600;
font-boldfont-weight: 700;
font-blackfont-weight: 900;
italicfont-style: italic;
not-italicfont-style: normal;
text-lefttext-align: left;
text-centertext-align: center;
text-righttext-align: right;
text-justifytext-align: justify;
leading-noneline-height: 1;
leading-tightline-height: 1.25;
leading-normalline-height: 1.5;
leading-looseline-height: 2;
tracking-tightletter-spacing: -0.025em;
tracking-wideletter-spacing: 0.025em;
uppercasetext-transform: uppercase;
lowercasetext-transform: lowercase;
capitalizetext-transform: capitalize;
normal-casetext-transform: none;
underlinetext-decoration-line: underline;
line-throughtext-decoration-line: line-through;
no-underlinetext-decoration-line: none;
truncateoverflow: hidden; text-overflow: ellipsis; white-space: nowrap;
whitespace-nowrapwhite-space: nowrap;
whitespace-prewhite-space: pre;
break-wordsoverflow-wrap: break-word;
break-allword-break: break-all;

Couleurs
#

ClasseCSS
text-blue-500color: #3b82f6;
bg-blue-500background-color: #3b82f6;
border-blue-500border-color: #3b82f6;
opacity-50opacity: 0.5;

Format général : text-{couleur}-{50..950} / bg-{couleur}-{50..950} / border-{couleur}-{50..950} → chaque palier a un code hex fixe (ex. 500 = teinte de base, 50 = très clair, 950 = très foncé).


Bordures
#

ClasseCSS
borderborder-width: 1px; border-style: solid;
border-2border-width: 2px;
border-tborder-top-width: 1px;
border-bborder-bottom-width: 1px;
roundedborder-radius: 0.25rem;
rounded-mdborder-radius: 0.375rem;
rounded-lgborder-radius: 0.5rem;
rounded-fullborder-radius: 9999px;
rounded-noneborder-radius: 0px;
rounded-t-lgborder-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem;
border-solidborder-style: solid;
border-dashedborder-style: dashed;
border-dottedborder-style: dotted;

Effets
#

ClasseCSS
shadow-smbox-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
shadow-mdbox-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
shadow-xlbox-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
shadow-nonebox-shadow: 0 0 #0000;
opacity-0opacity: 0;
mix-blend-multiplymix-blend-mode: multiply;

Filtres
#

ClasseCSS
blur-smfilter: blur(4px);
blur-mdfilter: blur(12px);
brightness-50filter: brightness(0.5);
contrast-125filter: contrast(1.25);
grayscalefilter: grayscale(100%);
grayscale-0filter: grayscale(0);

Transitions/Animations
#

ClasseCSS
transitiontransition-property: color, background-color, border-color, ...; transition-duration: 150ms;
transition-colorstransition-property: color, background-color, border-color;
transition-opacitytransition-property: opacity;
transition-transformtransition-property: transform;
duration-300transition-duration: 300ms;
ease-lineartransition-timing-function: linear;
ease-intransition-timing-function: cubic-bezier(0.4, 0, 1, 1);
ease-outtransition-timing-function: cubic-bezier(0, 0, 0.2, 1);
ease-in-outtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
delay-150transition-delay: 150ms;
animate-spinanimation: spin 1s linear infinite;
animate-pinganimation: ping 1s cubic-bezier(0,0,0.2,1) infinite;
animate-pulseanimation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;
animate-bounceanimation: bounce 1s infinite;

Transform
#

ClasseCSS
scale-95transform: scale(0.95);
scale-x-95transform: scaleX(0.95);
rotate-45transform: rotate(45deg);
-rotate-45transform: rotate(-45deg);
translate-x-4transform: translateX(1rem);
translate-y-4transform: translateY(1rem);
skew-x-6transform: skewX(6deg);

Toutes les classes transform cumulent en une seule propriété transform via variables CSS internes.


Interactivité
#

ClasseCSS
cursor-pointercursor: pointer;
cursor-not-allowedcursor: not-allowed;
cursor-waitcursor: wait;
select-noneuser-select: none;
select-textuser-select: text;
select-alluser-select: all;
pointer-events-nonepointer-events: none;
pointer-events-autopointer-events: auto;
resizeresize: both;
resize-noneresize: none;
resize-xresize: horizontal;
resize-yresize: vertical;

États (préfixes)
#

PréfixeÉquivalent CSS
hover::hover
focus::focus
active::active
disabled::disabled
visited::visited
checked::checked
first::first-child
last::last-child
odd::nth-child(odd)
even::nth-child(even)
group-hover:.group:hover &
peer-focus:.peer:focus ~ &
dark:@media (prefers-color-scheme: dark)

Responsive (préfixes de breakpoint)
#

PréfixeÉquivalent CSS
sm:@media (min-width: 640px)
md:@media (min-width: 768px)
lg:@media (min-width: 1024px)
xl:@media (min-width: 1280px)
2xl:@media (min-width: 1536px)

Mobile-first : classe sans préfixe = tous écrans, préfixe = à partir de cette largeur.


Valeurs arbitraires
#

ClasseCSS
w-[137px]width: 137px;
bg-[#1da1f2]background-color: #1da1f2;
top-[calc(100%-1rem)]top: calc(100% - 1rem);
grid-cols-[repeat(auto-fill,minmax(200px,1fr))]grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));