
I dedicatethis book to my motherVatsala Shenoy; she indeed is my rock. She stood by me all my life without any expectations and completely accepted me the way I am (despite me being a misfit ☺). Without her, I would have never written a book in the first place. The immense support and unconditional love from my mother is very much a part of my success. I don’t want to say anything more, as it will spoil what I want to convey
This is the 5th book I’ve written for Apress and 11th overall. I would like to thank Apress and its editorial team including Nancy, Louise, and Jim for collaborating and effectively helping me. I would also like to thank my reviewer, Alexander Chinedu Nnakwue, who provided me great insights while writing this book. I wish all of you well in this walk of life.

An engineering graduate from the Manipal Institute of Technology and author of several books, he is a keen learner and believes there is always a steep learning curve in this walk of life. In summary, he quips: “The most important thing is to be happy. After all, we’re here for a good time, not a long time. Maybe… Definitely maybe.” ☺

has a background in Mechanical Engineering from the University of Ibadan, Nigeria and has been a front-end developer for more than 3 years, working on both web and mobile technologies. He also has experience as a technical author, writer, and reviewer. He enjoys programming for the Web, and occasionally you can also find him playing soccer. He was born in Benin City and is currently based in Lagos, Nigeria.
Bulma (https://bulma.io/) is an open source web design framework that is used to create immersive web sites. Bulma is a powerful CSS framework for designing scalable front-end code quickly and effectively. Adhering to a mobile-first paradigm, it comes with built-in CSS components for creating responsive web sites. The beauty of Bulma is that it abstracts the pain of scratch-coding by providing you with the tools and utilities to create interactive web sites in a hassle-free, time-saving way.
Prior to moving ahead, we need to understand the usability of CSS frameworks in web design. Aspects like cross-browser computability, consistency, and the speed of developing web apps/sites add to the arduous task of constructing an efficient layout and a feature-rich web site. Beginners need to remember that all CSS frameworks come with predesigned sets of reusable code and modules that not only speed up development time but also take the guesswork out of complex styling. This also results in clean coding and ensures that your web sites scale properly over devices of any make or screen/device size.
This book is aimed at introducing you to the basic properties of Bulma in an easy-to-comprehend manner. Bulma’s baked-in new grid system, layout, content modules, typography, helper classes, media, and forms help design robust user interfaces without the bulk or clutter associated with heavyweight frameworks. Moreover, adhering to a mobile-first philosophy, it eliminates the pain and bottlenecks of developing intuitive web sites for smartphones, tablets, and compact platforms.
In the next section, we will explore the differences between mobile-first and responsive design that will help budding web designers understand the basic concepts coherently.
Mobile-first design involves building a web site/app for the mobile platform. Once the site has been designed, it is tweaked for the bigger screens/bigger devices like tablets, desktops, or large display screens. It is all about creating an immersive user experience on smartphones and other small-screen mobile devices (akin to the progressive enhancement ideology). If the majority of your users are mobile users, then this approach will be optimal. It is tailored to fill all the gaps specifically for mobile devices, but may lack in certain aspects when it comes to traditional desktop site versions.
In contrast, responsive web design is inclined toward traditional desktops and then tweaked for smaller screens/devices. It is tailored for creating an immersive user experience on normal-sized desktops and large display screens (akin to the graceful degradation ideology). If your target audience is desktop users, then this approach will be optimal; however, it lacks certain aspects when it comes to mobile phones or small screen compact devices.
Starting July 2019, according to reports (https://developers.google.com/search/mobile-sites/mobile-first-indexing), Google has focused on the default indexing of mobile sites rather than the traditional desktop web site version. Google stated that mobile-first indexing is the preferable method, as most users tend to view and publish information on mobile-platforms.
Google has stressed the fact that the information on the mobile and desktop versions of the web sites should be the same, inclusive of the titles, structured data, and metadescription. Older web sites will be indexed until the mobile web pages are designed.
Studies (www.statista.com/topics/779/mobile-internet/) have suggested that mobile data traffic is going to grow manifold, at least seven-fold by 2022. With four billion unique mobile users by April 2019, and 48% of web pages worldwide accessed through the smartphone platform, mobile-first is the way to go.
Both mobile-first and responsive web design preference depend on the current technological advances and target audience. For example, a recent study (https://darwindigital.com/mobile-first-versus-responsive-web-design/) concluded that B2B companies still showed interest in responsive design, with most users checking out the products/services/solutions on the desktop web site version.
Now, let’s get started with Bulma and become acquainted with the inner workings of this easy-to-understand web design framework in the next section.
Bulma, being mobile-first, is tailor-made for mobile devices, but with a few tweaks it can be optimized for traditional desktops too. Keep in mind that it was created keeping mobile platforms as the crux, therefore the web sites you design using Bulma are in line with Google’s current and future trends. It definitely is SEO-friendly and future-proof as Google leans toward mobile web sites for indexing purposes compared to conventional desktop versions.
To access the Bulma official web site, use the following:

Bulma mobile site

Bulma desktop site
From the preceding screenshots, you can see that the content of the desktop site and mobile site are the same but are displayed differently owing to the larger desktop and smaller mobile screens.
However, remember that Bulma is mobile-first in nature, meaning it is tailored for mobile platforms and can then be optimized for tablets and large desktops with minimum tweaks.
Now that we have a brief idea about the responsiveness of this mobile-inclined framework, we will move forward to the installation process in the next section.
There are three specific ways of installing Bulma, and you can choose any one of them as per your business and design requirements.

Download button for installing Bulma zip file

File structure of the downloaded and unzipped Bulma framework (latest version 0.7.5)
You can include the link to this file in your HTML page to use it at the basic level.
More servers and easy maintenance
More bandwidth
High performance
Redundancy for fail-safe protection
Optimized caching settings
Parallelized downloads
The entire process of installing Node.js on Windows is explained in the following link:
For Android and Linux distributions, you can take a look at the following link:
Note∗- Icons in Bulma can be included by using the Font Awesome 5 link:
In this chapter, we saw an overview of the easy-to-use Bulma framework. We looked at the differences between mobile-first and responsive web design, and how things are going to shape up in the present and the near future. Moving forward, we looked at the different methods of installing Bulma in your web projects. The next chapter will explain the grid system and utility classes that will enable you to get to grips with this powerful web design toolkit.
Bulma is an intuitive framework adhering to the mobile-first approach. In this well-connected era, people prefer mobile web sites compared with traditional desktop web sites and other media. Moreover, a mobile-first paradigm accounts for better semantics, simplified code structure, and a superlative user experience.
Bulma is genetically tailored for the mobile platform. It includes simple modules and components; using them, your web site can be tweaked for desktop and widescreen display too. Bulma follows a minimalistic approach, as the focus is completely on interactive web site design and rapid development
In this chapter, we will learn about grids and utility classes in Bulma including columns, offsets, gaps, and helper classes that render ultimate flexibility and simplicity for creating immersive web sites.
Note: In this book, we will be using Notepad++ as the default editor for all the code examples. Sample content from www.catipsum.com is used for the code examples in the book.
The best way to learn web design is to start coding and learning it practically instead of wandering through loads of theory—so let’s start working with Bulma immediately.
Like all CSS frameworks, Bulma has the basic prototype with the CDN and supported icon links that will be a part of all the code examples in this book.
In Listing 2-1, you can see the various links and styles in the <head> section. In the <head> section, the charset meta tag is used to define an HTML document’s character set. The viewport meta tag helps web designers control the viewport (viewport is the portion of the web page visible to the users). While the width=device-width attribute sets the width of the page as per the device screen, initial-scale=1.0 instructs the device to display the page without any zooming.
Finally, after placing all the required links in the <head> tag, we proceed with the <body> tags where we write the code and markup for the output. This basic starter template will be used for all the examples in the book. In the next section, we will learn about the Flexbox-powered grid layouts.
A grid layout helps achieve good readability, higher flexibility, and page cohesiveness. Bulma is a mobile-first framework, where you create a mobile web site and then tweak it for the desktop interface.
The 12-column grid layout in Bulma is easy to understand. By default, all the columns in Bulma will be stacked on top of each other, owing to its mobile-first paradigm. Thereon, by adding different classes and attributes, columns are defined in a default 12-column grid structure.
In Bulma, columns are defined as per their size and varying classes to create the grid. Bulma’s Flexbox-powered grid depicts excellent adaptability with the mobile platform. Even customizing it for tablet, desktop, and widescreen size-screens is quite simple; Bulma is purely CSS-based and, with minimal use of JavaScript, you can build responsive, interactive sites quickly and easily.
As seen in the preceding code, we define a container with the columns class. Inside it, we define four columns using the column class. Each column has the cat ipsum sample text. (In further code examples, the entire sample content from cat ipsum will not be shown; it will just be denoted by “cat ipsum dolor sit eos...”)
With each column, we also define the background color using the inline style CSS code.

Columns on a mobile site

Output on a desktop site
As you can see, the columns are responsive because they adapt well to the desktop size screen as well. You will also observe that if the width is not specified, all the columns automatically have equal width.
Although the columns have equal width in a 12-column grid layout, the settings are not in stone. You can change the width by assigning custom values to the column size.
You can allocate a specific size to each column. There are several ways of doing it in Bulma. One way is using fractions in conjunction with the column class. The other way is using numbers to define the column size for a default 12-column grid.
You can use fractions to denote the required size. Let’s look the following classes:
is-three-quarters
is-two-thirds
is-half
is-one-third
is-one-quarter
is-full
is-four-fifths
is-three-fifths
is-two-fifths
is-one-fifth
The is-three-quarters class will span 3/4th space of the default 12-column grid.
The is-one-quarter class will span 1/4th space of the default 12-column grid.
The is-full class will span the full width of the default 12-column grid .
Though some of you are familiar with basic CSS and HTML, the following link is included for learning basic CSS easily:
The preceding link will get you acquainted with intermediate-grade CSS and is also a good reference.
The one-fifth size spans 1/5th length of a 12-column grid and the three-fifth size spans 3/5th length of a 12-column grid. Since the third column size is not specified, it will automatically occupy the remaining space. The output of the code on a mobile phone, and then on a traditional desktop interface, are shown in the following screenshots.

Output on a mobile site

Output on a desktop site
is-1
is-2
is-3
is-4
is-5
is-6
is-7
is-8
is-9
is-10
is-11
is-12
As per the preceding code, the column element with the is-2 class will occupy the space of 2 columns, whereas the column element with the is-7 will occupy the space of 7 columns. The element with the column class, which has not been allocated a specific size, will occupy the remaining space.

Output on a mobile site

Output on a desktop site
In Bulma, by default, the number of columns defined within the columns container are placed in a single row. If you want to define the next row, you usually use another columns container and define columns for that container.

Multiline columns
The column is-2 and column is-10 classes for the first two elements enable it to occupy the first row. In the next row, you can see the remaining two elements with the column is-9 and column is-3 class.

Gapless columns
On comparing Figure 2-10 with Figure 2-9 (both have the same content and code except for the implemented gapless class in the latter screenshot), there is no gap between the columns in Figure 2-10.
As you see in Listing 2-9, we use the columns container. Then, we define a main element with the column class inside the main container and give a background Gainsboro color to the element. Next, we define a second container inside the preceding column using the columns container class, and we also assign an is-mobile class so that it shows the nested output design even on the mobile screen interface.
Next, we define two columns within the secondary container and assign the Wheat and Gold colors to them.

Nested columns

Nested gapless columns
The preceding code defines a main container using the columns container class. Next, we define an element inside that container using the column class. To the same element, we add the is-half class so that it spans half the length of the 12-column sized grid in the same row. We append an is-offset-one-quarter class to it so that it is offset by 1/4 of the default 12-column size grid, meaning the element is pushed to the right by an equivalent space of three columns.
(We can create another container below the main container and define colored buttons; we will get to that part later on.)

Offset
In the preceding screenshot, you can see that the element is offset by a quarter of the space assigned to a 12-column grid size.

Push and pull buttons
Now that we took a look at the grids layout and the varied alternatives to define columns, we will move to Bulma’s helper classes/utility classes in the next section.
Utility classes are handy helpers that impact the styling of elements in the markup without using CSS style sheets. Since they are directly used in the markup, they speed up the work substantially. They are reusable and provide a high level of consistency in the code.
In this section, we will be discussing the color modifiers, responsive helpers, alignment helpers, and typography helpers baked into the Bulma framework.
Built-in color modifiers help render a certain color to the elements in Bulma.
In the preceding code, we define four progress bars in this example; we create four <progress> elements and assign the progress class to each of them. Then we define the length parameters of the progress bars and the respective percentages w.r.t. of these progress bars. Under each progress bar, we add a button.
With each progress element we use a color helper class, namely is-danger class for the first progress bar as well as the button below it. Next, we assign the is-warning class to the second progress bar and the button below it.
Moving forward, we add different colors to the remaining <progress> elements and define colors and attributes to the buttons below it. (We have assigned a size class and the outlined shape as well as different status for the buttons, but we will learn about it further on in the book when we get to the buttons section.)

Color helpers
This section deals with alignment, responsive, and typography utility elements. Initially, we will take a look at the alignment helper, followed by a code example for responsive helpers, and finally deal with the typography helpers,
In Listing 2-12 we assign the is-vcentered class to the columns container.
Then we create two column elements inside it and assign a different color to each of them.

Vertical column alignment
Next, we discuss the responsive helpers.
You can show/hide content depending on different-sized screens, namely, mobile phone, tablet, desktop, and widescreen.
In Listing 2-13 we use the is-hidden-mobile class for the first element, meaning the content will be shown in all devices apart from mobile screens. Then we insert an image within the first <div> element, using the image <img> tag.

Content responsively displayed on the mobile, tablet, and desktop screens
In Listing 2-14, we use a <section> element as the container. Following this, we create a heading <h1> element and assign the title class to it.
Then, we define the size and position of the element. Initially we assign the is-size-5-mobile and has-text-centered-mobile classes to the <h1> element. This means that the element will be of size 5 and the text will be centered on a mobile phone screen.
Next, we assign the is-size-3-tablet and has-text-right-tablet-only classes to the same <h1> element; this defines size 3 for the text on a tablet and the alignment of the text to the right side of the screen on a tablet screen only.
Moving forward, we assign the is-size-1-desktop and has-text-left-desktop classes to the same <h1> element. This effectively assigns size 1 to the text and aligns the text to the left on a desktop screen.
Class | Font-Size |
|---|---|
is-size-1 | 3rem |
is-size-2 | 2.5rem |
is-size-3 | 2rem |
is-size-4 | 1.5rem |
is-size-5 | 1.25rem |
is-size-6 | 1rem |
is-size-7 | 0.75rem |
Thereon, for the same <h1> element, the is-uppercase is applied, thereby rendering the text in uppercase text. Then, we finally apply the has-text-success class to the same element for it to display the respective green color.
Now that we have applied all these classes to the <h1> element, we will move on to create a paragraph <p> element. We apply the subtitle class followed by the is-italic class, which will apply the typography style and display the text in italics. Later on, we use the has-text-weight-light class to it for defining the font-weight. Finally, we use the is-capitalized and has-text-link classes, due to which the text is shown in capitalized case with the blue link color.

Content displayed on a mobile screen
From Figure 2-18, you can see that the Hello World! text is in uppercase and centered on the mobile screen. The size (size-5) and color are also displayed as defined in the code.

Content displayed on a tablet screen

Content displayed on a desktop screen
Finally, you can also the text Bulma---> Awesome, Rockin' & Intuitive text in capitalized case with italics styling on all three screens as per the defined markup.
In this chapter, we looked at various grid features, including columns, offsets, gaps, and other different ways of styling columns. We also looked at the utility helpers and modifiers that are quite handy in web design and also speed up your website significantly. In the next chapter, we will look at in-depth content and code for the Layout CSS helpers in Bulma, such as tiles, box elements, media objects, and cards, to mention a few. So, stay tuned for more.
In modern layouts, texts are not placed in an ad-hoc way compared to the archaic ways used in old, legacy web sites. Containers are an awesome control for placing and grouping text, images, graphics, headings, buttons, and glyphicons in a single group.
It is quite handy, as you can resize, move, adjust, modify, or place the entire container group instead of moving each individual element inside it. Containers, levels, media objects, banners, tiles, cards, boxes, and panels are the various containers in Bulma that help enclose different types of content within it.
In this chapter, we will look at these Bulma containers, which are quite useful in modern layouts in this digital era. Let’s get started right away.
In Bulma, the container control centers the content horizontally. In addition, Bulma’s container element is responsive and brings out a certain consistency across different devices, specifically tailored for mobile platforms.
In Listing 3-1, we define the columns grid, which is centered. We use the is-full class for the columns so that it occupies all 12 columns of the grid. We assign a border and wheat color to it.
Then we create an independent container element using the container class. We assign a border and wheat color to it just like we did for the columns container.

Grid column full width vs. normal container
As you can see in Figure 3-1, the output varies. The initial output container is the 12-grid columns container, while the container below is designed with the container class. You can see the space and padding around the content, which results in a different output compared with the 12-column full-width grid layout.

Grid column full width vs. full HD container
The full HD container is wider; therefore, the content is stretched to the right and left occupying more space due to the is-fullhd class.

Normal container control vs. full HD container
In Figure 3-3, you can see the normal container element followed by that of the full HD container element. You can now clearly see the difference between the normal and full HD container, as the content occupies more space to the right and left of the viewport for the full HD element (remember that the content is the same for both these containers).
Bulma also has a levels container, which can be used for most of the web site’s elements. The difference between levels and container control is that the elements within the levels control are centered vertically by default.
In Listing 3-4, we used the container element for an element. Inside the column of the container, we created a <nav> tag to which we assigned the level class. Moving forward, we create a <div> element to which we assign the level-left class. This will align the element to the left of the container. We create four paragraph <p> elements with the level-item class. We include links within each <p> tag and design button for each link using the button class. We use different contextual colors for each of the four buttons: primary, link, info, and success.
Next, we create another <div> element and assign a level-item class to it and include the has-text-centered class. This will align the content in the center of the levels container. We also include an image inside this <div> element, which is also centered.
Further, we create the third <div> element and assign the level-right class to it. Then we define a level-item class for a <div> element inside the third <div>element. We create a search box. Initially, for creating the search box we define a <div> and assign the field class to it. Then we create a paragraph element <p> and assign the control class to it. We then use the input class with the type as text and include a placeholder. Next, we create the Search button. For this we add the has-addons class to the field class, using which we had created the search box. Now we create a button element below the <p> tag and assign the same control class to it. Then we name the button as Search.

Levels container
As you can see, the level-left class has pulled the content to the left, whereas the level-right class has pushed the content to the right of the levels container.
Social media web sites usually have text next to several graphical formats such as images, icons, infographics, or videos. Media objects help you in designing this structure, wherein data or information is placed alongside graphical content in a hassle-free, uncomplicated manner. This UI component is quite handy in repetitive design like blog posts, comments, tweets, etc.

Main media object with the image and the content
In Listing 3-6, we nest a text area akin to the one seen in a form. This text area will be nested inside the main <article> tag used at the first line of code in Listing 3-5. For designing the text area, again we use an <article> tag (think child article), and assign the media class to it. Since there is no image in the text area code, we directly use a <div> element and assign the media-content class to it. Then we create a paragraph element and assign the control class to it. We define a text area element with the textarea class. Below the textarea element, we define another <div> and assign the field class to it. Next we define a paragraph tag and assign the same control class to it as the one used in the text area code. Then we create a button using the button element and assign the is-success contextual color to it (the color is similar to spring green and is a built-in contextual color.

Text area below the main media object
In Listing 3-7, we define a nested <article> element. We assign the media class to it. Then we use a <figure> tag to which we assign the media-left class. Next we insert an image using the <img> tag. Then we define a <div> to which we assign the media-content class. Next, we define a <div> element within the preceding <div> element and assign the content class to it. The code is same as the one when we created the first media object except that this is a nested article tag and the sample image and content are different.

Nested media object under the text area

Entire media object code output
The Hero banner is a UI component in Bulma used to highlight the site’s most essential content. Hero banners draw user attention, making it useful from a saleable aspect in modern web site layouts, akin to traditional banners and posters in traditional advertising.
In line with the “pictures speak louder than words” viewpoint, Hero banners help in products/solutions promotion on web sites. Bulma’s Hero banners help add images and aesthetical content, well suited for those web layouts where there is usually minimal data, prevalent in single page design.
In Listing 3-9, we have used a section tag and assigned a hero class to it. The <div> within the <section> tag has been assigned the hero-body class. We create another <div> with the container class and then define the title and subtitle for the Hero banner.

Basic Hero banner

Success contextual color for the Hero banner

Hero banner with the success color gradient and fullheight size
In a full-height Hero banner, we can define the navigation in the top section by using the hero-head class. Then we can define the banner body by using the hero-body class. Finally, we can design the footer of the Hero banner using the hero-foot class.
In Listing 3-12, we have defined the code for the Hero head and Hero body sections. Initially, we use the code for creating a full-height banner. We assign the hero, is-bold, is-primary, and is-fullheight classes to the <section> tag. The banner therefore is a full-height hero banner with a gradient color shade of the primary contextual color.
Then we define the enclosed <div> with the hero-head class. Within this we include another <div> element and assign the container class to it, to create a container-based padded layout. Then we use a <nav> navigation element and assign the breadcrumb class to create a navigation breadcrumb. We further use the is-centered class to the <nav> element so that the breadcrumb is positioned at the center in the hero-head section.
Moving forward, we create an unordered list using the <ul> tag and the <li> tags within the <ul> tags. Once we have defined the name of the navigation options, we move on to the body section of the banner.
In the banner body section, we create a separate <div> element and assign the hero-body class to it. We define a container for the body section using the container class for the enclosed <div> element. We define the headings using the title and subtitle classes. Once we code the names of the headings, we move on to executing this part of the code.

Hero banner head and body sections
As you can see from the preceding code, we first create a separate <div> element, to which we assign the hero-foot class. Then we enclose a <nav> tag inside it and add the tabs class to create a navigation element at the bottom in the footer. We design the box for the footer and give it complete width using the is-boxed and is-fullwidth classes. Next, we create a container control using the container class. Inside the container, we create an unordered list and include the various list items using the <ul> and <li> tags. To those items, we assign the link using the <a> tag for each list item. We then assign a white border to those list items. You will observe that we used the socicon classes for each social media icon in the <li> tags.
For this, we have used the icons from the free Socicon web site at the following web address:
For this example, we have used the Socicon CDN link on AWS servers in the <head> section of the Hero banner code along with the CDN link for Bulma CSS. Without adding the CDN link for Socicon, the code will not work; so make sure you include it in the <head> section.

Full-height hero banner breadcrumb navigation & footer
As you can see, we have a full-height Hero banner with a breadcrumb navigation and a footer with several social media icons and other buttons like Share and Mail, to name a few.
Cards are UI controls that help incorporate relevant information such as titles, user names, images, icons, and call-to-action buttons uniformly in a card format. All this data is shown with visuals on an equal pane. The flexibility and modular approach is prevalent across different sites like news postings, Tinder interfaces, and pictures seen under the Images tab in Google search, to name a few.
The card format delivers substantial information in a compact way with proper whitespace usage. It can also be used to group similar information in a consistent format across all viewpoints, ranging from desktops to mobile phones. For example, on an e-commerce site, information related to a specific genre of products is displayed in different rectangular cards along with their respective images with the same call-to-action functionality.
UI/UX designers promote the use of card-like design for its interactive and user-satisfying capabilities, as they can make effective use of the whitespace and deliver information in a compact form without clutter or noise. Moreover, cards demonstrate excellent responsiveness across all device or screen sizes, thereby bringing ultimate consistency and flexibility to your web site designing projects. Bulma also has an ingrained tile component, which is a card-like, metro-style container—a design previously observed in legacy Windows phones (think circa 2008–2010). Known as flat-and-modular design, it provides a high degree of readability of text and visuals, apart from ensuring a satisfying and interactive user experience across all breakpoints.
Let’s explore cards and tiles using simple examples. Initially we will see an example of cards before proceeding to tiles.
In Listing 3-14, we define a main <div> and use the card class with it. Then, we create another <div> element and assign the card-image class to it. Then, using the <figure> element, we insert an image source in the <img> tag.

Image for the card on a mobile screen

Card with the content and image
In Listing 3-16, we create three <footer> elements. For each <footer> tag, we use the card-footer class.
In the first <footer> element, we create three links and assign the card-footer-item classes to them. We then jot down the booking timings as 5:00 p.m., 7:00 p.m., and 9:00 p.m.
In the second <footer> element, we create three links and assign the card-footer-item class to three items. However, we define the Font Awesome icons for Mail, Share, and Comments. We also increase the size of the icons by using the icon is-large and the exponential fa-2x classes for them.
In the third <footer> element , we create three links and assign the card-footer-item class to each of them. We then use the Socicon links for the five social media sites (Facebook, Twitter, Snapchat, Pinterest, and LinkedIn).

Card with the content, image, and footer
In Figure 3-16, we can see the entire card we have created for Shrek Café.
In Listing 3-17, we initially create the main <div> element and assign it the tile is-ancestor class. Then we create the first child <div> element and assign it the tile is-parent and is-8 classes to define it as a parent element and the 8-column size it occupies. Within this parent, we have created three <div> elements. We assign a title and sample text for each of them. But the only difference in the three <div> child elements of the parent is the size allocated to each of them. The first child is four columns long due to the is-4 class. The second <div> child element is five columns long due to the is-5 class. The third <div>, whose size is not defined, takes up the remaining space automatically. We also assign a box class to each child in conjunction with the size and child class to create a box container.
Then we create a separate <div> for the second parent of the ancestor tile. We assign the tile is-child and box classes to the child inside the second parent. We also define the title and sample content for this child.

Basic tile structure
As you can see, the first parent occupies eight columns space and contains three child elements. The second parent has taken the remaining space of four columns automatically, as the size is not defined.
In Listing 3-18, we create one ancestor containing two parents. The first parent <div> is assigned a space of nine columns. We use the notification class to give it a bland contextual color. We also allocate the is-vertical class to this element. This will ensure that the child elements of the first parent tile will be stacked vertically. We create three child elements using the is-child class for each child <div> element.
For the first child element, we assign a tile of 12 columns of the parent size by using the tile is-12 class, and we also use the notification is-danger class to define the contextual color. Finally, we use the box class to create a box container for the first child. Thereon, we define the title and sample content for that child.
Similarly, we create two more child <div> elements. We assign the size of 12 columns for this child tile and define the is-primary and is-info classes to define its contextual colors. We also define a box container for their content using the box class, including the title and headings.
Following this, we create the second parent of the ancestor and define the contextual success color to the parent. Then we create a child for this parent and assign the contextual warning color to it. Moving forward, we define the title and sample content for this child.

Child tiles stacked vertically for first parent, and second parent-child defined normally
As you can see, the first parent containing Column I Uno, Column I Dos, and Column I Tres child tiles are stacked vertically and occupy 12 columns horizontally. The second parent is a normal one with a single child. All parent columns and child columns show the size as defined in the code.
In Listing 3-19, we create a main <div> with the tile is-ancestor class. Then we create the first parent element and give it a size of eight columns with the is-vertical class so that its child elements are stacked. We give it a danger contextual notification color.
Then we create a 12-column child element under the first parent element and assign the primary contextual color to it. We create another 12-column element child element under the first parent. Under the second child element, we create a parent element and create a nested tile that is six columns wide, and a second child element that will occupy the remaining space with the info primary color.
Now we have designed the first parent tile and its child tiles, followed by a nested parent inside the second child element, which in turn contains two child tiles.
So, at the start of the code we used the ancestor tile. Under the ancestor child tile, we create the second parent tile and use the notification color for the second parent and assign the success contextual notification color to it. Then we define the title, subtitle, and sample content inside it.

Parent child, child tile, and nested child tiles
Callout panels are containers with padding that create an inset box effect and highlight the content that separates it from the other usual content on a traditional web page. Apart from panels, Bulma also has a simple box element. Whereas boxes are used for normal content, panels are used for multiple elements like information sets and data tables, and may occasionally include forms. From a web design perspective, panels and boxes do not incorporate media and graphic content like cards or tiles do.
An important use of callout panels, in modern layouts especially, is to make the call-to-action elements stand out among the different content blocks. By singling out important information by adding more emphasis to a section or content, panels help get effective responses from the users.
In Listing 3-20, we create the panel heading. Initially, we create a main <div> element and assign the is-multiline class to it in conjunction with the columns class. The entire code for the panels will be contained in the main <div> element.
Then, we define the column and assign a five-column width to it. Then we create the <nav> navigation element and assign the panel class to it. We move ahead to create a paragraph <p> element and assign the panel-heading class to it. We assign the Brands name as the panel heading. Then we create the panel tabs by using the panel-tabs class. Then we assign the names (All, New, and Refurbished) for the panel tabs. We add an is-active to the first panel tab, All.
Once the panel tabs are created, we create the list items using the <a> link tabs. For each link, we assign the panel-block class. We use the is-active class only for the first link, so that it shows that link chosen by default. Then we name different brand names of mobiles such as Samsung, Nokia, and Honor, to name a few.

Panel with mobile phone brands
In Listing 3-21, we use the <nav> tag and assign the panel class to it. We define the panel-heading as Price, followed by the links containing the price rate range.

Second price range panel next to the first panel
In the preceding code, we use a navigation <nav> element and then define the panel heading as Color. We create five color contextual buttons panel blocks using the <a> link with the panel-block class.

Three panels for brands, price, and color
In Listing 3-23, we define a <div> class with the box class. Thereon, we define the <article> tag and assign the media class to it. Then, we create an element with the content class and add the heading and sample content in it. We also create three icons for Like, Reply, and Share using the Font Awesome-supported icon elements.

Box layout container
Footers help designers add common information and navigation options at the bottom of the web pages. Copyright information, sitemaps, privacy policies, and contact information are usually included in the footer section. Links to important pages of the web site are normally a part of the footer section (more so in single-page web site design). Streamlining the footer information is also a way to enhance the SEO and UX/UI aspects of your web site (think good usability and readability practices), specifically on mobile and tablet devices.
We use the <footer> element and assign the Aqua color to it. We enter the copyright sample message in the enclosed <p> tags. Then, we proceed to use a navigation <nav> element and assign the tabs, is-boxed, and is-fullwidth classes to it. Within that, we define a Bulma container using the container class. Similar to the Hero code, we create an unordered list of social media links from the Socicon web site.

Footer section highlighted in a red box
In this chapter, we explored the different types of layout helpers such as containers, boxes, panels, media objects, and Hero banners, among others. These containers can be an alternative for grid structures, depending on the web site requirements.
In the next chapter, we will look at navigation and media components. These UI components are quite useful in building interactive web sites, a best fit for today’s effective digital layouts.
This chapter examines Bulma’s navigation and media components. Bulma’s intuitive and easy-to-use navigation components enable access to content and commercial functionalities such as checkout areas, while the media attributes enable sophisticated web design. Bulma’s navigation components enable users to find content quickly and easily. They also help organize content in a streamlined manner, kind of a hallmark for efficient web design. Let’s take a look at the various navigation and media elements.
Navigation elements are an imperative aspect in designing modern layouts. They are used as a roadmap for the content on your site interface. Aesthetics account for nothing if your users cannot interact with your site easily. Therefore, navigation elements help visitors access that information quickly, eliminating the guesswork of finding the solution/content, which encouraged them to explore your web site in the first place. On a pan-optic level, navigation elements increase the user–site engagement and conversion rate while reducing the bounce rate significantly.
Bulma has several navigation components that streamline the usability factor significantly in a minimalistic way, without the bulk or clutter.
Bulma’s navigation elements comprise breadcrumbs, drop-down menus, navbar (think navigation bar), and tabs that enable rapid user accessibility in a “no-frills” way.
Breadcrumbs are a type of navigation system, which pinpoint the user location on the web app or web site. Breadcrumbs also improve site accessibility and exploration immensely, since they show the user location. The user can understand the hierarchy, and thus this navigation element is quite handy when there is massive content in the site.
Breadcrumbs are a common feature in web apps or sites that have several categories of displayed products/goods—this makes it easier to navigate to a particular category in case you want to check out the different products of similar make/genre. With an ultimate focus on site hierarchy, it enhances the way in which users are aware of the web page or any specific content location, paving the way for an excellent user experience.
In Listing 4-1, we create a box container by using the box class with a <div> element. Then we add a navigation element with the <nav> tag. We go on to assign the breadcrumb class to the <nav> tag. We create an unordered list using the parent <ul> and its child <li> tags.
To the first <li> tag, we assign the is-active class and name it Home. The is-active class will indicate the first <li> tag as the current active item. We then create six more <li> tags and name them accordingly, as seen in Listing 4-1.

Basic breadcrumb
In the Bulma breadcrumb component, you can align the breadcrumb to the right or center. Bulma supports different separators like bullet separator, has-succeeds separator, and the arrow separator.
As you see, most of the code is the same as in Listing 4-1. Instead of the box layout, we use the container class as the main <div> element instead of a box layout.
Coming back to the relevant stuff, we add the classes has-arrow-separator and is-right alongside the default breadcrumb class in the <nag> tag. The rest of the code is the same, where we create an unordered list and define the name for each list item.

Right-aligned breadcrumb with an arrow separator
In Listing 4-3, we create a container for the first breadcrumb. We use the is-small class, is-centered, and has-bullet-separator in conjunction with the breadcrumb class for the first breadcrumb. The rest of the code for the first breadcrumb is similar to the earlier code listings, where we create an unordered list to define names for the breadcrumbs.
Then we create the second breadcrumb inside another container where we add the is-large class, is-centered, and has-succeeds-separator classes in conjunction with the breadcrumb class. The rest of the code is the same as earlier examples, where we create an unordered list and define the names of the breadcrumb items.

Centered breadcrumbs in small and large sizes
As you can see in Figure 4-3, both the breadcrumbs are aligned to the center. While the first breadcrumb is small in size, the breadcrumb below is large in size. Observe the bullet separator and has-succeeds separators for the first and last breadcrumbs, respectively.
In Listing 4-4, we define a main <div> with the container class. Inside we create another <div> element and assign the breadcrumb class in conjunction with the is-centered class to position the breadcrumb at the center of the row.
creates an empty space after the icon. We have also used the is-small class in the span tag and the home icon within the <i> tags, which are within the <span> tags.
Then, we define different icons within each <li> tag for each breadcrumb item based on the relevant names. Also, we have kept the Support breadcrumb item as the current item using the is-active class.

Breadcrumb with icons
Drop-downs are usually created to show the different items/content in a compact way—for example, the distinct categories commonly seen on e-commerce web sites are designed in a panel-like drop-down. You can design an apt site structure and include diverse menu items in a drop-down, eliminating too many links or congestion on the web page. Apart from a clean layout, it also eliminates the need to scroll repeatedly, as the user can access specific information from the links in the drop-down list.
From a UX/UI perspective, you have to consider the mobile platform, where it becomes a different ballgame altogether due to the touch feature and highly compact screens. Also, the links, data, or information in a drop-down should be well organized in line with the user needs. Bulma’s drop-down feature is tailored for all platforms, and is especially compatible with the mobile screen interface owing to its mobile-first paradigm.
In Listing 4-5, we create a <div> element with the dropdown class to make it a main container. For the drop-down button, we create another <div> element and assign the dropdown-trigger class to it. Within this <div>, we define the drop-down button with a white background and, using the icon in conjunction with the button element, we create a small drop-down arrow.
Once we are done with the drop-down button, we create a separate drop-down menu where we will define the drop-down content. We create a <div> and assign the dropdown-menu class to it. Within that <div>, we create a child <div> and assign the dropdown-content to it. Next, we create several links using the anchor <a> link tags with the dropdown-item classes.
After we define four links, we create a drop-down divider using the <hr> tags with the dropdown-divider class. Thereon, we create three more links using the <a> tags with the dropdown-item class for each link.

Drop-down menu
In Listing 4-6, we create similar drop-down functionality but we add the is-hoverable class in conjunction with the dropdown class for the main <div> element. Then, we create the drop-down button as in the earlier example.
The difference is when we create the drop-down menu. Within the <div> with the dropdown-content class, we create <div> elements and assign the dropdown-item class to each of the menu items as shown in Listing 4-6.

Drop-down menu with prose content on hover action
Tabs are an excellent navigation system due to the linear representation of the site structure. Tabs not only help you divide the content into separate sections but also provide a way to access that content. Their intuitive architecture makes users aware of their location on the site quickly.
However, the usability factor of the navigation tabs element depends on how you organize and use their functionality—for example, the heading for each tab should have minimal characters or shorter lengths. Tabs are quite effective when you want to show a string of similar categories/similar genres.
Bulma’s tabs component is quite easy to design and helps site/app’s visitors to access chunks of data in a simple way. However, web designers/developers should take into account the specific user needs, amount of data, and how rapidly users can access that content.
In Listing 4-7, we create a main <div> element and assign the tabs class to it. Then we create an unordered list within that <div> using the <ul> and <li> tags. We assign the is-active class to the first <li> tag to make it the current item.

Tabs navigation system
As you can see, we have a simple navigation system.
is-centered class for aligning tabs to the center
is-large class for creating large-sized tabs
is-boxed class for the classic tabs look
Similarly, we create several tabs items.

Boxed tabs with icons at the center
As you can see from the output, the tabs are positioned at the center of the row and have the relevant items next to the tab names. Moreover, you can also see the classic boxed look for the Home tab, which is the default current tab as defined in the code.
In Listing 4-9, we use the is-boxed and is-toggle classes together in conjunction with the tabs class to allocate a boxed border for each tab. We also use another class, is-toggle-rounded, in conjunction with those classes to give a rounded border for the first and last tabs.
The rest of the code is similar to the earlier example, where we have created tabs with icons using an unordered list.

Boxed border for all tabs with rounded borders at each end
Bulma’s navbar element helps design a horizontal list of links enabling site visitors to access any section in the site. However, from a UI/UX perspective, it has to be minimalistic and simple. The headings should be short in length and the number of headings should be not more than 5 or 6, as it may create unnecessary clutter. You should never design a navbar first and then fit in the content. In fact, it should be the other way around—the navbar should be designed keeping content at the crux of your site structure, to ensure high-degree of readability and rapid access.
In Listing 4-10, we define a navigation element <nav> and assign the navbar class to it. The navbar class results in a navigation bar container. Within the <nav> tags, we create a main < div> tag and assign the navbar-brand class to it. This navbar-brand element is the left side of the navbar, which is always visible and usually contains logo and links. Thereon, we create an anchor tag and assign the navbar-item class to it. The navbar-item class usually is used for various items on the navbar, but here we use it for the anchor link, pointing toward a site. Then we define the logo using the <img> tag.
Next, we create the hamburger icon, which is called the navbar-burger in Bulma. For this, we create another anchor tag and assign the navbar-burger class to it. We use a burger class in conjunction with the navbar-burger class to facilitate action using JavaScript. We set a data-target attribute and assign the value Navicon to it. We create three <span> elements without any label or name for creating three lines of the hamburger icon functionality.
Once we are done with the navburger, we create a separate <div> and assign the navbar-menu class to it. We also assign an id, whose value is the Navicon, which incidentally is also the value of the data-target attribute mentioned earlier.
Then we create another <div> tag within the preceding <div> and define the navbar-start class to it, which will align the navbar menu to the left of the logo. We move on to create five anchor links and assign the navbar-item class to each of them, and define the menu items on the navbar at the left of the logo.
Next, we create another <div> and assign the navbar-end class to it. This will align the menu-items defined here to the right of the navbar. We define a <div> element within it and assign the navbar-item class to it. We create a Login button and assign the is-outlined class to it.

Navbar with logo and menu items
Media components help display media in different ways, depending on their use cases or functionality. In this section, we will look at progress bars, notifications, images, tags, and pagination components in Bulma.
A progress bar is an excellent way of showing the progress of any action. It is usually an indicator of the downloading process and enables the user to visualize the progression of the download operation.
In Listing 4-11, we create a box container and define two progress bars. We use the <progress> element and assign a progress class to it, and also assign a contextual primary color to it using the is-primary class. We set the bar value as 15, with 100 being the maximum value. For this, we use the value attribute and the max attribute.
Next, we similarly define the second progress bar with 35 as the value and a maximum value of 100. We assign the contextual warning color to it.

Normal progress bars with different values and contextual colors
In Listing 4-12, we create two progress bars and assign the values 50 and 65 in conjunction with the progress class. We use the is-medium size class for both progress bars. We also define the contextual colors by assigning the is-info and is-success classes to them, respectively.

Progress bars with medium-size and contextual colors
In Listing 4-13, we create two progress bars and assign the is-large class in conjunction with the progress class to each of them. We define the link and danger contextual colors to the two progress bars, and also define 77 and 90 as the values for the two progress bars.

Large-sized progress bars with contextual colors
In Listing 4-14, we have created 2 progress bars with different contextual colors but we have not used a value attribute though we have retained the max attribute.

Buffering progress bars without values
Notifications are a visual aid to attract the attention of the users. At times, they prompt the users to complete an action; sometimes they may be used to show important/helpful information to the users. Updates/alerts are types of notifications, while push subscription messages/context pop-ups are other use cases usually found in modern layouts.
In Listing 4-15, we first create a columns container and assign the is-multiline class in conjunction with the columns class. Then we define three columns of different sizes. Inside each <div> element column, we use the notification class and also create a delete button for those notifications by using the delete class for each <button> element.
The first column occupies the space of five columns, whereas the second column is allocated a space of five columns and is offset by one column. The third column is assigned the space of half the 12-column grid and is assigned an offset of two columns. While the first notification is assigned a primary contextual color, the second notification is assigned the link contextual color using the is-primary and is-link classes, respectively. The third notification is not assigned any color and will take up the default color for the notification attribute.

Different colored notification columns with the delete button
Bulma’s image element is a container for responsive images or pictures. Bulma’s image element can not only be used for creating rounded and Retina images but also for defining ratio-based responsive images—for example, images used in still photography displayed consistently on various devices/screen-sizes.
In Listing 4-16, we use two <figure> tags for the same image, with the image class assigned to each of them. We use the <img> tag for defining the source of the image. While the first image is assigned a size of 48×48 using the is-48×48 class, the second image is assigned a size of 128×128 using the is-128×128 class in conjunction with the image class.

Same image with different sizes
In Listing 4-17, we use the <figure> tag and assign a size of 128×128 to the image. Next, for the <img> tag, we assign the is-rounded class, which gives a rounded border shape to the image.

Rounded border image
If you do not know the exact dimensions, you can still define a ratio for the images.
image is-square
image is-1by1
image is-5by4
image is-4by3
image is-3by2
image is-5by3
image is-16by9
image is-2by1
image is-3by1
image is-4by5
image is-3by4
image is-2by3
image is-3by5
image is-9by16
image is-1by2
image is-1by3
In Listing 4-18, we use the <figure> tags and use the is-3by2 ratio modifier class in conjunction with the image class. Then we define the image source using the <img> tag.

Image ratio modifier (3by2)
In blogs you may see tags, which are labels that are relevant to that article. It is a handy element in today’s digital design era, especially used in digital photos programs, web pages, blogs, articles, and social media platforms.
A particular use case is in blogs where you promote your products/goods. You will use relevant tags to increase the scope of the product. But your site visitors/users may come out with different tags, which may be market-based, location-based, or context-based. For example, consider a blog on a datacenter. You may use tags like “Data-Center operations,” “Digital Datacenters,” and “Innovation-in-Datacenters” for your company blog/article. Your users/customers/readers may add tags like “colocation,” “digital transformation,” “IoT,” “DCIM,” “Sustainability,” “Data-center Planning,” and “Data-center-Energy-Efficiency” or even their company name to increase the reach and exposure of their solutions/concepts.
In Listing 4-19, we create a box container within which we define a paragraph tag <p> and assign the has-text-centered class to it so that the output is centered. Then we create three tags using the tag class. We enclose it in three <span> elements and after assigning the tag class to each <span> element, we assign different contextual colors—primary, link, and success—to the three <span> elements, respectively.

Tags with different contextual colors
The code in Listing 4-20 is almost the same as that in Listing 4-19, but it uses the is-rounded class in conjunction with the tag and contextual color classes.

Rounded tags
In Listing 4-21, we create a box container and define three <div> elements. Within the first <div> tags, we create two <span> elements, and assign the tag class with different contextual color classes.
Then we create another <div> and we assign the tags are-medium class to it.
Within this <div> tag, we create two <span> elements and assign the tag class in conjunction with the contextual color classes.
Moving forward, we create a third <div> element and assign the are-large class to it.
Then we similarly create two <span> elements and assign the contextual classes to them in conjunction with the tag class.

Different sized tags
The Listing 4-22 code is the same as in Listing 4-21, where we create three <div> elements with normal, medium, and large classes assigned to them. Also, we create two <span> elements for creating two tags in each <div> section.
The only difference is in each <div> element, to which we assign the tags has-addons class to attach the two tags.

Addons feature attaching two tags
In Listing 4-23, we create a box container to house two <div> sections where we create medium-sized tags and attach two tags under each <div> element.
To the first <div>, we assign the tags has-addons class in conjunction with the are-medium class. We create two tags using <span> elements. Then we use a <button> element and assign the delete class to it.
For the second <div>, we create two medium-sized attached tags the same way. However, in this <div>, instead of the button element, we use an <a> anchor link tag and assign the tag is-delete class to it.

Delete button and delete tag appended, respectively
In Listing 4-24, we create a box container and create a parent <div> element and assign the field is-grouped and the is-grouped-multiline classes to it.
Then we create multiple several <div> containers. In each <div> child container, we create subchild <div>s and assign the control class to them. Next, we create attached tags using the tags has-addons class and create two anchor links, where we create each contextual color tag and append with the delete tag.
We create several <div> elements with the control class, and within them we append two tags using the process mentioned earlier.

Grouped tags container
The output in Figure 4-24 has a look similar to the tags used in corporate blogs or on the LinkedIn portal among other platforms.
Pagination is quite useful in segregation of content in multiple pages and indicates the toggling effect, helping users find the specific content easily. It prevents users from getting overwhelmed with content overload and divides the content into discrete pages, resulting in remarkable readability. Thus, pagination helps reduce complexities and enhances content exploration in a well-organized way.
In Listing 4-25, to create the pagination, we initially create a navigation <nav> element and assign a pagination class to it. Then we create two links and assign the pagination-previous and pagination-next classes to it, respectively.
Then we create the pagination buttons by using an unordered list. The parent <ul> tag is assigned the pagination-list class. Within the <ul> element, we create the list items using anchor <a> tags.
First, we create an anchor link <a> and assign the pagination-link class to it. We also assign the is-current class to it to make it look like the current page. We assign 1 as the starting number of the page.
Then we create the second <li> tag and use a <span> element and assign the pagination-ellipsis class to it. The ellipsis creates dots, which is the range separator. Within the <span> tags, we insert the … to complete the functionality of the ellipsis.
We move on to create the third anchor link tag and assign the pagination-link class to it and enter the page number as 4. Similarly, we create another pagination list item and name it as 5 for the page number.

Normal pagination
The code example in Listing 4-26 for creating the pagination is the same as in Listing 4-25.
Instead of a single <nav> element, we create three separate <nav> elements. The first <nav> element is assigned the pagination is-small class (instead of the pagination class in default size) to create a small-sized pagination feature.
For medium-sized and large-sized pagination output, we use the pagination is-medium and pagination is-large classes for the second and third <nav> elements, respectively.

Small-, medium-, and large-sized pagination components
You can change the alignment of the pagination component. You can center it or align it to the right. Apart from that, you can also use the disabled attribute to disable a link. You can also create rounded pagination components by using the is-rounded class.
In Listing 4-27, the process to create the pagination is the same. The specific difference is that for the first <nav> element, we assign the is-rounded class in conjunction with the pagination class for defining the rounded shape for the pagination component. Thereon, we also assign the is-right class, which will align the pagination component to the right of the web page.
Then, in the first <a> element with the pagination-previous class, we add the disabled attribute to show that the link is disabled. The rest of the code is the same as that for the pagination components in the earlier examples.
Once we are done with the first pagination component, we create the second pagination component using another <nav> element. We assign the pagination is-rounded class to this <nav> tag. Here, in conjunction with the pagination is-rounded class, we assign an is-centered class to align the pagination component to the center. We also use the disabled attribute in the first anchor tag akin to the previous navigation element resulting in a grayed-out look for the link.
The rest of the code is the same as that of the first <nav> element or the earlier examples.

Pagination components to the right and center, respectively
In Figure 4-27, you can see that the first pagination component is aligned to the right. The Previous & Next page labels are shifted to the left due to this alignment. In addition, the Previous label is grayed-out due to the disabled attribute.
As for the second pagination component, the alignment is to the center. Here, the Previous & Next page labels are on opposite ends of the page. Both these screenshots are taken on a tablet-sized screen.
In this chapter, we looked at navigation elements and media components. In the next chapter, you will learn about buttons, icons, modals, and forms, enabling you to build sophisticated, interactive web pages with ease.
CSS frameworks have built-in interface elements and components that enable easy and quick development unlike scratch-coding. In this chapter, we will look at useful components like Font Awesome icons, buttons and button-groups, content-wrappers, modals, and forms.
Buttons are vital in web design, as they enable the user to interact with your web site, especially in call-to-action scenarios. In modern layouts, you need to follow some basic rules to increase user communication with the buttons. They should prompt the user to click- that’s why it should be easy to locate; you should also ensure consistency from an end-user perspective. When it comes to shape, the design should be uniform all throughout the web site (for example, if you are using square buttons, ensure that all the buttons have a square design). However, the size of important buttons can be a bit larger and noticeable. You can use focus and hover functionalities for enhanced usability. An important aspect is that users should get relevant responses once they click the button. For example, you are filling a form, and after entering the required details, you click on Submit. A message stating “Your form has been submitted successfully” or “We have received your application and will get back to you soon” will reassure the user that the required action has been implemented.
Bulma has responsive buttons where you can define different sizes, colors, outlined patterns, display width, shapers, button group, and lists, to mention a few.
As seen in Listing 5-1, we use an anchor link <a>, <button>, and <input> tags to define buttons. Initially, we use the anchor link <a> tag and use the button class to form a button with a link. The <button> tag can be assigned a button class to define a button.
In forms, we tend to use the < input> tags. Here, in the first <input> tag, we assign a button class in conjunction with the submit type attribute. We use the value Submit Input as the name of the button.
In the last code line, we use an <input> tag again, to which we also assign the button class. We also assign it the reset type attribute and set the value as Reset Input, which will be the name of the button.

Different button types
In Figure 5-1, we can see normal buttons as defined in the code.
As you can see in Listing 5-2, we have used an anchor link initially and assigned the button class in conjunction with the is-light color class. For the second button, we use the button class in conjunction with the is-black color class. The third button using the input tags is assigned the button class in conjunction with the is-primary class. For the fourth button, we use the is-warning class in conjunction with the button class.

Few colored buttons
Listing 5-3 uses almost the same code as Listing 5-2 except for the size classes. For the first button, we use the is-small class, which will result in a small-sized button. For the second button, we use the is-normal class, which is the default size. For the third button, we do not use any button size class, as a result of which it will be of normal size just like the second button. In the fourth button code, we use the is-medium class, whereas in the fifth button code line, we use the is-large class, resulting in medium- and large-sized buttons, respectively.

Different button sizes
Listing 5-4 we use a parent <div> element and assign the buttons are-medium class to it. This will allocate a medium-size to all the buttons in the group by default. However, in the third line of code, we use the is-normal class. As a result, all the buttons will be medium-sized except for the third button, which will end up as a normal sized button owing to the is-normal class.

Medium-sized button group with a single, normal-sized button
In Listing 5-5, we create four buttons. The first button is assigned the button is-danger class in conjunction with the is-outlined class. The second button is assigned the button is-black class in conjunction with the is-outlined class. The third button is assigned the button is-primary class in tandem with the is-outlined class. The fourth button is assigned the button is-warning class alongside the is-outlined class.

Outlined buttons
In Listing 5-6, we create four buttons. For the first button, we use the button is-primary class in conjunction with the is-small and is-fullwidth classes. The second button has been assigned the button is-info contextual color class in conjunction with the is-normal and is-fullwidth classes. The third button is created using the button is-danger class in conjunction with the is-medium and is-fullwidth classes. The last button is assigned the button is-warning class in conjunction with the is-large and is-fullwidth classes.

Full-width different size buttons
In Figure 5-6, we see that the buttons have the size and contextual colors assigned in the code. All four buttons stretch to the full-width of the screen, as defined in the code.

Inverted feature

Rounded buttons
You can also assign the hover functionality, which will highlight the button, when you hover over it. In addition, you can also use the focus functionality, which will highlight that button in the code output. Bulma has an active feature, which will display the button as the selected one.
You can also create a static button, which can be used in conjunction with a form label—commonly used in form design in modern layouts. In Bulma, you can also assign an intermediate loading display style to the buttons.

Focus, hover, active, static, and buffering buttons
In Listing 5-10, we create a parent <div> element and assign it the field and is-grouped classes. Next, we create three <p> paragraph tags. Inside each <p> element, we create three buttons and assign the link, warning, and danger contextual colors to each of them, respectively.

Grouping buttons in a single line
From the preceding listing, all we have done is add the has-addons class to the field class.

Addons button implementation
In Bulma, you can also create button lists. If the button list contains a lot of buttons exceeding the default 12-column grid space, then it will wrap on multiple lines with equal spacing between all buttons.

Button list wrapping on multiple lines (Tablet Screen)
In Figure 5-12, we can see that the buttons are in a single line; on exceeding the space of one row, they continue in the next line.
This screenshot was taken using a tablet screen.
So far, we have seen the different button-based aspects; in the next section, we take a look at Bulma’s compatible icons.
Icons are important in web design from a readability point of view. You can draw the user’s attention using icons due to their aesthetical attribute. For example, a danger sign icon will alert the user about some untoward action; for instance, an antivirus blocks access to some malicious web site or virus-laden portal, and shows a danger sign alerting you to refrain from surfing that web site. It also helps if the danger icon is accompanied with relevant text.
Bulma displays excellent compatibility with Font Awesome icons, Material Design icons, and Open Iconic icons. The latest Bulma release is compatible with the Font Awesome 5.x version and we will learn it in detail.
In Listing 5-13, we use four <span> elements. For each <span> tag, we use the icon class to define the icon container. We use has-text-info, has-text-square, and has-text-warning classes for the first, third, and fourth <span> tags, whereas no text color modifier is added for the second icon. To create an icon, we use Font Awesome and include the fas fa-share-alt-square class, which is an icon for Share, like you usually see in social media sites nowadays (fas is the common syntax for all Font Awesome icons, whereas the type of icon is defined by the latter icon type).

Same icon—different colors
In Listing 5-14, we club the icon is-medium and has-text-danger classes together. We use the Font Awesome Share icon. In the next <span> tag, we use the same code but we also add a magnifier fa-2x to magnify that icons size.
Similarly, we create three more <span> tags in the next line where we use the icon is-large class and has-text-success classes together. We define a Font Awesome Share icon using the fa-share-alt-square class. Then we keep the first icon as the default large size but add fa-2x and fa-3x classes to magnify the large icon size

Code output of different icon sizes and magnifiers, along with Font Awesome 5 size table
In Listing 5-15, we create three buttons using the <a> anchor link tags and assign the button is-large class for all of them. We then create a Font Awesome Share icon. For the first button, we keep it as it is by default. The second button and third button are assigned the fa-2x and fa-3x magnifier classes respectively.

Button with only an icon
In Figure 5-15, we can see that the three buttons are square, irrespective of the size of the button or icons.
In Listing 5-16, we create a group of buttons. We do that using a buttons group class container with the <p> element. We create five buttons. For the first button, we define an anchor tag <a> and assign it the button is-info class. Within the <a> tag, we use a <span> tag and assign the icon class to it. Then we create an <i> tag where we define the Facebook messenger icon. Moving forward, we create another <span> tag and define the name of the button as Messenger.
Similarly, we use four more buttons using similar code, except that the icons are different and assigned a name as per the social media context—namely, Twitter, Pinterest, Reddit, and Snapchat.

Buttons with Icons
In Figure 5-16, we can see that the icons are depicted with the button text as defined in the code.
Now that you are acquainted with icons, we will look at the content class feature in the next section.
There are instances when you cannot use CSS classes. In those scenarios, you stick to HTML markup; also, at times you need to use HTML tags only for some text. Bulma’s content element is just what’s needed in such situations as it is a container for any type of content. For example, if you use HTML tags for unordered lists, you can enclose the code inside an element with the content class.
For ordered lists, you can either use the respective HTML attribute value or CSS modifier class.
For example, if we use the type attribute and specify the attribute value as 1, then it will show an ordered list with the numbers 1, 2, 3…and so on. For type value as A, it will show the ordered list as A, B, C… and so on. Similarly, you can define lower character roman letters (i, ii, iii, etc.), uppercase Roman letters (I, II, III, etc.), and lower case alphabets (a, b, c, etc.), using i, I, and a as the type attribute values, respectively.
The other method is to use CSS modifiers like is-lower-alpha, and so on.
In Listing 5-17, we use a parent <div> element and assign the content class to it (making it a content wrapper). For the first ordered list defined within the <ol> tags, we assign 1 as the value of the type attribute. Next, we define the list items using the <li> tags. For the first ordered lists defined within the <ol> tags, we assign 1 as the value of the type attribute. Next, we define the list items using the <li> tags.
For the second ordered list defined within the <ol> tags, we assign A as the value of the type attribute. Next, we define the list items using the <li> tags. For the third ordered list defined within the <ol> tags, we assign a as the value of the type attribute. Next, we define the list items using the <li> tags. Similarly, for the fourth and fifth ordered list, we use I and I as the type attribute values respectively.

Ordered lists within the content wrapper
Therefore, the content wrapper is used to handle WYSIWYG-generated content, specifically where HTML tags are used.
In the next section, we will touch base with modals, which are quite handy at times in modern layouts.
Modals are basically overlays, essential a float on the web page. Modals are used in the following situations: to collect data, prompt users (alerts & warnings), get user input, or as an intermediary before displaying important content, features, or update announcements.
Though modals are quite useful in grabbing the user’s attention, they should be used sparingly because they distract the user’s focus from the main content. Therefore, it is better to restrict their use to mission-critical data/information or step-by-step wizards. Nevertheless, they save significant UI screen estate, while also being decisive. You should not cram too much content in the modal body, meaning it should be precise and entice the user toward a specific call-to-action. Keep them minimalistic.
Bulma has an intuitive modal component that can be used for diverse use cases; it helps retain user-focus on the context of the current screen without interrupting the workflow. We will see two code examples, one of which is a content modal and the other an image modal.
In Listing 5-18, we first create a modal trigger button, which on being clicked, will display the modal. We assign a modal class to the <button> tag and assign the is-success contextual color to it; we define a modal-button class for it too. Then we use a data-target value as #myModal, which will be used for the JavaScript purposes. We name the modal button Content Modal Click.
Next, we create a <div> class, assign the modal class to it, and assign the id as myModal, which in turn was the value of the data-target value mentioned earlier.
Within the parent <div>, we create a child <div> and assign the modal-background class to it and then use a closing <div> tag. Then we create the second <div> child under the parent <div> and assign the modal-content class to it.
Then we create a paragraph tag and assign the box class to it. Post closure of the parent <div> element, we move on to create a large button and assign the modal-close class to it. Now we write the JavaScript code.
Here, the document.querySelectorAll(‘.modal-button’) method matches all the elements in the DOM (Document Object Model) that has the ‘modal-button’ class. Next, we loop through these list of elements with a forEach method and apply a callback function to each of the element that matches that class. When the callback function is applied on each of the DOM elements, it adds an event listener with another callback that would run when that event is triggered.
To explain it further, when there is a click event on any DOM element with the class, ‘modal-button’, a callback is triggered that gets all the element with the ‘data-target’ attribute. When this happens, we add an ‘is-active’ class to that element to signify that we want it to become active.
On the other hand, we then target the DOM element with the ‘modal-close’ class and add an event listener to handle when a user clicks on it. When this happens, we trigger a callback, which helps us to remove/reset the ‘is-active’ class from the modal.

Content modal

Image modal
After getting to grips with the modal design, we will now move to forms—a common feature in web designing projects.
Forms are a useful utility that allows users to enter data; the collected data is then sent to the servers for processing purposes. The concept of displaying e-mail addresses on the web site is quite redundant due to phishing or spam bulk mail among other concerns. Thus, web site owners prefer a contact form. Bulma’s forms components are flexible and easy-to-use. In this section, we will look at the procedure of building form fields in an easy-to-follow way.
Before explaining the code, remember that all the form control classes should be wrapped in a .control container. While combining many form controls, the .field class should be used as a container to maintain equal spacing.
Since we are writing the code for four different form fields in Listing 5-20, we will start with a <div> element and assign the field class to it. For the first form field, we create a <label> tag and assign the label is-small class to it. We then define the input characteristics. For the <input> tag, we assign the input is-small class and type as text. We assign a placeholder for the form field using the placeholder attribute.
For the second form field, we use similar code, but we just enter label as the class for the <label> tag and input as the class for the <input> tag.
For the third, medium-sized form field, we again use similar code but we assign the label is-medium class for the <label> tag and input is-medium class for the <input> tag.
For the large-sized form field, we use similar code but we assign the label is-large class for the <label> tag and input is-large for the <input> tag.
For all the tags, as mentioned in the first form field, we use a placeholder.

Different sizes of form fields
In Listing 5-21, we create four addons form control fields.
For the first form field, we create a parent <div> and assign the field has-addons class to it. Then we create a child <div> and assign the control class to it. Within an <input> tag, we assign the input class, type as text, and a placeholder. Then we create the second child <div> and assign the control class to it. We then define a static button using the button is-static class and assign the Search name to it. This will combine the form field with the static button.
For the second form field, we use the same code; but in this case, the only difference is that we assign the has-addons-right class in conjunction with the field has-addons class. This will result in alignment of the form field to the right-side.
Similarly, we create the third form field; we use the same code but here we use the has-addons-centered class in conjunction with the field has-addons class.
As for the fourth form field, we create a full-width form field by using the is-expanded class in conjunction with the control class for the first child <div> in that section. The rest of the code is same as that of the first form field.

Form fields with addons with diverse alignment
In the preceding screen-shot, the first form field with the static Search button is aligned to the left by default, the second aligned to the right, the third aligned to the center, and the fourth a full-width form field—each with a static Search button.
In Listing 5-22, we create a Name form field the usual way. But after defining the label, we assign the is-loading class to the control class for the <div> element. Then, we use an <input> tag, and assign the input is-rounded class and type as text.
Now that we have created the first rounded form field, we move on to the next part where we create two text area boxes. For the first text area box, we use a parent <div> with the field class and create a label for the text area box. Next, we use the <textarea> tag and assign the textarea class to it. We move on to add the is-success color modifier to this box and define the placeholder. Next, we define the number of rows as 3 using the rows attribute.
For the second textarea box, we use the same code, but here we give it a danger contextual color modifier instead of the success color modifier in the first. We also define the number of rows as 6.

Rounded form field and different sized and colored text area boxes
In Figure 5-22, we can see that the first form field has a rounded border. At the right of the form field, you can see the loading status state.
The text-area boxes with a 3-row size and 6-row size with their respective colors are also displayed below the form field.
In Listing 5-23, we create a parent <div> and assign the field class to it. Then we create a control by assigning the control class to the child <div>. Within this child <div> we create another child <div> and assign the select class to it in conjunction with the is-fullwidth class. Then we create a <select> tag and assign a name to it.
Then, we create drop-down menu items using the <option> tags. For each <option> tag, we assign a value that is the name of the menu item. Once we are done, after the closing <div> element, we create a <div> element, which is the second child of the main <div> element at the start, and create a button and assign the is-static class to it.

Dropdown menu items shown after clicking the drop-down icon
In Listing 5-24, the code is almost the same, but we use an attribute, multiple size, and assign the value 10 to it, meaning it will display ten items in the drop-down without the need to click the drop-down icon.

Dropdown menu shown automatically on code output
Now that we have seen several form components, let’s build a Sign-Up form, which you come across in real-time scenarios.
In Listing 5-25, we create the heading for the form using the <h3> tag and name it Sign Up.
Then, we create the Name form field the usual way: we create a <div> element and assign the field class to it. Then, we create a label by using the label class with the <label> tag. Next we create a child <div> and assign the control class to it. Then we define the <input> tag and assign the input class and type value as text along with a placeholder.
Next, we create the Email form field. Just like the Name form field, we create a <div> element and assign the field class to it. Then we create a label called Email. But here, once we define the Email label, we create a child <div> and assign the control class in conjunction with the has-icons-left and has-icons-right classes. This feature will place icons to the left and right as defined later in the code.
Then we create an <input> tag and assign the input class in conjunction with the is-danger contextual color; we define the type value as email here. Then we define two icons. We create the mail icon using the fas fa-envelope class within the first <span> tag. We also assign the is-small and is-left class to it; this will result in a smaller size icon and pull the icon to the left of the form field. Next, we define another icon using a different <span> tag and assign the is-small and is-right classes to it. The icon here would be an exclamation triangle. As defined, the icon will be of smaller size and pushed to the right of the form field. Then we create a paragraph <p> element and assign the help is-danger class to it along with the message “Do you mean joe.black@potterlogic.com.”
Similarly, we create another Email field but we do not define a label for it. The placeholder here will be Re-enter your Email. The rest of the code is the same as that of the Email field.

Name, email, and reenter email fields
Then we define the Password section. Here we use similar code as that of the Name form field. We create a field container and define the label as Password. Then we create a <div> element and assign the control class to it. We create an <input> tag and assign the input class to it. The type here would be text, and thereon we define the placeholder text.
Similarly, we create another Password just like the preceding password form field for the purpose of re-entering the password.

Password fields added in the sign up form
In Listing 5-27, we create a parent <div> and assign the field class to it. Then we create a child <div> element and assign the file container class to it. We assign the primary contextual color to it by using the is-primary class in tandem with the file class. Next, we define the label using the file-label class, the actual interactive and clickable part of the element. Then we define an <input> tag and assign the file-input class to it. We define the type as file and name as resume. Then we create a parent <span > tag and assign the file-cta class to it, which will enable the upload call-to-action. Then, we create a child <span> and define the file icon. For this, we assign the file-icon class to the child <span> element. The child span element contains the code for the Font Awesome upload icon. Then we create the second <span> child element, to which we assign the file-label class and the label as Click-to-Upload.

Click-to-Upload button added to the form
In Listing 5-28, we create two radio buttons and a checkbox. Initially, we create a parent <div> element and assign the control class to it. Then we create a <label> and assign the radio class to it. Then we define the <input> tag, to which we assign the radio type attribute. We define the label name as Male. Next, we create the second radio button similar to the first one, but here we define the radio button label name as Female.
Moving forward, we create a checkbox. We create a parent <div> and assign the field class followed by a child <div> element with the field-body class. Then, we create a child <div> element within and assign the field class to it. We define a <div> with the control class followed by a label. The label class is checkbox and the input type is checkbox. We define the label as Subscribe to our Newsletter.

Adding the radio buttons and the checkbox

Complete sign up form
In this chapter, we learned about Bulma’s CSS components that will help build complex web sites with ease. These components adhere to the DRY (Don’t Repeat Yourself) paradigm. The common design elements can be reused multiple times, maintaining the concept of clean coding. In the next chapter, we will look at the road ahead for CSS frameworks and the world of possibilities opening up as web design is increasingly leaning toward the digital design paradigm.
With enterprises undergoing digital transformation, this digital age has been the defining moment for the millennial and Gen Z workforce. Mobile devices have become the de-facto standard for viewing and browsing the Internet. SEO is slowly but surely inclined toward ensuring a user-friendly paradigm.
With the advent of digital platforms, web design will transform into digital design, specifically to meet the expectations of the present-day workforce. Ultimately, it is about creating an immersive end-user experience. The gap between the digital world and real-world aspects will be significantly reduced, syncing with each other going forward.
User experience will be the focal point of web design. Google, Amazon, and Facebook are some organizations that develop advertisements that are much more personalized and user-specific. However, the scope is limitless beyond ads, and the future will see digital design showing information that will be more relevant to a particular user or target audience.
The rapid influx of new gadgets and devices will change web designing trends comprehensively and make virtual reality (VR) and augmented reality (AR) a norm. 3-D effects and high-end virtual effects will be accepted and integrated into digital design, paving the way for more interaction and adoption of real-world facets.
Today, due to high page load times and latency, 3-D animation, videos, high-resolution images, and automation elements are sparingly used. However, the next-generation web design will focus more on performance, owing to which these high resolution special effects will be displayed quickly just like prose and text content. The dated ways of contemporary web design will be used only for those sites, where text content and detailed description are necessary. After all, it is all about simulating a real-life and immersive experience.
Gone are the days when you design a site and impose it on users. With data science gaining precedence, data and design cannot be isolated from each other. Data mining and analytics will be a pivotal factor in web design: the data and design experts will collaborate frequently with end-users and the target audience at the center of development. Deciphering user preferences, predictive models, and forecasting trends will play a pivotal role in digital design.
Voice search is set to be an imperative cog in the wheel of SEO and SEM strategies. Conversational front-end attributes will be incorporated to ensure an interactive and satisfying user experience. In addition, the concerns pertaining to privacy, information safety, and compliance will be addressed with the introduction of a steady and secure structure.
Machine learning, deep Learning, and artificial intelligence (AI) will be important in the web design arena too. Automated web design is very much possible, mainly due to software-defined patterns. Enterprises will have more control on the design aspects, with less dependence on highly-skilled development staff. Developer tools will empower in-house staff to add custom features and code essential attributes easily, in conjunction with tailored modules for that niche/domain/platform.
The future of digital web design will be more inclined toward open-source platforms compared to premium, proprietary solutions. Currently, you see established and successful enterprises ruling the roost due to their excellent toolkits and portals. However, this defeats the purpose of the World Wide Web, which was not supposed to be dominated by constraints, monopoly, and technology bias. Industry standards will redefine set patterns to bring more consistency, leaning more toward open-source solutions and protocols—similar to the revolutionary thought processes that led to the Renaissance age and subsequent modernization of humankind in general. Also, data-driven AI design will transform common enterprise standards and lead to more uniformity across multiple domains.
Traditionally, JavaScript has been a front-end language, but lately it is being used for server-side programming due to its asynchronous nature and large concurrency capabilities. Reusable components, easy maintenance, and homogenous structures push the case further for total JavaScript adoption. Moreover, systems will get more resilient and the roadblocks associated with security and information safety will be tackled better in the coming years. Therefore, the use of JavaScript will be exponential in the next decade, making it an obvious choice for intuitive web development and design.
The preceding factors are personal predictions and may/may not be realized. In summary, the scope and reach of web design will broaden in conjunction with robotics, AI, and innovation. However, change will be the only constant and maybe the massive technological advances will open up a world of possibilities, akin to the age of the matrix ☺.
In this book, we learned about the various nuances of the Bulma framework, though we drifted into futuristic prototypes and situations in the end. The last chapter sheds light on the learning curve and situations that will change the way we live and how web design will adapt to those changes.
This book must have definitely helped you get to grips with the awesome Bulma framework. The deeper you delve into the intricacies of Bulma, the greater will be your appreciation for its power and usability. Thank you.