snt
Sciences Numériques et Technologie en classe de seconde au Lycée Saint-Exupéry de La Rochelle.
avec SASS (pré-processeur CSS)...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">
Hello World
</h1>
<p class="subtitle">
My first website with <strong>Bulma</strong>!
</p>
</div>
</section>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.min.css">
<link rel="stylesheet" href="main.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
<!-- <link rel="stylesheet" href="styles/debug.css"> -->
</head>
<body>
<!-- .hero -->
<section class="hero is-fullheight has-background-black">
<div class="hero-body">
<div class="container">
<figure class="image center">
<img src="images/bulma-logo-white.png" style="max-width: 512px;">
</figure>
</div>
</div>
</section>
<!-- /.hero -->
</body>
</html>
/* Centrage horizontale du logo */
.center {
display: flex;
justify-content: center;
align-items: center;
}
<!-- .section -->
<section class="section">
<div class="container">
<div class="columns">
<div class="column">
Bulma is a modern CSS framework from @jgthms, based on Flexbox.
Using Bulma, we can describe our website's design using just classes. ᕕ( ᐛ )ᕗ
</div>
<div class="column">
Flexbox is a CSS spec that makes sectioning and aligning more natural.
We don't need to know Flexbox but it's how Bulma works behind-the-scenes. ⦤(^ー^)⦥
</div>
<div class="column">
Instead of writing our CSS per-element, we can use predefined classes.
With enough classes, we can describe our website design using semantics. ٩(^ᴗ^)۶
</div>
</div>
</div>
</section>
<!-- /.section -->
<!-- .hero -->
<section class="hero has-background-black">
<div class="hero-body">
<div class="container">
<figure class="image center">
<img src="images/bulma-logo-white.png">
</figure>
</div>
</div>
</section>
<!-- /.hero -->
.center {
display: flex;
justify-content: center;
align-items: center;
}
.hero img {
max-width: 256px;
}
<!-- .section -->
<section class="section has-background-light">
<div class="container">
<div class="columns">
<div class="column">
<div class="notification is-info">
<h1 class="title is-size-4">Bulma?</h1>
<p class="is-size-5">
Bulma is a modern CSS framework from @jgthms, based on Flexbox.
Using Bulma, we can describe our website's design using just classes. ᕕ( ᐛ )ᕗ
</p>
</div>
</div>
<div class="column">
<div class="notification is-primary">
<h1 class="title is-size-4">…Flexbox?</h1>
<p class="is-size-5">
Flexbox is a CSS spec that makes sectioning and aligning more natural.
We don't need to know Flexbox but it's how Bulma works behind-the-scenes. ⦤(^ー^)⦥
</p>
</div>
</div>
<div class="column">
<div class="notification is-warning">
<h1 class="title is-size-4">…Classes?</h1>
<p class="is-size-5">
Instead of writing our CSS per-element, we can use predefined classes.
With enough classes, we can describe our website design using semantics. ٩(^ᴗ^)۶
</p>
</div>
</div>
</div>
</div>
</section>
<!-- /.section -->
<!-- .hero -->
<section class="hero">
<div class="hero-body">
<div class="container">
<figure class="image center">
<img src="images/bulma-logo.png">
</figure>
</div>
</div>
</section>
<!-- /.hero -->
.hero img {
max-width: 160px;
}
.emoticon {
white-space: pre;
}
<!-- .section -->
<section class="section">
<div class="container">
<div class="columns is-multiline">
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon">
<i class="fas fa-lg fa-columns has-text-warning"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Columns</h1>
<p class="subtitle is-size-5">
The power of <strong>Flexbox</strong> in a simple interface
</p>
</div>
</div>
</article>
</div>
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon has-text-info">
<i class="fab fa-lg fa-wpforms"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Form</h1>
<p class="subtitle is-size-5">
The indispensable <strong>form controls</strong>, designed for maximum clarity
</p>
</div>
</div>
</article>
</div>
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon has-text-danger">
<i class="fas fa-lg fa-cubes"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Components</h1>
<p class="subtitle is-size-5">
Advanced multi-part components with lots of possibilities
</p>
</div>
</div>
</article>
</div>
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon has-text-grey">
<i class="fas fa-lg fa-cogs"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Modifiers</h1>
<p class="subtitle is-size-5">
An <strong>easy-to-read</strong> naming system designed for humans
</p>
</div>
</div>
</article>
</div>
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon has-text-primary">
<i class="fas fa-lg fa-warehouse"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Layout</h1>
<p class="subtitle is-size-5">
Design the <strong>structure</strong> of your webpage with these CSS classes
</p>
</div>
</div>
</article>
</div>
<div class="column is-one-third">
<article class="media notification has-background-white">
<figure class="media-left">
<span class="icon has-text-danger">
<i class="fas fa-lg fa-cube"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Elements</h1>
<p class="subtitle is-size-5">
Essential interface elements that only require a <strong>single CSS class</strong>
</p>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
<!-- /.section -->
<!-- .section -->
<section class="section has-background-light">
<div class="container">
<div class="columns">
<div class="column">
<article class="media notification is-info">
<figure class="media-left">
<span class="icon is-medium">
<i class="fab fa-2x fa-css3-alt"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">Bulma?</h1>
<p class="is-size-5">
Bulma is a modern CSS framework from @jgthms, based on Flexbox.
Using Bulma, we can describe our website's design using just classes. <span class="emoticon">ᕕ( ᐛ )ᕗ</span>
</p>
</div>
</div>
</article>
</div>
<div class="column">
<article class="media notification is-primary">
<figure class="media-left">
<span class="icon is-medium">
<i class="fas fa-2x fa-align-justify"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">…Flexbox?</h1>
<p class="is-size-5">
Flexbox is a CSS spec that makes sectioning and aligning more natural.
We don't need to know Flexbox but it's how Bulma works behind-the-scenes. <span class="emoticon">⦤(^ー^)⦥</span>
</p>
</div>
</div>
</article>
</div>
<div class="column">
<article class="media notification is-warning">
<figure class="media-left">
<span class="icon is-medium">
<i class="fas fa-2x fa-shield-alt"></i>
</span>
</figure>
<div class="media-content">
<div class="content">
<h1 class="title is-size-4">…Classes?</h1>
<p class="is-size-5">
Instead of writing our CSS per-element, we can use predefined classes.
With enough classes, we can describe our website design using semantics. <span class="emoticon">٩(^ᴗ^)۶</span>
</p>
</div>
</div>
</article>
</div>
</div>
</div>
</section>
<!-- /.section -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.min.css">
<link rel="stylesheet" href="main.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
<!-- <link rel="stylesheet" href="styles/debug.css"> -->
</head>
<body>
<!-- .section -->
<section class="section is-paddingless-horizontal">
<div class="container grid">
<nav class="breadcrumb grid-xl" aria-label="breadcrumbs">
<ul>
<li><a href="#">Home</a></li>
<li class="is-active"><a href="#" aria-current="page">How to build a beautiful blog</a></li>
</ul>
</nav>
</div>
</section>
<!-- /.section -->
</body>
</html>
.is-paddingless-horizontal {
padding-left: 0; padding-right: 0;
}
.grid {
display: grid;
grid-template-columns:
[xl-start] 1fr 1.5rem [md-start] minmax(0, 624px) [md-end] 1.5rem 1fr [xl-end];
}
.grid * {
grid-column: md;
}
.grid-xl {
grid-column: xl;
}
Astuce : sur Windows 10, taper node dans le champ de recherches.
C:\Users\Utilisateur\Desktop\mes-sites> mkdir mon-site
C:\Users\Utilisateur\Desktop\mes-sites> cd mon-site
C:\Users\Utilisateur\Desktop\mes-sites\mon-site> npm init
Le fichier package.json permet de décrire le projet, gérer les mises à jour de ses dépendances ainsi que sa portabilité.
...\mon-site> npm install bulma --save
...\mon-site> npm install gulp@3.9.1 --save --save-exact
Pour compiler nos fichiers SASS et produire du CSS nous allons utiliser Gulp et son task runner (automatiseur de tâches) :
...\mon-site> npm install gulp-sass browser-sync --save-dev
// import des packages
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
// tâche : sass ; src : source ; dest : destination ;
gulp.task('sass', function() {
return gulp.src('./sass/main.sass')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream())
})
// tâche : serve ; demarre le serveur
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "./"
});
/* serveille les modifications sur main.sass et
les fichiers html et rafraîchit le navigateur */
gulp.watch("./sass/main.sass", ['sass']);
gulp.watch("./*.html").on('change', browserSync.reload);
});
gulp.task('default', ['serve']);
@import "node_modules/bulma/sass/utilities/initial-variables"
// Customisation
$primary: $red
@import "node_modules/bulma/bulma"
html
background: $primary
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link media="all" type="text/css" rel="stylesheet" href="/css/main.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">
Hello Le Monde
</h1>
<p class="subtitle">
Mon premier site avec <strong>Bulma</strong> !
</p>
</div>
</section>
</body>
</html>
...\mon-site> gulp
.../mon-site/mon-site
$ git init
.../mon-site/mon-site (master)
$ git add .
.../mon-site/mon-site (master)
$ git commit -m "Bulma avec gulp-sass et Browsersync"
.../mon-site/mon-site (master)
$ git remote add origin https://github.com/hugostatic/bulma-tuto.git
.../mon-site/mon-site (master)
$ git push -u origin master
By snt