Solved

How do I highlight text in HTML as bold ?

Posted on 2013-01-08
11
337 Views
Last Modified: 2013-01-08
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
Comment
Question by:Tocogroup
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 500 total points
ID: 38756977
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
 

Author Closing Comment

by:Tocogroup
ID: 38757005
Excellent !
Thank you very much

PS I must really update my HTML knowledge !
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38757056
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 12

Expert Comment

by:tel2
ID: 38757108
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
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38757201
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
 
LVL 12

Expert Comment

by:tel2
ID: 38757230
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
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38757257
who knows... could be lots of things - without seeing the page I couldn't tell you

doctype, scripts, invalid markup, other errors... ???
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38757390
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
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38757426
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
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38757501
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
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38757574
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question