• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

How do I highlight text in HTML as bold ?

Hi,
I'm trying to highlight text on a web page in a bold font but despite using the HTML <B> tag it doesn't render on the page.
I'm using CSS to create the page and its elements in a stylesheet as follows :

p {
font-family: Calibri, Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:lighter;
color:#333333;
}

In my HTML page my script looks as follows :

<p>The most important feature is <b>the primary case</b></p>

But the bold tag doesn't render in IE8.

How do I create an inline style for this text item ?

Many thanks
Toco
0
Tocogroup
Asked:
Tocogroup
  • 5
  • 3
  • 2
  • +1
1 Solution
 
Kyle HamiltonData ScientistCommented:
instead of <b> which is deprecated, use <strong>. you can also specify rules for strong in your css

strong{
font-weight:bold;
color:#000;
}
0
 
TocogroupAuthor Commented:
Excellent !
Thank you very much

PS I must really update my HTML knowledge !
0
 
Dave BaldwinFixer of ProblemsCommented:
The bold tag <b> works fine in IE8... unless someone has redefined it.  I maintain a couple of web sites where that has been done and it is very irritating to work around where someone has 'redefined' standard tags.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tel2Commented:
Hi Dave,

When you say "redefined', you're talking via CSS, right?  (I don't know of any other way, but HTML is not my specialty.)

Yes, it's irritating when someone redefines such tags.  Maybe they think "this tag is deprecated, so I'll make sure it can't be used (as it previously could be) anymore, forcing people to do it the new ways".  8(
0
 
Kyle HamiltonData ScientistCommented:
there is no reason to believe that the b tag in this instance was redefined. and yes, in ie 8 it should work.

its still better to bring your html up to date, and there is nothing wrong with specifying custum rules for existing tags. thats what css is for. if the b tag was redefined not to your liking you can always find the rules very quickly with firebug or whatever tool of your preference.

not a big deal.
0
 
tel2Commented:
Hi kozaiwaniec,

Good points, but...
> there is no reason to believe that the b tag in this instance was redefined. and yes, in ie 8 it should work.

If it hasn't been redefined, then why else do you think IE 8 (or whatever) might not render it in the default way?
0
 
Kyle HamiltonData ScientistCommented:
who knows... could be lots of things - without seeing the page I couldn't tell you

doctype, scripts, invalid markup, other errors... ???
0
 
Dave BaldwinFixer of ProblemsCommented:
Yes, via CSS.  The sites I was talking about having this master CSS file that redefines a number of things.  I can only suppose it was another case of a 'clever' developer making life difficult for anyone who replaced him.
0
 
Kyle HamiltonData ScientistCommented:
Dave,

are you talking about a "reset" file? Sometimes there's good stuff in those that normalizes appearance across browsers - especially form elements. But I agree, not everything - you have to cherry pick.
0
 
Dave BaldwinFixer of ProblemsCommented:
Nope, not an Eric Meyer reset.  The owner of the website likes including the CSS file even very little of it is being used.  Here's the first few lines.  Some is normal, some a little odd.  I would not normally (outside of a reset) universally define things this way.  There are id's and classes in the rest of the file but it is not particularly organized.  I think someone just found this somewhere and decided it was "A Good Thing".
body {background-color:#FFFFFF;margin:0}
body, td, table, input, select, textarea, div {color:#111111;font-family:verdana,arial,sans-serif;font-size:9px;}
form {margin:0;}
input {padding:0px;font-size:9px;}
a:link, a:visited {color:#333333;text-decoration:none;}
a:hover {text-decoration:underline;}
b {font-weight:normal;}
img {border:0}
img.block {display:block;}
ul {margin:0; padding:4px 0 5px 0;}

Open in new window

0
 
Kyle HamiltonData ScientistCommented:
yeah, that doesn't look like a reset.

the most egregious stuff in that set would be the b{ font-weight: normal}, because it's counter intuitive, and the very specific padding on something as global as a ul. The other stuff is understandable - though it depends on wether the site design really follows those rules.

I guess sometimes people take an existing code base and tweak it, cause they don't know how to start from scratch. But what's worse, they don't understand what they're tweaking. oh well...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now