Mastering Bootstrap 4 - Second Edition
eBook - ePub

Mastering Bootstrap 4 - Second Edition

Benjamin Jakobus, Jason Marah

Buch teilen
  1. English
  2. ePUB (handyfreundlich)
  3. Über iOS und Android verfügbar
eBook - ePub

Mastering Bootstrap 4 - Second Edition

Benjamin Jakobus, Jason Marah

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Build responsive, dynamic, and mobile-first applications on the web with Bootstrap 4About This Book• Master the art of creating highly intuitive and responsive web interfaces with Bootstrap 4• Combine the power of Bootstrap and popular front-end JavaScript frameworks such as Angular and React to build cutting-edge web apps• Infuse your web pages with life and movement using Bootstrap jQuery pluginsWho This Book Is ForThis book targets readers who wish to leverage Bootstrap 4 to create responsive web applications. Basic knowledge of web development concepts and web technologies such as HTML, CSS, and JavaScript is required.What You Will Learn• Create a professional Bootstrap-based website from scratch without using third-party templates• Leverage Bootstrap's powerful grid system• Style various types of content and learn how to build a page's layout from scratch by applying the power of Bootstrap 4• Take advantage of Bootstrap's form helper and contextual classes• Improve your website's overall user experience with headers and footers• Infuse your web pages using Bootstrap jQuery plugins and create your own Bootstrap plugins• Learn what utility classes Bootstrap 4 has to offer, how they are implemented, and the best way to use them.• Create more advanced web interfaces by leveraging the power of accordions, dropdowns, and list groups.• Incorporate Bootstrap into an AngularJS or React application and use Bootstrap components as AngularJS directivesIn DetailBootstrap 4 is a free CSS and JavaScript framework that allows developers to rapidly build responsive web interfaces. This book will help you use and adapt Bootstrap to produce enticing websites that fit your needs.You will build a customized Bootstrap website from scratch, using various approaches to customize the framework with increasing levels of skill. You will get to grips with Bootstrap's key features and quickly discover various ways in which Bootstrap can help you develop web interfaces. Then take a walk through the fundamental features, such as its grid system, global styles, helper classes, and responsive utilities. When you have mastered these, you will discover how to structure page layouts, utilize Bootstrap's various navigation components, use forms, and style different types of content.Among other things, you will also tour the anatomy of a Bootstrap plugin, create your own custom components, and extend Bootstrap using jQuery. You will also understand what utility classes Bootstrap 4 has to offer, and how you can use them effectively to speed up the development of your website.Finally, you will discover how to optimize your website and integrate it with third-party frameworks.By the end of this book, you will have a thorough knowledge of the framework's ins and outs, and will be able to build highly customizable and optimized web interfaces.Style and approachA comprehensive, step-by-step guide to mastering the ins and outs of the Bootstrap framework to produce highly customizable, optimized, and sleek web interfaces.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Mastering Bootstrap 4 - Second Edition als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Mastering Bootstrap 4 - Second Edition von Benjamin Jakobus, Jason Marah im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Ciencia de la computación & Desarrollo web. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2018
ISBN
9781788838214

On Navigation, Footers, Alerts, and Content

In the previous chapter, we built our website's basic skeleton. Using Bootstrap's grid system, we structured our website into five distinct sections. We then styled these sections and learned how to use Bootstrap's navbar and tab system to make these sections navigable. In this chapter, we will continue adding to the knowledge obtained in Chapter 3, Building the Layout, by leveraging even more Bootstrap components, adding more content, and streamlining our website's design. We will begin by improving our navbar, and by first learning how to fix its position. We will then use a Bootstrap plugin (Scrollspy) to automatically update the navbar tab item appearance based on the user's navigation. Next, we will customize the website's scrolling behavior, making the transition between sections smoother.
Once we have improved our website's navigation, we will focus on improving and customizing our website's overall look and feel—that is, we will learn how to apply and customize alerts, and how to use buttons, brand images, form validation styles, and progress bars. We will also discover how to style different text elements, use media objects, and apply citations and figures.
As we progress through this chapter, we will be examining each of the aforementioned components individually. This way, we will have the chance to see how they are actually composed under the hood.
To summarize, we shall do the following in this chapter:
  • Learning how to fixate our navbar
  • Using the Bootstrap plugin Scrollspy to improve our website's navigation
  • Using icons to customize and improve the overall design of our website
  • Introducing Bootstrap alerts and customizing them
  • Styling our website's footer
  • Applying buttons to improve our website's overall usability
  • Learning about Bootstrap's form validation styles
  • Discovering Bootstrap's progress bar classes

Fixating the navbar

Our website already looks pretty decent. We have a navigation bar in place, a footer placeholder, and various sections populated with some sample content. However, we are not quite there yet. The website's overall user experience is still a bit edgy and does not yet feel very refined. Take navigation, for instance—while clicking on a navbar link does indeed take the user to the correct section, the navbar disappears once we navigate across the sections. This means that the navbar loses its purpose. It no longer facilitates easy navigation across the different sections of our website. Instead, the user will need to scroll to the top of the page every time they wish to use the navbar. To make the navbar persistent, append navbar-fixed-top to the class attribute of our nav element:
<nav class="navbar navbar-expand-lg navbar-myphoto fixed-top">
...
</nav>
Now save, refresh, and scroll. Voila! Our navbar now remains fixed at the top of our page. The fixed-top works as follows: the element's position is set to fixed. This positions the element relative to the browser window (not relative to other elements), meaning that the element will remain in the same place, regardless of the positioning of other elements on the page—that is, fixed navbars are pulled from the normal flow of the DOM and may require custom CSS.
Furthermore, the element's top is set to 0. This means that the distance between the navbar and the top of the browser window is 0. In addition, fixed-top also changes the element's z-index to 1,030, therefore ensuring that the element will appear above all the other elements on the page (that is, all elements that have a z-index of less than 1,030).
The fixed-top class is defined in _position.scss and looks as follows:
.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: $zindex-fixed;
}
Note: $zindex-fixed is defined in _variables.scss, and its default value is 1030.
Did you know that within web development, another term for persistent is sticky? For example, instead of asking "How can I make my navbar persistent?", you often hear people asking "How do I make my navbar sticky?". Note that position: fixed is not the same as position: sticky. The latter isn't fully supported in every browser.
Should you desire to fixate the navbar at the bottom of the page, you can use the fixed-bottom class. This class behaves in exactly the same way as the fixed-top class, except that instead of setting the element's top to 0, it sets the bottom property to 0, thereby ensuring that the element resides at the bottom of the page.

More on navbar styling

If we wanted to quickly change the color of the navbar without wanting to write a whole bunch of custom rules, then we could apply the navbar-* and bg-* classes:
  • navbar-dark: This is used to indicate that the navbar's foreground color should be adjusted to match a dark background. As such, the rule will apply a white foreground color to all navbar items.
  • navbar-light: This is the opposite of the aforementioned navbar-dark and applies a dark foreground color in order to support a light background.
  • bg-*: This will set the background color to that of the desired context class (we will cover the various context classes later on in this chapter); for example, bg-primary, bg-success, and bg-info; bg-dark mimics an inverted background, setting the background color to #343a40.
Take a look at figure 4.1:
Figure 4.1: The MyPhoto navbar with three dierent context styles: pg-primary, bg-warning, and bg-danger

Improving navigation using S...

Inhaltsverzeichnis