# Typography with Bulma and SASS https://bulma.io/documentation/ https://github.com/jgthms/bulma https://www.w3schools.com/sass/sass_intro.asp Bulma provides several options for configuring **typography**, both through **utility classes** and **Sass variables** for customization. Most of the time, you apply Bulma classes directly in your HTML, because Bulma is a CSS framework that defines classes to be used in HTML. Example: ```html
Bold and centered text
``` You *would* use the CSS Selectors (in your CSS files) if you want to customize the Bulma classes, for example: ```css # Override existing Bulma style .has-text-weight-bold { color: #ff0000; /* Custom override */ } # Adding custom styles to elements that already use Bulma classes .title.has-text-centered { text-transform: uppercase; } # Creating custom components to extend Bulma .custom-card .title { font-family: 'Lora', serif; } ``` ## 1. Bulma Typography Classes Bulma includes these predefined classes for text styling: | **Description** | **CSS Selector** | **HTML Usage** | | ----------------------- | ------------------------------------ | -------------------------------------------- | | Title | `.title` | `Text
` | | Alignment center | `.has-text-centered` | `Text
` | | Alignment right | `.has-text-right` | `Text
` | | Color primary | `.has-text-primary` | `Text
` | | Color danger | `.has-text-danger` | `Text
` | | Weight light | `.has-text-weight-light` | `Text
` | | Weight normal | `.has-text-weight-normal` | `Text
` | | Weight bold | `.has-text-weight-bold` | `Text
` | | Uppercase text | `.is-uppercase` | `Text
` | | Lowercase text | `.is-lowercase` | `Text
` | | Capitalized text | `.is-capitalized` | `Text
` | | Text size modifiers | `.is-size-1` to `.is-size-7` | `Text
` | | Responsive text size | `.is-size-4-mobile` etc. | `Text
` | ## 2. Sass typography variables You can customize typography **globally** using Bulma’s Sass variables. This happens in your custom `.scss` file. Example: ```scss $family-primary: 'Roboto', sans-serif; $body-size: 16px; $weight-bold: 700; @import "bulma"; ``` **Font Family** - `$family-primary` – Main font - `$family-secondary` – Alternative font - `$family-code` – Monospace font **Font Sizes** - `$size-1` to `$size-7` – Heading sizes - `$body-size` – Base font size **Font Weights** - `$weight-light` - `$weight-normal` - `$weight-semibold` - `$weight-bold` **Line Height** - `$body-line-height` **Text Colors** - `$text` – Default text color - `$text-strong` – Strong text color - `$link` – Link color