Code
Bootstrap 4 allows for single lines of code to be formatted using the code
element or code
class. By applying this class, Bootstrap gives the element some extra padding, decreases the font-size of the text contained within the element, applies a border radius, and changes the foreground and background color:
<code> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </code>
Refer to Figure 8.11 to see the class in action:
Figure 8.11: Text rendered using the code element; note how the class is intended only to be used with single lines of code
To format blocks of code (that is, multiple lines), the pre
element or class should be used. This class does the following:
Sets the
display
property toblock
Reduces the font size
Changes the foreground color toÂ
#212529
Adjusts the element's margin
<pre> Lorem...