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>
To bold the text in HTML, use either the strong tag or the b (bold) tag. Browsers will bold the text inside both of these tags the same, but the strong tag indicates that the text is of particular importance or urgency. You can also bold text with the CSS font-weight property set to “bold.”
Yup, h1{ font-weight: bold; } Works! but font-weight with values 100, 200, 300, 400, 500, 600, 700, 800 to 900 doesn't work (probably anymore, it it used to) for heading tags.
To make text italic in HTML, use the <i>… </i> tag or <em>… </em> tag. Both the tags have the same functioning, but <em> tag is a phrase tag, which renders as emphasized text.
To make a text bold use \textbf command: Some of the \textbf{greatest} discoveries in science were made by accident.
<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.
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!
<p><b> BOLD TEXT </b> not in bold </p>;
Include the text you want to be in bold between <b>...</b>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With