- Read Tutorial
- Watch Guide Video
In this section, we are going through styling choices such as how to add emphasis or bold styling to content.
There are many ways to achieve this result; CSS is often preferred, but is saved for a later section..
As always, let's create a <div>
, and put a paragraph of text inside. To make the first word bold, just add a <b>
tag and close it off after "Lorem".
<p> <b>Lorem</b> 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. Duis aute irure <br>dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p>
The output will have the first word in bold.
Alternately, you can also use a tag called <strong>
instead of <b>
. If you refresh the browser, both the tags will produce identical results. However, there is a subtle difference between the two.
The <b>
tag simply shows the content inside of its tag in bold, whereas <strong>
is used to emphasize a specific word. This difference is particularly evident when using an older browser or by a person with seeing or interpreting disabilities. This means most people will not notice a difference, but it is beneficial to be aware that a difference exists.
Also, the <strong>
tag is relatively new, so it won't work in browsers that are more than a decade old, like IE 6. So, if you're building for older browsers, always use <b>
tag.