Results 1 to 4 of 4

Thread: Add Bold and Italics to Text in CSS

  1. #1
    Join Date
    Feb 2009
    Posts
    62

    Add Bold and Italics to Text in CSS

    I am still learning CSS but have a concept of it for the moment. I needed to add bold and italics to my text so I added <b> and <i> tags and gave them each their own entry in the CSS style sheet file:

    Code:
    b {
    font-style:bold;
    }
    Doing this also made me fail the CSS certification too.To make a word bold, I currently have it like this: <p><b>bold text</b></p>. So what am I doing wrong here and how do I make it more proper. I read that <strong> and <em> tags were on the way out but have been told otherwise recently. You may be having an idea if you have seen the page of any web site which provide this kind of layout and can suggest me where can I use both currently.

  2. #2
    Join Date
    Dec 2008
    Posts
    183

    Re: Add Bold and Italics to Text in CSS

    The “bold” and “italic” HyperText Markup Language (HTML) elements, expressed as <b> and <i>, respectively, aren’t illegal. In fact they’re legal to use and have distinct semantic purposes. Whether to use them or not should be dictated by said purposes, and nothing else.That would be a presentational thing and that’s what your Cascading Style Sheet (CSS) is for.

    Now while it is very difficult to explored the semantic meaning of the bold and italic elements, I will say this now, “b” does not mean strong emphasis or importance; that’s what the “strong” element, written as <strong>, is for. I will also state that “i” does not indicate light emphasis, that’s what the “em” element, written as <em>, is for.

  3. #3
    Join Date
    Oct 2008
    Posts
    167

    Re: Add Bold and Italics to Text in CSS

    Yes, it's true that in the bad old days, programmers used the <strong> and <em> tags to mark headers, and yes it's true that that should stop (and should have stopped some years ago). If you're making a header, use a header tag, and use CSS (not <strong> and <em> tags) to define the visual appearance of your header.

    But <strong> and <em> have a proper use as content-bearing tags. The use of bold and italics is as intrinsic to the writing process as the use of all-caps was before bold and italics came on the scene. The <strong> and <em> tags, correctly used, are not formatting tags. They are content tags.

    we define the Testimonial class in our CSS file as follows :

    Code:
    span.Testimonial
    {
    font-style:italic;
    }
    Add another definition to the CSS file :

    Code:
    span.Testimonial i
    {
    font-style:normal;
    }

  4. #4
    Join Date
    Dec 2008
    Posts
    70

    Re: Add Bold and Italics to Text in CSS

    I had previously believed that both bold and italic were given extra weight, checking the authority reveals that only bold (and larger font) is given weight.

    I would assume that the developers realized fully well that <strong> and <b>, while conceptually distinct, are similar enough to be treated similarly. As far as we know currently Google ignores css.

Similar Threads

  1. Replies: 9
    Last Post: 13-11-2011, 03:51 PM
  2. Safari-All texts in italics
    By GunPower in forum Technology & Internet
    Replies: 6
    Last Post: 16-06-2011, 08:28 PM
  3. Fonts are displayed in italics in IE8
    By Shikamaru Nara in forum Technology & Internet
    Replies: 5
    Last Post: 15-04-2011, 11:22 AM
  4. internet explorer-9 has the default font as italics
    By Siketan in forum Technology & Internet
    Replies: 5
    Last Post: 16-03-2011, 10:02 PM
  5. Why Internet-fonts have turned italics?
    By Faakhir in forum Technology & Internet
    Replies: 3
    Last Post: 02-03-2009, 11:28 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,178,205.77716 seconds with 17 queries