how to bold words within a paragraph in HTML/CSS?
Solution 1
<p><strong>This is in bold.</strong> This is not.</p>
You might find Mozilla Developer Network to be a very handy and reliable reference.
Solution 2
I know this question is old but I ran across it and I know other people might have the same problem. All these answers are okay but do not give proper detail or actual TRUE advice.
When wanting to style a specific section of a paragraph use the span tag.
<p><span style="font-weight:900">Andy Warhol</span> (August 6, 1928 - February 22, 1987)
was an American artist who was a leading figure in the visual art movement known as pop
art.</p>
Andy Warhol (August 6, 1928 - February 22, 1987) was an American artist who was a leading figure in the visual art movement known as pop art.
As the code shows, the span tag styles on the specified words: "Andy Warhol". You can further style a word using any CSS font styling codes.
{font-weight; font-size; text-decoration; font-family; margin; color}, etc.
Any of these and more can be used to style a word, group of words, or even specified paragraphs without having to add a class to the CSS Style Sheet Doc. I hope this helps someone!
Solution 3
<p><b> BOLD TEXT </b> not in bold </p>;
Include the text you want to be in bold between <b>...</b>
Solution 4
if you want to just "bold", Mike Hofer's answer is mostly correct.
but notice that the tag bolds its contents by default, but you can change this behavior using css, example:
p strong {
font-weight: normal;
font-style: italic;
}
Now your "bold" is italic :)
So, try to use tags by its meaning, not by its default style.
Solution 5
<style type="text/css">
p.boldpara {font-weight:bold;}
</style>
</head>
<body>
<p class="boldpara">Stack overflow is good site for developers. I really like this site </p>
</body>
</html>
user1111042
Updated on April 20, 2020Comments
-
user1111042 about 4 years
I am a beginner in web programming and have some very simple questions.
I'm trying to bold several words in one paragraph but I don't know how to do that using HTML/CSS. I've figured out how to bold entire paragraphs, but not individual words yet. How can I bold one word, like "bold" in my example?
This bolds an entire paragraph:
<html> <head> <style type="text/css"> p.n1 { font:15px bold 30px Georgia,serif; } </style> </head> <body> <p class="n1">I am in bold. </p> </body> </html>