Bootstrap/C2/Typography-in-Bootstrap/English
Title of the script: Typography in Bootstrap
Author: Neha Solanki
Domain Reviewer: Ankita Maske
Novice Reviewer: Abhijit Bonik
Keywords: Bootstrap, CSS, HTML, Web Page, Web Design, Web Technology, Video Tutorial, Spoken Tutorial, Typography in Bootstrap, Text Alignment, Text Transform, Font Weight and Italic, Text Decoration, Reset Color, Display headings
Visual Cue | Narration |
Slide: Title | Welcome to the Spoken Tutorial on “Typography in Bootstrap”. |
Slide 2:
Learning Objectives |
In this tutorial, we will learn how to use:
for styling and formatting text in Bootstrap. |
Slide 3:
System Requirements |
This tutorial is recorded using,
|
Slide 4: Prerequisite |
|
Slide: Layout
Image1.png |
In this tutorial, we will design a layout as shown here in Bootstrap. |
Slide: Text Alignment
[Image = left.png] [Image = right.png] [Image = center.png] [Image = justify.png] |
Let’s start with the text alignment.
Text can be aligned either to the:
|
Slide: Text Alignment Classes | These are the available classes for them:
|
Let’s use one of these classes in our layout. | |
Point to Mypage.html & Mystyle.css in My-bootstrap folder | Locate the files Mypage.html and Mystyle.css in the My-bootstrap folder.
We will use Mypage.html and Mystyle.css files which we saved earlier for this demonstration. |
Slide: Code Files |
|
Open Mypage.html in Firefox | Open the file Mypage.html in a web browser. |
[Firefox] | Notice that by default, the text is aligned to the left.
Let us change the text alignment of the first row to the center. |
Open Mypage.html in gedit | Open the file Mypage.html in the text editor.
I have opened it in the gedit Text Editor. |
[gedit - Mypage.html]
Update: <div class="row"> <div class="col m-sm-4 text-center"> <h1 class="text-danger"> Bharat Mart </h1> </div> </div> |
Add the .text-center class to the column of the first row as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox]
Highlight the output |
Observe that the text of the first row is aligned to the center now.
Try the other text alignment classes on your own later, for your understanding. |
Slide: Text Alignment Classes with Breakpoints | Also try text-left, .text-right and .text-center classes with breakpoints as shown below. |
Slide: Text Transform | Next we will explore text transform.
Basically, it manages the capitalization of text. |
Slide: Text Transform Classes
Example: uppercase.png lowercase.png capitalize.png |
These are the classes for it:
Let us try one of these. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <div class="row"> <div class="col m-sm-4 text-center text-uppercase"> <h1 class="text-danger"> Bharat Mart </h1> </div> </div> |
Add the .text-uppercase class to the column of the first row as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | Observe the first row. We can see all the letters are converted to uppercase.
Try the other text transformation classes on your own later for your understanding. |
Slide: Font Weight | Next, let’s understand about Font Weight.
Font weight specifies how thick the font of the text should be. |
Slide: Font Weight Classes | Following are the classes for it:
Let us try this. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <div class="row"> <div class="col font-weight-bold"> <div class="mx-auto" style="width: 140px; border: 2px solid green;"> Copyright- 2021</div> </div> </div> |
Add the .font-weight-bold class to the column of the last row as shown here.
In our code, we will increase the width of the block-level element to 140px. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | Observe the output.
The text is set to bold now. Try the other font weight classes on your own later, for your understanding. |
Let’s understand how to set the text to italic. | |
Slide: Italic | .font-italic class is used to set the text to italic.
Let us try this. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <p class="font-italic"> Buy your essentials at the lowest price. Choose from fresh produce to packaged goods and get them delivered straight to your doorstep. Shop for Rs.1000 and more to get FREE delivery. <p> |
Add .font-italic class to the paragraph in the second row as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | Now we can see that the text in the paragraph is set to italic. |
Slide: Text Decoration | Next we will learn about text decoration.
|
Switch to firefox | Switch to the browser. |
[Firefox] | Observe the links in the second row.
They are underlined when we hover the cursor over the words. We can use .text-decoration-none to remove this underline, if we wish to. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <ul> <a href="#" class="text-decoration-none"><li> Fruits & Vegetables </li></a> <a href="#" class="text-decoration-none"><li> Foodgrain </li></a> <a href="#" class="text-decoration-none"><li> Beverages </li></a> <a href="#" class="text-decoration-none" ><li> Personal care </li></a> <a href="#" class="text-decoration-none"><li> Snacks & Branded Foods </li></a> </ul> |
Add .text-decoration-none class to all the links in the second row as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | Observe the second row.
The underline of the links are now no longer visible. |
By default the color of the link is always set to blue.
But this can be changed to any other colour we like. | |
Slide: Reset Color | .text-reset class is used to change or reset the colour of a text or link. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <ul> <a href="#" class="text-decoration-none text-reset"><li> Fruits & Vegetables </li></a> <a href="#" class="text-decoration-none text-reset"><li> Foodgrain </li></a> <a href="#" class="text-decoration-none text-reset"><li> Beverages </li></a> <a href="#" class="text-decoration-none text-reset"><li> Personal care </li></a> <a href="#" class="text-decoration-none text-reset"><li> Snacks & Branded Foods </li></a> </ul> |
Add the .text-reset class to the links as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | In the output, the color of the links are set to the default black colour.
It has inherited the color from its parent. |
Slide: Display Headings | Next, let’s understand display headings.
|
Slide: Display Headings Classes
|
Following are display heading classes: |
Slide: Display Headings - Example
[display.png] Highlight h1 heading |
Note the difference between h1 heading and various other display heading classes. |
Only narration | Now let’s understand display heading classes with an example. |
Switch to Mypage.html | Switch to the Mypage.html file. |
[gedit - Mypage.html]
Update: <div class="row"> <div class="col m-sm-4 text-center text-uppercase"> <h1 class="text-danger display-4"> Bharat Mart </h1> </div> </div> |
Add the .display-4 class to the column of the first row as shown here. |
Press Ctrl + S | Save the file. |
Switch to firefox | Switch to the browser and refresh the page. |
[Firefox] | Observe that now the heading is slightly larger than normal heading.
Try out the other heading classes and observe the differences. |
Only narration | With this we have come to the end of this tutorial.
Let us now summarize. |
Slide 6: Summary | In this tutorial, we have learnt how to use:
|
Slide 8: Assignment | As an assignment-
|
Slide: About Spoken Tutorial project | The video at the following link summarises the Spoken Tutorial project.
Please download and watch it. |
Slide: Spoken Tutorial Workshops | The Spoken Tutorial Project team conducts workshops and gives certificates.
For more details, please write to us. |
Slide: Forum | Please post your timed queries on this forum. |
Slide: Acknowledgement | Spoken Tutorial project is funded by the Ministry of Education (MoE), Govt. of India. |
Slide: Thanks | This is Neha Solanki from Spoken Tutorial, IIT Bombay signing off.
Thanks for watching. |