Kaigai Blog living abroad in my twenties

【僕の学習ノート】Bootstrapとは?分かりやすく解説

Infotech Web Developer

この記事は、Bootstrapについて端的にまとめてある僕のノートです。もし読者さんの役にも立てれば幸いです。

【僕の学習ノート】Bootstrapとは?分かりやすく解説

【僕の学習ノート】Bootstrapとは?分かりやすく解説
Bootstrapとは、効率良くレスポンシブなWebサイトを作る際によく使われる、CSSとJavaScriptのコードが含まれているライブラリーです。

まとめ

まとめ

container

table

row

col

img-fluid

alert

modifier

grid options

Breakpoint Class infix Dimensions
Extra small *Default (何も書かなくて良い) < 576px
Small sm ≧ 576px
Medium md ≧ 768px
Large lg ≧ 992px
Extra large xl ≧ 1200px
Extra extra large xxl ≧ 1400px

これを使うことで、レスポンシブを加えることが出来ます。(To make the code to be responsive, you have to insert the abbreviation into the CSS class name.)

ヘッダーに入れるのを忘れずに!!

<meta name="viewport" content="width=device-width, initial-scale=1">

どう機能するのか理解する為に

<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-3">
                    <div class="alert alert-primary" role="alert">
                        Today
                    </div>
                </div>
                <div class="col-sm-3">
                    <div class="alert alert-primary" role="alert">
                        Tomorrow
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="alert alert-primary" role="alert">
                        After tomorrow
                    </div>
                </div>
            </div>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"></script>
    </body>
</html>

Might be useful links