Book Image

Learning Bootstrap 4 by Building Projects

Book Image

Learning Bootstrap 4 by Building Projects

Overview of this book

Bootstrap, the world’s most popular frontend framework, is an open source toolkit for building web applications with HTML, CSS, and JavaScript. Learning Bootstrap 4 by Building Projects covers the essentials of Bootstrap 4 along with best practices. The book begins by introducing you to the latest features of Bootstrap 4. You will learn different elements and components of Bootstrap, such as the strict grid system, Sass, which replaced Less, flexbox, Font Awesome, and cards. As you make your way through the chapters, you will use a template that will help you to build different kinds of real-world websites, such as a social media website, a company landing page, a media hosting website, and a profile page, with ease. By the end of this book, you will have built websites that are visually appealing, responsive, and robust.
Table of Contents (9 chapters)
Free Chapter
1
Introduction

Adding styles to the navigation and landing page

Let's jump into our Sass file now to fix it. The first thing that we are going to do is add in a few variables. Here they are:

$primary:#26a5d3;
$dark:#333;
$light:#f4f4f4;

Next, we are going to put in our code for the HTML and body:

html{
width:100%;
height:100%;
}

body{
width:100%;
height:100%;
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
color:$dark;
background-color:$light;
overflow-x: hidden;
}

As you can see, in the body, the variables we created are getting used. There is nothing very complex going on here. We are going to see a lot of styling code now, but I will explain some of the more involved ones.

The Sass code for our typography is as follows:

h1, h2, h3, h4, h5, h6{
margin: 0 0 2rem;
text-transform:uppercase;
font-family: "Montserrat","Helvetica Neue",Helvetica,Arial...