How To Make Bold Text HTML - Career Karma
Có thể bạn quan tâm
To make bold text in HTML you can use the <b> tag, the <strong> tag, or font-weight in CSS.
When you’re designing a web page, you may want to emphasize a specific piece of text.
Find your bootcamp match Select Your Interest Software Engineering Design Data Science Data Analytics Digital Marketing Cyber Security IT Support Specialist Your experience Beginner Intermediate Advanced Time to start Now 1 Months 3 Months 6 Months+ GET MATCHED By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email. XFind your bootcamp match
First Name Last Name Your e-mail Your phone number GET MATCHED By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.For example, let’s say you have a list of instructions on how to use a new piece of technology, and there is a security notice that is particularly important for the user to read. You may want to emphasize that notice to ensure that the user does not miss it when they’re reading the instructions.
In HTML, there are built-in functions that allow coders to embolden particular text. In this tutorial, we are going to break down the three most common ways to embolden text in HTML: the <b> tag, the <strong> tag, and the font-weight Cascading Style Sheets (CSS) parameter.
HTML <b> Tag
The most common way in which developers create emboldened text in HTML is through using the <b> tag. The <b> tag works to create an element that represents bold text on an HTML webpage. For example, a <b> tag can highlight subheadings in an online article.
Here is an example of the HTML <b> tag in action:
<b>This text is bold</b>It’s that simple. If you want to make a particular portion of text bold but leave the rest of a paragraph, you can enclose a <b> tag in a section as we do below:
<p>This text is not bold. <b>But this text is bold!</b></p>Here is the result of our code:
The start of our paragraph appears normal, and the text within our <b> tag has been emboldened.
HTML <strong> Tag
In addition, you can use the <strong> tag to create emboldened text in HTML. The <strong> tag is in exactly the same way as the <b> tag, with one difference: the strong tag indicates that its contents require special attention. Here’s an example of a <strong> tag being used:
<p>Your username for your new computer is <b>JohnAppleseed</b></p> <p><strong>Attention!</strong> You must change your password after logging in.</p>Our code returns the following:
As you can see, the <b> tag is being used to highlight text that the reader may want to read. The <strong> tag is being used to indicate that the word Attention should be given special attention by the reader. That said, aside from this difference, <b> and <strong> tags are the same.
CSS font-weight Property
The <strong> and <b> tags are used in vanilla HTML elements to indicate that text is important and should be read. However, there is also a CSS property that gives us more control over how our text appears: font-weight.
font-weight allows coders to determine how heavy or light — how bold — a particular portion of text appears. Here’s an example of the font-weight tag applied to a paragraph with the tag thick:
HTML:
<p>This is an example paragraph.</p> <p class="thick">This is a bold example paragraph.</p>CSS:
p.thick { font-weight: 900; }Our code returns the following:
In our example, we define a class called thick, which sets the font-weight property for our text to 900, meaning that the text where we reference the class thick will appear emboldened. It’s worth noting that we could customize the number “900,” depending on whether we wanted our text to appear lighter or bolder.
Alternatively, we could specify our font-weight using the style font-weight bold attribute, like so:
<p>This is an example paragraph.</p> <p style="font-weight:900;">This is a bold example paragraph.</p>Conclusion
Bold text is an important part of text formatting in HTML. If you need to call attention to a particular line of text or a few words, you may want to embolden it. In this tutorial, we have broken down the three main ways to embolden text: <b>, <strong>, and font-weight. Now you’re ready to create bold text like an expert!
Từ khóa » Html Bold Line
-
HTML Text Formatting - W3Schools
-
How To Draw A Bold Horizontal Line In Html\ Code Example
-
How To Bold, Italicize & Format Text In HTML - HubSpot Blog
-
How To Make Text Bold In HTML? - Tutorialspoint
-
Need To Bold One Line Of Text Using CSS And The Div Id Tag
-
Example: Bold, Italics, Case, And Line Height - HTML Dog
-
HTML - Bold - Tizag Tutorials
-
HTML Tutorial => Bold, Italic, And Underline
-
How To Highlight The First Line Of A Paragraph - Learn Web Development
-
Markdown For Jupyter Notebooks Cheatsheet - IBM
-
Font-weight - CSS: Cascading Style Sheets - MDN Web Docs
-
[PDF] Marking Up With HTML Tags For Bold, Italic, And Underline An HTML ...
-
Basic Syntax - Markdown Guide
-
How To Style A Horizontal Line - W3docs