Different Methods of Bolding the p elements
Are you Not sure what is the correct CSS syntax for making all the p elements bold? You have come to the right place for that solution. I can give you a perfect solution to this problem. In this article, I will tell you how to make all p elements bold? and what is the correct syntax for this in CSS?
What is the correct CSS syntax for making all the <p> elements bold
To make all <p> elements display as bold, select p element using the element selector in CSS. Then set the CSS font-weight property and give it a value of bold or bolder. By default, all text inside the paragraph <p> element will be at normal font-weight. But by default all text in heading tags (ie <h1>-<h2>) is in bold font-weight. Normally we use only normal and bold values in the font-weight property.
If you select the p element using the element selector in CSS, all p elements you have given in HTML will be selected. Then whatever style you give, it will apply to all p elements. All p elements are selected even if you have placed your p element inside a div tag, span tag, or other tags. So, the correct CSS syntax for making all p elements bold, select the P element and give them font-weight: bold in CSS.
An example can be seen below:-
CSS:
p
{
font-weight:
bold; }
HTML:
<p>Paragraph number 1</p>
<p>Paragraph number 2</p>
<p>Paragraph number 3</p>
Output:
To bold a Specific <P> elements
If you have a situation where you need to bold only a specific paragraph element, You should give the same class name as the p element you want bolded. Then select the class selector in CSS and set the CSS font-weight property and give the value as “bold”. Since no element should have the same id name, the ID selector should not be used instead of the class selector. So, you should use the class as shown below the code.
Example code:-
CSS:
.para {
font-weight: bolder;
}
HTML:
<p class="para">Paragraph number 1</p>
<p>Paragraph number 2</p>
<p>Paragraph number 3</p>
<p class="para">Paragraph number 4</p>
Output:
To bold Specific words within the <p> element
If you want to bold specific words within the p element, you can use the <b> tag. You can put important words in the <b> tag or strong tag.
Example:-
HTML:
<p>This the <b>paragraph</b> 1.</p>
<p>This the <strong>paragraph</strong> 2.</p>
Output:
So, if you want to make all p elements boldĀ then you can use the CSS element selector to make them bold. If you want to make a specific p element bold then you can use the CSS class selector to make it bold. If you want to make specific words inside the p element bold, you can use <b> tag or strong tag to make them bold.