TiraULTI
TiraULTI

Reputation: 199

Set a single word many times to bold

I am making a simple webpage project with 4 HTML5 pages, and 2 CSS stylesheets.

I need the specific word "Arduino", that is repeated many times along all the pages, to be always showed in bold.

Is there any practical way to do it other than:

 <strong>Arduino</strong>

Upvotes: 0

Views: 687

Answers (5)

the12
the12

Reputation: 2425

You could set the font weight bold in CSS to whatever element in

i.e.:

<span id = "sometext"> Some Text </span>

CSS: 
#sometext{
font-weight:bold 
/* This can also be set to a px if you want a specific value i.e.: 20px */
}

OR

Use the <strong> tag to indicate if the text has significant meaning, or use the <b> tag if it does not.

Upvotes: 0

Heady
Heady

Reputation: 985

Assuming strong is displayed as bold (if not use CSS):

Using jquery:

$("body").html(html.replace("Arduino", "<strong>Arduino</strong>")

Upvotes: 1

MD Ashik
MD Ashik

Reputation: 9845

Very simply way you can solve it. Just add this jQuery code:

Live view

$(document).ready(function(){
   // we define and invoke a function
    $("div").text(function () {
      $("body").html($("body").html().replace(/Arduino/g,'<b>Arduino</b>'));
    });

});

Upvotes: 1

selami
selami

Reputation: 2498

You can use JavaScript.

On document load, replace all strong words and change innerHTML of the article.

var article = document.getElementById("content");

article innerHTML = article innerHTML. replace(/strongWord/g, "strongWord");

Upvotes: 0

Rose Robertson
Rose Robertson

Reputation: 1256

You need to either always wrap the word in a tag (strong might make sense, but could be a span or whatever as well) so that it can be modified by css, or you would have to use javascript to parse the document and wrap it in a tag for you after the fact, and then, again, style that tag with css so that it is bold.

Upvotes: 1

Related Questions