ããã«ã¡ã¯ãAWS CLIã好ããªç¦å³¶ã§ãã
ã¤ã³ãã©ã¨ã³ã¸ãã¢ã®ãã£ãªã¢ãã¡ã¤ã³ã®ç§ã社å ã§Pythonã使ã£ãã¢ããªéçºã®å¦ç¿ãããæ©ä¼ããã£ããããå æ¥ããå¦ãã ãã¨ãã¢ã¦ãããããã¦ãã¾ãã
å æ¥ã¯ãFlaskå ¥éã«é¢ããããã°ãã¾ã¨ãã¾ããããç¶ãã¦ã¯Bootstrapå ¥éã®ããã°ãã¾ã¨ãããã¨æãã¾ãã
- åèæ å ±
- Bootstrapã¨ã¯
- 使ã£ã¦ã¿ã
- Container(ã³ã³ãã)
- Spacing(ä½ç½)
- Grid system(ã°ãªããã·ã¹ãã )
- Buttons(ãã¿ã³)
- Alerts(ã¢ã©ã¼ã)
- Tables(ãã¼ãã«)
- Form controls(ãã©ã¼ã ã³ã³ããã¼ã«)
- Navbar(ããã²ã¼ã·ã§ã³ãã¼)
- Spinners(ã¹ããã¼)
- ã¢ã¤ã³ã³
- Pagination(ãã¼ã¸ãã¼ã·ã§ã³)
- Select(ã»ã¬ã¯ã)
- List group(ãªã¹ãã°ã«ã¼ã)
- ãã®ä»
- çµããã«
åèæ å ±
Bootstrapã¨ã¯
Webãµã¤ããå¹ççã«éçºããããã®ãã¬ã¼ã ã¯ã¼ã¯ã«ãªãã¾ãã
Bootstrapã«ã¯ãCSSãJavascriptã®ãã³ãã¬ã¼ããç¨æããã¦ããããã 1ããå®è£ ãããã¨ãªãããªãããªãã¶ã¤ã³ã表ç¾ãããã¨ãã§ãã¾ãã
ç§ã®ãã¶ã¤ã³ã»ã³ã¹ããªãã§ããã以ä¸ã®ãããªãã¶ã¤ã³ã表ç¾ã§ãã¾ãã
使ã£ã¦ã¿ã
Bootstrapãå©ç¨ããæ¹æ³ã¯ä»¥ä¸ã®3ãã¿ã¼ã³ããã¾ãã
- ããã±ã¼ã¸ããã¼ã¸ã£çµç±ã§ã¤ã³ã¹ãã¼ã«ãã
- ã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ããã
- CDNçµç±ã§ã¤ã³ã¯ã«ã¼ããã
ä»åã¯æ軽ã«å§ããããCDNçµç±ã§ã¤ã³ã¯ã«ã¼ã
ãã¦ä½¿ã£ã¦ã¿ã¾ãã
以ä¸ãBootstrapã使ããã¼ã¹ã¨ãªãã¾ãã
<!doctype html> <html lang="ja"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- CDNçµç±ã§CSSã®ã¤ã³ã¯ã«ã¼ã --> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> <!-- CDNçµç±ã§ã¢ã¤ã³ã³ã®ã¤ã³ã¯ã«ã¼ã(ã¢ã¤ã³ã³ã使ãå ´åã®ã¿) --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"> </head> <body> <!-- ããããç´¹ä»ããã³ã¼ãã¯ããã«æ¸ã --> <!-- CDNçµç±ã§ Javascrptã®ã¤ã³ã¯ã«ã¼ã --> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> </body> </html>
ä¸è¨ã¯ãCSS, Javascriptã«å ãã¦ãã¢ã¤ã³ã³ãã¤ã³ã¯ã«ã¼ããã¦ãã¾ãããã¢ã¤ã³ã³ã使ããªãå ´åã¯è¨è¿°ã¯ä¸è¦ã§ãã
ããããã<body></body>
ã®ä¸ã«ã³ã¼ããæ¸ããã¨ã§Bootstrapã§ã§ãããã¨ãç´¹ä»ãããã¨æãã¾ãã
Container(ã³ã³ãã)
container
ã¯ã©ã¹ãå©ç¨ãããã¨ã§ã³ã³ãã³ãã«é©åãªä½ç½ãä¸ãããã¨ãã§ãã¾ãã
<div class="container"> Hello, World! </div>
container
ã¯ã©ã¹ã使ããªãå ´åã¯ã以ä¸ã®ããã«ä½ç½ãªãã§è¡¨ç¤ºããã¾ãã
詳細:
Spacing(ä½ç½)
ããã«ãä¸å´ã«ãä½ç½ã追å ãããå ´åã¯ãmt-*ï¼margin-topï¼
ã¯ã©ã¹ãå©ç¨ãã¾ãã
mt-1ããmt-5ã®ããã«è¨å®ãããã¨ã§ä½ç½ã追å ãããã¨ãã§ãã¾ãã
<div class="container mt-5"> Hello, World! </div>
詳細:
Grid system(ã°ãªããã·ã¹ãã )
row
ã¨col
ã¯ã©ã¹ã使ããã¨ã§1è¡12ã«ã©ã ã®ä¸ã§æ§ã
ãªå²ãå½ã¦ãå¯è½ã§ãã
ã¡ãªã¿ã«ã1åã®å¹
ãåãããããããããã«ãbg-*
ã«ããèæ¯è²ãã¤ãã¦ãã¾ãã
<div class="container mt-5"> <div class="row"> <div class="col bg-primary">1 of 3</div> <div class="col bg-success">2 of 3</div> <div class="col bg-warning">3 of 3</div> </div> </div>
ä¸è¨ã®å ´åãåã«å¿ãã¦åçã«åã®å¹
ãå²ãå½ã¦ããã¾ãããcol-æ°å
ã«ããå²ãå½ã¦ãå¹
ã決ãããã¨ãã§ãã¾ãã
<div class="container mt-5"> <div class="row"> <div class="col-6 bg-primary">1 of 3</div> <div class="col-4 bg-success">2 of 3</div> <div class="col-2 bg-warning">3 of 3</div> </div> </div>
ã¾ããrow-cols-æ°å
ã«ãã1è¡ã®åæ°ã決ãããã¨ãã§ãã¾ãã
以ä¸ã¯ã1è¡2åã§è¨å®ãã¦ãã¾ãã
<div class="container mt-5"> <div class="row row-cols-2"> <div class="col bg-primary">1 of 3</div> <div class="col bg-success">2 of 3</div> <div class="col bg-warning">3 of 3</div> </div> </div>
詳細:
Buttons(ãã¿ã³)
btn
ã¨btn-*
ã¯ã©ã¹ã使ããã¨ã§è²ä»ãã®ãã¿ã³ã表示ã§ãã¾ãã
btn-outline-*
ã使ãã¨æ ã¨æåã ãè²ãå¤ãããã¨ãã§ãã¾ãã
<div class="container mt-5"> <button type="button" class="btn btn-primary">Primary</button> <button type="button" class="btn btn-secondary">Secondary</button> <button type="button" class="btn btn-success">Success</button> <button type="button" class="btn btn-danger">Danger</button> <button type="button" class="btn btn-warning">Warning</button> <button type="button" class="btn btn-info">Info</button> <button type="button" class="btn btn-light">Light</button> <button type="button" class="btn btn-dark">Dark</button> <button type="button" class="btn btn-link">Link</button> <hr> <button type="button" class="btn btn-outline-primary">Primary</button> <button type="button" class="btn btn-outline-secondary">Secondary</button> <button type="button" class="btn btn-outline-success">Success</button> <button type="button" class="btn btn-outline-danger">Danger</button> <button type="button" class="btn btn-outline-warning">Warning</button> <button type="button" class="btn btn-outline-info">Info</button> <button type="button" class="btn btn-outline-light">Light</button> <button type="button" class="btn btn-outline-dark">Dark</button> </div>
ã¾ãããã®ã¯ã©ã¹ã¯<button>
ã ãã§ã¯ãªãã<a>
ã<input>
è¦ç´ ã§ãå©ç¨ãããã¨ãã§ãã¾ãã
詳細:
Alerts(ã¢ã©ã¼ã)
alert
ã¨alert-è²
ã¯ã©ã¹ã使ããã¨ã§ã¦ã¼ã¶ã¼ã«å¯¾ããã¡ãã»ã¼ã¸ã®ãã¶ã¤ã³ãããæãã«ã§ãã¾ãã
<div class="container mt-5"> <div class="alert alert-primary" role="alert">A simple primary alertâcheck it out!</div> <div class="alert alert-secondary" role="alert">A simple secondary alertâcheck it out!</div> <div class="alert alert-success" role="alert">A simple success alertâcheck it out!</div> <div class="alert alert-danger" role="alert">A simple danger alertâcheck it out!</div> <div class="alert alert-warning" role="alert">A simple warning alertâcheck it out!</div> <div class="alert alert-info" role="alert">A simple info alertâcheck it out!</div> <div class="alert alert-light" role="alert">A simple light alertâcheck it out!</div> <div class="alert alert-dark" role="alert">A simple dark alertâcheck it out!</div> </div>
詳細:
Tables(ãã¼ãã«)
table
ã¯ã©ã¹ãå©ç¨ãããã¨ã§ããæãã®ãã¼ãã«æ§é ã«ã§ãã¾ãã
<div class="container mt-5"> <table class="table"> <thead> <tr> <th>#</th> <th>èå</th> <th>åå</th> <th>ãã å</th> </tr> </thead> <tbody> <tr> <th>1</th> <td>ä½è¤</td> <td>太é</td> <td>ããã¡ãã</td> </tr> <tr> <th>2</th> <td>é´æ¨</td> <td>次é</td> <td>ããã¡ãã</td> </tr> </tbody> </table> </div>
ã¾ãã<table>
ã¿ã°ã«table-striped
ã追å ãããã¨ã§å¥æ°ã®è¡æ°ã«è²ãä»ãè¦ããããªãã¾ãã
<table class="table table-striped">
ãããã¼ã®è²ãå¤ãããå ´åã¯ã<thead>
ã¿ã°ã«table-è²
ã¯ã©ã¹ã使ãã¾ãã
<thead class="table-success">
詳細:
Form controls(ãã©ã¼ã ã³ã³ããã¼ã«)
form-control
ã¯ã©ã¹ãå©ç¨ãããã¨ã§ãã©ã¼ã ã®ãã¶ã¤ã³ãããæãã«ã§ãã¾ãã
<div class="container mt-5"> <form class="row"> <div class="col-5"> <input type="text" class="form-control" placeholder="æ¤ç´¢ãã¼ã¯ã¼ã"> </div> <div class="col-auto"> <button type="submit" class="btn btn-primary">æ¤ç´¢</button> </div> </form> </div>
ç»åãã¢ãããã¼ããããã©ã¼ã ãããæãã«ãã¦ããã¾ãã
<div class="container mt-5"> <input class="form-control" type="file"> </div>
詳細:
Navbar(ããã²ã¼ã·ã§ã³ãã¼)
navbar
ã¯ã©ã¹ãå©ç¨ãããã¨ããã²ã¼ã·ã§ã³ãã¼ãå©ç¨ã§ãã¾ãã
ã¾ããããã²ã¼ã·ã§ã³ãã¼ãå©ç¨ããã«ãããã以ä¸ã®ã¯ã©ã¹ãå©ç¨ãã¾ãã
- navbar-expand-ãµã¤ãº: ç»é¢ãµã¤ãºã«å¿ãã¦ãããã²ã¼ã·ã§ã³ãæãããã¿ã¾ãã
- navbar-brand: å·¦å´ã«è¡¨ç¤ºããããæåãç»åãè¨å®ãã¾ãã
- navbar-nav, nav-item: å³å´ã«è¡¨ç¤ºãããããªã³ã¯ãªã©ãè¨å®ãã¾ãã
<nav class="navbar navbar-expand-sm bg-danger-subtle"> <div class="container"> <a class="navbar-brand"><img src="..." alt="ç»åãªã"></a> <ul class="navbar-nav"> <li class="nav-item"><a class="nav-link" href="#">Home</a></li> <li class="nav-item"><a class="nav-link" href="#">Link1</a></li> <li class="nav-item"><a class="nav-link" href="#">Link2</a></li> <li class="nav-item"><a class="nav-link" href="#">Link3</a></li> </ul> </div> </nav>
bg-*
ã«ããèæ¯è²ãè¨å®ã§ãã¾ãããè¨å®ã§ããè²ã¯ä»¥ä¸ãã確èªãã ããã
ã¾ããnav-tabs
ã¯ã©ã¹ã«ããã¿ãã表示ã§ãã¾ãã
<ul class="nav nav-tabs"> <li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Active</a></li> <li class="nav-item"><a class="nav-link" href="#">Link</a></li> <li class="nav-item"><a class="nav-link" href="#">Link</a></li> <li class="nav-item"><a class="nav-link disabled">Disabled</a></li> </ul>
詳細:
Spinners(ã¹ããã¼)
spinner-border
ã¯ã©ã¹ã§ã¹ããã¼ã表示ãããã¨ãã§ãã¾ãã
<div class="container mt-5"> <div class="spinner-border text-primary" role="status"></div> </div>
ç»åã§ã¯ä¼ããããªãã§ãããã°ã«ã°ã«ãã¦ã¾ãã
詳細:
ã¢ã¤ã³ã³
bi-ã¢ã¤ã³ã³å
ã¯ã©ã¹ã§ã¢ã¤ã³ã³ã表示ã§ãã¾ãã
<div class="container mt-5"> <div class="row"> <div class="row row-cols-4"> <i class="bi-alarm" style="font-size: 5rem;"></i> <i class="bi-alarm" style="font-size: 5rem; color: cornflowerblue;"></i> <i class="bi-house" style="font-size: 5rem;"></i> <i class="bi-person-circle" style="font-size: 5rem;"></i> <i class="bi-bookmark-star" style="font-size: 5rem;"></i> <i class="bi-search" style="font-size: 5rem;"></i> <i class="bi-upload" style="font-size: 5rem;"></i> <i class="bi-x-circle" style="font-size: 5rem;"></i> </div> </div> </div>
ã©ããªã¢ã¤ã³ã³ã使ãããã®è©³ç´°ã¯ä»¥ä¸ã確èªãã ããã
Pagination(ãã¼ã¸ãã¼ã·ã§ã³)
pagination
,page-item
,page-link
ã¯ã©ã¹ã«ãããã¼ã¸ãã¼ã·ã§ã³ã®ãã¿ã³ã表示ã§ãã¾ãã
<div class="container mt-5"> <ul class="pagination"> <li class="page-item"><a class="page-link" href="#">Previous</a></li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item"><a class="page-link" href="#">2</a></li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"><a class="page-link" href="#">Next</a></li> </ul> </div>
詳細:
Select(ã»ã¬ã¯ã)
from-select
ã¯ã©ã¹ãå©ç¨ãããã¨ã§ã»ã¬ã¯ãã¡ãã¥ã¼ã®ãã¶ã¤ã³ãããæãã«ãã¦ããã¾ãã
<div class="container mt-5"> <select class="form-select"> <option selected>ã»ã¬ã¯ãã¡ãã¥ã¼</option> <option value="1">Amazon EC2</option> <option value="2">Amazon RDS</option> <option value="3">Amazon VPC</option> </select> </div>
詳細:
List group(ãªã¹ãã°ã«ã¼ã)
list-group
,list-group-item
ã¯ã©ã¹ãå©ç¨ãããã¨ã§ããæãã®ãã¶ã¤ã³ã®ãªã¹ããä½ãã¾ãã
<div class="container mt-5"> <ul class="list-group"> <li class="list-group-item">1</li> <li class="list-group-item">2</li> <li class="list-group-item">3</li> </ul> </div>
ul
ã¿ã°ã«list-group-horizontal
ã¯ã©ã¹ã追å ãããã¨ã§æ°´å¹³ã«ä¸¦ã¹ããã¨ãã§ãã¾ãã
<ul class="list-group list-group-horizontal">
詳細:
ãã®ä»
説æã¯çãã®ã§ããã以ä¸ã®ãããªãã¨ãå®ç¾ã§ãã¾ãã
Dropdowns(ãããããã¦ã³)
<div class="container mt-5"> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> ãããããã¦ã³ </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Action</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="#">Another action</a></li> </ul> </div> </div>
詳細:
Cards(ã«ã¼ã)
<div class="container mt-5"> <div class="card" style="width: 30rem;"> <img src="ç»å" class="card-img-top" alt="ç»åãªã"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="https://www.serverworks.co.jp/" class="btn btn-primary">Serverworks GO</a> </div> </div> </div>
詳細:
Modal(ã¢ã¼ãã«)
<div class="container mt-5"> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal"> Launch demo modal </button> <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> Modal </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div>
ä¸è¨ãã¿ã³ãæ¼ä¸ããã¨ã¢ã¼ãã«ã表示ããã¾ãã
詳細:
Toasts(ãã¼ã¹ã)
<div class="container mt-5"> <button type="button" class="btn btn-primary" id="liveToastBtn">Show live toast</button> <div class="toast-container position-fixed bottom-0 end-0 p-3"> <div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <strong class="me-auto">Bootstrap</strong> <small>11 mins ago</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> Hello, world! This is a toast message. </div> </div> </div> </div> </body> <script> const toastTrigger = document.getElementById('liveToastBtn') const toastLiveExample = document.getElementById('liveToast') if (toastTrigger) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) toastTrigger.addEventListener('click', () => { toastBootstrap.show() }) } </script>
ãã¿ã³ãæ¼ãã¨å³ä¸ã«ãã¼ã¹ãã表示ããã¾ãã
詳細:
Carousel(ã«ã«ã¼ã»ã«)
<div class="container mt-5"> <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="https://via.placeholder.com/1200x100" alt="..."> </div> <div class="carousel-item"> <img src="https://via.placeholder.com/1200x100" alt="..."> </div> <div class="carousel-item"> <img src="https://via.placeholder.com/1200x100" 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>
<
,>
ãæ¼ããã¨ã§ç»åãåãæ¿ãããã¾ãã
詳細
Collapse(ã³ã©ãã¹)
<div class="container mt-5"> <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> ä¸ããä¸ã¸ã®éã </button> <div class="collapse" id="collapseExample"> <div class="card card-body"> ä¸ããä¸ã¸ã®éã </div> </div> <br><br> <p> <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWidthExample" aria-expanded="false" aria-controls="collapseWidthExample"> å·¦ããå³ã¸ã®éã </button> </p> <div style="min-height: 120px;"> <div class="collapse collapse-horizontal" id="collapseWidthExample"> <div class="card card-body" style="width: 300px;"> å·¦ããå³ã¸ã®éã </div> </div> </div> </div>
ãã¿ã³ãæ¼ãã¨ãé ãã¦ããã¡ãã»ã¼ã¸ãããæãã«å±éããã¾ãã
詳細:
Progress(ããã°ã¬ã¹)
<div class="container mt-5"> <div class="progress" role="progressbar" aria-label="Default striped example" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar progress-bar-striped" style="width: 10%"></div> </div> <div class="progress" role="progressbar" aria-label="Animated striped example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar bg-success progress-bar-striped progress-bar-animated" style="width: 50%"></div> </div> <div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar bg-warning text-dark" style="width: 75%">75%</div> </div> <div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar bg-danger" style="width: 100%">100%</div> </div> </div>
詳細:
çµããã«
ä»åã¯ãBootstrapå ¥éã«é¢ããããã°ãã¾ã¨ãã¦ã¿ã¾ããã ã©ãªããã®ãå½¹ã«ç«ã¦ãã°å¹¸ãã§ãã