Make one word a different style than the rest of the sentence

Permalink 1 user found helpful
Simple question regarding this sample sentence: "The cat jumped over the boy."

Assume I'm writing in Heading 3 but wanted one word--"jumped"--to be in H2, how could I do that? When I try to highlight "jumped" and make it H2, all the words follow suit. But I *just* want the word "jumped" to stand out as H2.

Possible?

View Replies: View Best Answer
weyboat replied on at Permalink Reply
weyboat
One way would be to write it in html like this
<h3>The cat <span style="font-size:20px; font-weight:bold">jumped</span> over the boy</h3>

Just make sure the span style matches your h2 style
jbx replied on at Permalink Best Answer Reply
jbx
Basically as weyboat said above.

The reason you do it like this, is that tags like h2, h3 etc, should not be used to style your document.

You should use them semantically, so your first header on the page would be h1 and your sub headers would be h2 - etc..

You then use css to style your headers.

So to answer your particular example, where you just want to add some emphasis within your h3 tag, I would do the following:

<style type="text/css">
h3 {
  font-weight: normal;
  font-size: 14px;
}
h3 em {
  font-weight: bold;
  font-size: 16px;
  font-style: normal;
}
</style>
<h3>The cat <em>jumped</em> over the boy</h3>


This means you have semantically emphasized the word 'jumped' AND made it bigger and bolder...

Hope that helps,

Jon
ryejoe replied on at Permalink Reply
Ok, this is like a new language for me.

But with time I hope to pick up these tricks. Thanks for taking the time.