Tailwind CSS

예진·2024년 11월 5일

개인 공부

목록 보기
11/14
post-thumbnail

Tailwind CSS

Display

  • box sizing

    <div className="box-border h-32 w-32 p-4 border-4 ...">
      <!-- ... -->
    </div>
    
    ClassProperties
    box-borderbox-sizing: border-box;
    box-contentbox-sizing: content-box;
  • display

    <div>
      When controlling the flow of text, using the CSS property
      <span className="inline">display: inline</span>
      will cause the text inside the element to wrap normally.
    
      While using the property <span className="inline-block">display: inline-block</span>
      will wrap the element to prevent the text inside from extending beyond its parent.
    
      Lastly, using the property <span className="block">display: block</span>
      will put the element on its own line and fill its parent.
    </div>
    ClassProperties
    blockdisplay: block;
    inline-blockdisplay: inline-block;
    inlinedisplay: inline;
    flexdisplay: flex;
    inline-flexdisplay: inline-flex;
    griddisplay: grid;

Flexbox

  • flex
    <div className="flex">
    	<div className="flex-none">
    		01
    	</div>
    	<div className="flex-auto">
    		02
    	</div>
    	<div className="flex-auto">
    		03
    	</div>
    </div>
    ClassProperties
    flex-1flex: 1 1 0%;
    flex-autoflex: 1 1 auto;
    flex-initialflex: 0 1 auto;
    flex-noneflex: none;
  • justify content
// justify-{alignment}
<div className="flex justify-center">
	<div>01</div>
  <div>02</div>
  <div>03</div>
</div>
ClassProperties
justify-normaljustify-content: normal;
justify-startjustify-content: flex-start;
justify-endjustify-content: flex-end;
justify-centerjustify-content: center;
justify-betweenjustify-content: space-between;
justify-stretchjustify-content: stretch;
  • align content
// content-{}
<div className="h-56 grid grid-cols-3 gap-4 content-center">
  <div>01</div>
  <div>02</div>
  <div>03</div>
  <div>04</div>
  <div>05</div>
</div>
ClassProperties
content-normalalign-content: normal;
content-centeralign-content: center;
content-startalign-content: flex-start;
content-endalign-content: flex-end;
content-betweenalign-content: space-between;
content-stretchalign-content: stretch;
  • align items
// items-{}
<div className="flex items-center">
  <div className="py-4">01</div>
  <div className="py-12">02</div>
  <div className="py-8">03</div>
</div>
ClassProperties
items-startalign-items: flex-start;
items-endalign-items: flex-end;
items-centeralign-items: center;
items-baselinealign-items: baseline;
items-stretchalign-items: stretch;

Backgrounds

  • background color
    // bg-{color}
    <div className="bg-indigo-500">background color</div>
    ClassProperties
    bg-inheritbackground-color: inherit;
    bg-transparentbackground-color: transparent;
    bg-blackbackground-color: rgb(0 0 0);
    bg-whitebackground-color: rgb(255 255 255);

Borders

  • border radius

    // rounded-{}
    <div className="rounded">border radius</div>
    ClassProperties
    rounded-noneborder-radius: 0px;
    rounded-smborder-radius: 0.125rem; / 2px /
    roundedborder-radius: 0.25rem; / 4px /
    rounded-mdborder-radius: 0.375rem; / 6px /
    rounded-lgborder-radius: 0.5rem; / 8px /
    rounded-fullborder-radius: 9999px;
  • border style

    // border-{style}
    <div className="border-solid">border style</div>
    ClassProperties
    border-solidborder-style: solid;
    border-dashedborder-style: dashed;
    border-dottedborder-style: dotted;
    border-doubleborder-style: double;
    border-hiddenborder-style: hidden;
    border-noneborder-style: none;

Interactivity

  • cursor
//cursor
<button type="button" className="cursor-pointer">
  Submit
</button>
ClassProperties
cursor-autocursor: auto;
cursor-defaultcursor: default;
cursor-pointercursor: pointer;
profile
😊

0개의 댓글