Tailwind CSS

예진·2024년 11월 4일

개인 공부

목록 보기
10/14
post-thumbnail

Tailwind CSS 사용 예제

Tailwind CSS & Typescript 사용

Sizing

  • Width

    // w-{size}
    <div className="w-20">Width</div>
    ClassProperties
    w-0width: 0px;
    w-pxwidth: 1px;
    w-0.5width: 0.125rem; / 2px /
    w-1width: 0.25rem; / 4px /
    w-minwidth: min-content;
    w-maxwidth: max-content;
  • Height

    // h-{size}
    <div className="h-20">Height</div>
    ClassProperties
    h-0height: 0px;
    h-pxheight: 1px;
    h-0.5height: 0.125rem; / 2px /
    h-1height: 0.25rem; / 4px /
    h-minheight: min-content;
    h-maxheight: max-content;

Spacing

  • Padding

    // p-{size}
    <div className="p-2">Padding</div>
    // pt-{size}, pr-{size}, pb-{size}, pl-{size}
    ClassProperties
    p-0padding: 0px;
    px-1padding-left: 0.25rem; / 4px /
    padding-right: 0.25rem; / 4px /
    py-3padding-top: 0.75rem; / 12px /
    padding-bottom: 0.75rem; / 12px /
  • Margin

    // m-{size}
    <div className="m-4">Margin</div>
    // mt-{size}, mr-{size}, mb-{size}, ml-{size}
    ClassProperties
    m-0margin: 0px;
    mx-0margin-left: 0px;
    margin-right: 0px;
    mx-1margin-left: 0.25rem; / 4px /
    margin-right: 0.25rem; / 4px /
    my-2margin-top: 0.5rem; / 8px /
    margin-bottom: 0.5rem; / 8px /

Typography

  • font family

    // font-{family}
    <p className="font-serif">font-family</p>
    ClassProperties
    font-sansfont-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-seriffont-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  • font size

    // text-{size}
    <p className="text-ts">text-size</p>
    ClassProperties
    text-xsfont-size: 0.75rem; / 12px /
    line-height: 1rem; / 16px /
    text-smfont-size: 0.875rem; / 14px /
    line-height: 1.25rem; / 20px /
    text-basefont-size: 1rem; / 16px /
    line-height: 1.5rem; / 24px /
    text-lgfont-size: 1.125rem; / 18px /
    line-height: 1.75rem; / 28px /
  • font weight

    // font-{weight}
    <p className="font-thin">font-weight</p>
    ClassProperties
    font-thinfont-weight: 100;
    font-lightfont-weight: 300;
    font-normalfont-weight: 400;
    font-boldfont-weight: 700;
  • letter spacing

    // tracking-{}
    <p class="tracking-normal">letter spacing</p>
    ClassProperties
    tracking-tighterletter-spacing: -0.05em;
    tracking-tightletter-spacing: -0.025em;
    tracking-normalletter-spacing: 0em;
    tracking-wideletter-spacing: 0.025em;
    tracking-0letter-spacing: 0;
  • line height

    // leading-{height}
    <p class="leading-normal">leading-height</p>
    ClassProperties
    leading-3line-height: .75rem; / 12px /
    leading-4line-height: 1rem; / 16px /
    leading-5line-height: 1.25rem; / 20px /
    leading-noneline-height: 1;
    leading-tightline-height: 1.25;
    leading-normalline-height: 1.5;
    leading-looseline-height: 2;
  • text align

    // text-{align}
    <p className="text-left">text-align</p>
    ClassProperties
    text-lefttext-align: left;
    text-centertext-align: center;
    text-righttext-align: right;
    text-justifytext-align: justify;
    text-starttext-align: start;
    text-endtext-align: end;
  • text color

    // text-{color}-{number}
    <p className="text-black-600">text-color</p>

    color: black, white, gray, red, orange, yellow, green ...

    ClassProperties
    text-inheritcolor: inherit;
    text-currentcolor: currentColor;
    text-transparentcolor: transparent;
    text-blackcolor: rgb(0 0 0);
    text-whitecolor: rgb(255 255 255);
    text-gray-950color: rgb(3 7 18);
  • text decoration

    // {text-docoration}
    <p className="underline">text-decoration</p>
    ClassProperties
    underlinetext-decoration-line: underline;
    overlinetext-decoration-line: overline;
    line-throughtext-decoration-line: line-through;
    no-underlinetext-decoration-line: none;
  • text transform

    // {text-transform}
    <p className="uppercase">text-transform</p>
    ClassProperties
    uppercasetext-transform: uppercase;
    lowercasetext-transform: lowercase;
    capitalizetext-transform: capitalize;
    normal-casetext-transform: none;
  • text overflow

    // text overflow
    <p className="uppercase">text overflow</p>
    ClassProperties
    truncateoverflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap; |
    | text-ellipsis | text-overflow: ellipsis; |
    | text-clip | text-overflow: clip; |

  • vertical align

    // vertical align
    <span className="inline-block align-baseline">vertical align</span>
    ClassProperties
    align-baselinevertical-align: baseline;
    align-topvertical-align: top;
    align-middlevertical-align: middle;
    align-bottomvertical-align: bottom;
profile
😊

0개의 댓글