Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to bold words within a paragraph in HTML/CSS?

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>
like image 369
user1111042 Avatar asked Jan 30 '12 01:01

user1111042


People also ask

How do you make text bold in a paragraph in CSS?

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.”

How do I make h1 bold in CSS?

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.

How do you italicize one word in HTML?

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.

How do we make the text bold within a paragraph in latex?

To make a text bold use \textbf command: Some of the \textbf{greatest} discoveries in science were made by accident.


3 Answers

<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.

like image 135
Mike Hofer Avatar answered Oct 09 '22 00:10

Mike Hofer


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!

like image 41
Michael Anderson - NinjaSush2 Avatar answered Oct 08 '22 23:10

Michael Anderson - NinjaSush2


<p><b> BOLD TEXT </b> not in bold </p>;

Include the text you want to be in bold between <b>...</b>

like image 8
user1177371 Avatar answered Oct 09 '22 00:10

user1177371