目次
CSS フレームワーク Bulma
みなさんこんにちは、どんぶラッコです。
この度、CSSフレームワークBulmaのチートシートを作ったので公開しておこうと思います!
といっても、レイアウトについてよく使うやつを列挙しただけですが笑
適宜リファレンスとして使ってください!
クラスの命名規則
https://bulma.io/documentation/modifiers/syntax/
They all start with is- or has-.
色
is-primaryis-linkis-infois-successis-warningis-danger
大きさ
is-smallis-mediumis-large
スタイルや状態
is-outlinedis-loading[disabled]
Float
is-clearfixis-pulled-leftis-pulled-right
クリア系
is-marginlessis-paddinglessis-radiuslessis-shadowless
Helper クラス
is-overlayis-clippedis-unselectableis-invisibleis-hiddenis-sr-onlyis-relative
Display クラス (1つ)
is-blockis-flexis-inlineis-inline-blockis-inline-flex
1つだけ表示・隠す
is-**-mobileis-**-tablet-onlyis-**-desktop-onlyis-**-widescreen-onlyis-hidden-mobileis-hidden-tablet-onlyis-hidden-desktop-onlyis-hidden-widescreen-only
2つ以上表示・隠す
is-**-touchis-**-tabletis-**-desktopis-**-widescreenis-**-fullhdis-hidden-touchis-hidden-tabletis-hidden-desktopis-hidden-widescreenis-hidden-fullhd
テキスト・背景の色
9色・9階調の灰色 has-text-** has-background-**
has-text-white… 白has-text-black… 黒has-text-light… ライトhas-text-dark… ダークhas-text-primary… エメラルドhas-text-info… 明るい青has-text-link… 青has-text-success… 緑has-text-warning… 黄has-text-danger… 赤has-text-black-bis… 暗いhas-text-black-ter…has-text-grey-darker…has-text-grey-dark…has-text-grey…has-text-grey-light…has-text-grey-lighter…has-text-white-ter…has-text-white-bis… 明るい
Size
is-size-1…is-size-73remから0.5remずつ小さくなっていく
Alignment
has-text-centeredhas-text-justifiedhas-text-lefthas-text-right
大文字小文字
is-capitalizedis-lowercaseis-uppercaseis-italic
テキスト重み
has-text-weight-lighthas-text-weight-normalhas-text-weight-mediumhas-text-weight-semiboldhas-text-weight-bold
Font-family
is-family-sans-serifis-family-monospaceis-family-primaryis-family-secondaryis-family-code
Columns
Basics
columnsで囲ってから中に column を追加する
<div class="columns">
<div class="column">
First column
</div>
<div class="column">
Second column
</div>
<div class="column">
Third column
</div>
<div class="column">
Fourth column
</div>
</div>
Sizes
他の列は自動的にスペースを埋めてくれる
is-full4/4is-three-quarters3/4is-half2/4is-one-quarter1/4
is-two-thirds2/3is-one-third1/3
is-four-fifths4/5is-three-fifths3/5is-two-fifths2/5is-one-fifths1/5
12カラムシステム
is-1~is-12
offsetを作る場合
-
is-offset-**<div class=”columns is-mobile”> <div class=”column is-half is-offset-one-quarter”></div> </div>
Narrow System
必要なスペースを獲得したい場合、 is-narrow を利用。
<div class="columns">
<div class="column is-narrow">
<div class="box" style="width: 200px;"></div>
</div>
<div class="column"></div>
</div>
- モバイル端末でもオンにしたい場合は
is-mobileをつける。 - デスクトップにもしたいなら
is-desktopをつける。 <div class=”columns is-mobile”> … </div> -
is-gaplessでcolumns間のスペースをなくす -
is-multilineで複数行に適用できる <div class=”columns is-gapless is-multiline”> … </div>
Container
<div class="container">
<div class="notification">
This container is <strong>centered</strong> on desktop.
</div>
</div>
.navbar.hero.section.footer
Level
level: main containerlevel-leftfor the left sidelevel-rightfor the right sidelevel-itemfor each individual element
Media Object
<article class="media">
<figure class="media-left">
</figure>
<div class="media-content">
<div class="content">
</div>
<nav class="level is-mobile">
<div class="level-left">
<a class="level-item"></a>
<a class="level-item"></a>
<a class="level-item"></a>
</div>
</nav>
</div>
<div class="media-right">
<button class="delete"></button>
</div>
</article>
Hero
herohero-head(always at the top)hero-body(always vertically centered)hero-foot(always at the bottom)
full width banner が作れる
<section class="hero">
<div class="hero-body">
<div class="container">
<h1 class="title">
Hero title
</h1>
<h2 class="subtitle">
Hero subtitle
</h2>
</div>
</div>
</section>
is-bold グラデーション
<section class="hero is-medium is-primary is-bold">
</section>
大きさ変えられる
is-mediumis-largeis-fullheight
navbarを併用して
is-fullheight-with-navbar
Section
body の直接の子供
<body>
<section class="section">
<div class="container">
</div>
</section>
</body>
<footer class="footer">
</footer>
Tile
<div class="tile">
<!-- The magical tile element! -->
</div>
-
is-ancestor水平にtileを並べる <div class=”tile is-ancestor”> <div class=”tile”></div> <div class=”tile”></div> </div> -
is-vertical要素を目一杯に広げる <div class=”tile is-ancestor”> <div class=”tile is-4 is-vertical is-parent”> <div class=”tile is-child box”> <p class=”title”>One</p> </div> <div class=”tile is-child box”> <p class=”title”>Two</p> </div> </div> <div class=”tile is-parent”> <div class=”tile is-child box”> <p class=”title”>Three</p> </div> </div> </div>



















