π§Ό
30μΌμ°¨
Part 7. CSS νλ μμν¬ BootStrap
Ch 1. CSS νλ μμν¬ BootStrap
Ch 1. CSS νλ μμν¬ BootStrap
https://getbootstrap.com/docs/5.1/getting-started/introduction/
<head>
...
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"
></script>
</head>
https://getbootstrap.com/docs/5.1/components/buttons/
https://getbootstrap.com/docs/5.1/components/button-group/
https://getbootstrap.com/docs/5.1/components/dropdowns/
https://getbootstrap.com/docs/5.1/components/list-group/
https://getbootstrap.com/docs/5.1/forms/overview/
https://getbootstrap.com/docs/5.1/forms/form-control/
https://getbootstrap.com/docs/5.1/forms/input-group/
https://getbootstrap.com/docs/5.1/components/modal/
var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')
myModal.addEventListener('shown.bs.modal', function () {
myInput.focus()
})
https://getbootstrap.com/docs/5.1/components/tooltips/
ν΄νμ μ±λ₯μμ μ΄μ λ‘ opt-in λμ΄ μμΌλ―λ‘ μ§μ μ΄κΈ°νν΄μΌ νλ€.
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
π npmμΌλ‘ Bootstrap μ¬μ©νκΈ°
- Bootstrap μμ νμν κΈ°λ₯λ§ κ°μ Έμ μ¬μ©ν μ μλ€.
- Bootstrap μμ μ 곡νλ κΈ°λ³Έμ μΈ ν λ§λ€μ μ§μ 컀μ€ν°λ§μ΄μ§ ν μ μλ€.
$ npm install bootstrap
// main.js
import bootstrap from "bootstrap/dist/js/bootstrap.bundle";
/* main.scss */
@import "../node_modules/bootstrap/scss/bootstrap.scss";
https://getbootstrap.com/docs/5.1/customize/sass/#maps-and-loops
/* main.scss */
@import "../node_modules/bootstrap/scss/functions";
@import "../node_modules/bootstrap/scss/variables";
@import "../node_modules/bootstrap/scss/mixins";
@import "../node_modules/bootstrap/scss/root";
https://getbootstrap.com/docs/5.1/customize/color/
π μ±λ₯ μ΅μ ν (νΈλ¦¬ μμ΄νΉ) => Bootstrap μμ μ°λ¦¬κ° νμν κΈ°λ₯λ€λ§ κ³¨λΌ κ°μ Έμ΄!
https://getbootstrap.com/docs/5.1/customize/optimize/
/* main.scss */
/*@import "../node_modules/bootstrap/scss/bootstrap.scss";*/
@import "../node_modules/bootstrap/scss/bootstrap";
// import bootstrap from "bootstrap/dist/js/bootstrap.bundle";
import Dropdown from "bootstrap/js/dist/dropdown";
μ±λ₯μμ μ΄μ λ‘ opt-in λμ΄ μμΌλ―λ‘ μ§μ μ΄κΈ°νν΄μΌ νλ€.
(μ΄κΈ°ν νμ§ μμλ λλ μ»΄ν¬λνΈλ μμ. ex λ²νΌ, μ€νΌλ λ±)
// Dropdown
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'))
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
return new Dropdown(dropdownToggleEl)
})
// Modal
new Modal(document.querySelector("#exampleModal"), {
// options
backdrop: "static",
});