헤더
<header data-bs-theme="dark">
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Carousel</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarCollapse"
aria-controls="navbarCollapse"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a
class="nav-link active"
aria-current="page"
href="#"
>Home</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a
class="nav-link disabled"
aria-disabled="true"
>Disabled</a
>
</li>
</ul>
<form class="d-flex" role="search">
<input
class="form-control me-2"
type="search"
placeholder="Search"
aria-label="Search"
/>
<button
class="btn btn-outline-success"
type="submit"
>
Search
</button>
</form>
</div>
</div>
</nav>
</header>
navbar
: 네비게이션 바 생성
navbar-expand-md
: 중간 화면 크기 이상에서 네비게이션 바를 수평 방향으로 확장. 더 작은 화면 크기에서는 아이템들이 수직으로 쌓임
navbar-dark
: 바의 텍스트 색상을 밝은 색상으로 설정
fixed-top
: 네비게이션 바를 화면 상단에 고정
bg-dark
: 바의 배경색을 어두운 색상으로 설정
캐러셀
<div class="container-fluid">
<div id="carouselExampleIndicators" class="carousel slide">
<div class="carousel-indicators">
<button
type="button"
data-bs-target="#carouselExampleIndicators"
data-bs-slide-to="0"
class="active"
aria-current="true"
aria-label="Slide 1"
></button>
<button
type="button"
data-bs-target="#carouselExampleIndicators"
data-bs-slide-to="1"
aria-label="Slide 2"
></button>
<button
type="button"
data-bs-target="#carouselExampleIndicators"
data-bs-slide-to="2"
aria-label="Slide 3"
></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="a.jpg" class="d-block w-100" alt="..." />
</div>
<div class="carousel-item">
<img src="a.jpg" class="d-block w-100" alt="..." />
</div>
<div class="carousel-item">
<img src="a.jpg" class="d-block w-100" alt="..." />
</div>
</div>
<button
class="carousel-control-prev"
type="button"
data-bs-target="#carouselExampleIndicators"
data-bs-slide="prev"
>
<span
class="carousel-control-prev-icon"
aria-hidden="true"
></span>
<span class="visually-hidden">Previous</span>
</button>
<button
class="carousel-control-next"
type="button"
data-bs-target="#carouselExampleIndicators"
data-bs-slide="next"
>
<span
class="carousel-control-next-icon"
aria-hidden="true"
></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
carousel slide
: 캐러셀 슬라이드 선언
carousel-indicators
: 케러셀의 현재 위치를 나타내는 인디케이터. 각 버튼은 특정 슬라이드로 이동하도록 설정
carousel-inner
: 각각의 슬라이드
carousel-control-prev
: 이전 슬라이드 이동
carousel-control-next
: 다음 슬라이드 이동