Search

Tailwind - flex

Tailwind - flex

flex λŠ” Container 에 item 을 λ°°μΉ˜ν•˜λŠ” 방법을 μ§€μ •ν•˜μ—¬ μœ μ—°ν•œ λ ˆμ΄μ•„μ›ƒμ„ μ μš©μ‹œν‚€λŠ” λ ˆμ΄μ•„μ›ƒμž…λ‹ˆλ‹€.
β€’
μ»¨ν…Œμ΄λ„ˆ : λ°°μΉ˜ν•  UI μš”μ†Œλ₯Ό λ‹΄λŠ” λ°•μŠ€
β€’
μ•„μ΄ν…œ : 배치 및 μ •λ ¬ν•  μš”μ†Œ
tailwind μ—μ„œλŠ” flex 클래슀λ₯Ό μ μš©ν•˜μ—¬, νŠΉμ • μš”μ†Œλ₯Ό flex μ»¨ν…Œμ΄λ„ˆλ₯Ό 지정할 수 μžˆμŠ΅λ‹ˆλ‹€.

FLEX μΉ΄λ“œλ·° λ ˆμ΄μ•„μ›ƒ

import React from 'react'; import MainLayout from '../../layouts/MainLayout'; const SkeletonCard = () => { return ( <div className="m-10 inline-block w-[320px]"> <div className="bg-gray-200 p-4 rounded-lg shadow-md space-y-4 animate-pulse"> <div className="h-60 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> <div className="space-y-2"> <div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> <div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> <div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> <div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> <div className="h-4 bg-gradient-to-r from-gray-300 via-gray-200 to-gray-300 rounded"></div> </div> </div> </div> ); }; const Flex = () => { return ( <MainLayout> <div className="flex flex-wrap justify-center p-10"> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> <SkeletonCard /> </div> </MainLayout> ); }; export default Flex;
JavaScript
볡사
flex λ ˆμ΄μ•„μ›ƒμ€ 헀더, μΉ΄λ“œλ·°, λ“± λ‹€μ–‘ν•œ UI λ ˆμ΄μ•„μ›ƒμ— μ‚¬μš©λ©λ‹ˆλ‹€.

FLEX 헀더

import React from 'react'; import { Link } from 'react-router-dom'; const Header = () => { return ( <header className="bg-gray-800 text-white p-4"> <div className="container mx-auto flex justify-between items-center"> <Link to="/"><h1 className="text-xl font-bold">ALOHA CLASS</h1></Link> <nav> <Link to="/" className="mx-2 hover:underline">Home</Link> <Link to="/login" className="mx-2 hover:underline">Login</Link> <Link to="/margin" className="mx-2 hover:underline">Margin</Link> <Link to="/padding" className="mx-2 hover:underline">Padding</Link> <Link to="/border" className="mx-2 hover:underline">Border</Link> <Link to="/flex" className="mx-2 hover:underline">Flex</Link> </nav> </div> </header> ); }; export default Header;
JavaScript
볡사