Solved

How do I highlight text in HTML as bold ?

Posted on 2013-01-08
11
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
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…

726 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