Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Question about styling

  1. #1
    Dre
    Dre is offline
    Member Dre's Avatar
    Join Date
    May 2009
    Posts
    229

    Default Question about styling 13 Jul 2009 @ 03.20

    Firefox complains about me writing like I am still doing basic html instead of css.......styling issues.

    What I keep trying to figure out is how to do little things. I understand how to create a style and add it to my stylesheet, but I am talking about something different.

    For instance. Here is an example:

    [FONT=Century Gothic][SIZE=4]I write a sentence.[/SIZE][/FONT]

    Now, I know how to apply a style to the whole sentence by writing it on my stylesheet. However, in order to make the word "sentence" in a red font and maybe a different font and keep it in the same sentence then how do I do that?

    Because the only way I know how to create styles is either by applying the same style to the entire paragraph, or inserting styles into my <body> where they do not belong.
    Last edited by Dre; 13 Jul 2009 at @ 03.22. Reason: I should say "the" <body>, not "my" <body>. LOL!
     

  2. #2
    Senior Member CloudedVision's Avatar
    Join Date
    Jan 2009
    Posts
    824
    Blog Entries
    4

    Default 13 Jul 2009 @ 03.29

    Well, first, inline styles are not evil or anything. If you have one instance of a style within in an entire website, feel free to use inline styling for it.

    You would wrap the the red word in <span> tags, that won't cause a newline.
     

  3. #3
    Member edbr's Avatar
    Join Date
    Jun 2009
    Posts
    31

    Default 13 Jul 2009 @ 05.45

    you could also define in your style sheet as a class
    .red{ color:#8B0000; }
    then use <span class="red">Sentence</span>
     

  4. #4
    Trusted Guru saltedm8's Avatar
    Join Date
    Jun 2011
    Posts
    1,969
    Blog Entries
    3

    Default 13 Jul 2009 @ 10.10

    I would agree with edbr, I would not use inline styles unless it really is needed,, so, span is my choice
     

  5. #5
    Senior Member Jason's Avatar
    Join Date
    Dec 2008
    Posts
    911

    Default 13 Jul 2009 @ 11.11

    Salted and edbr are on the right track, you do not need inline styles for anything. You can use classed span like edbr's example or you can use a semantic tag such as em.

    Code:
    then use <em>Sentence</em>
    Code:
    em {
      font-style:normal;
      color:red;
    }
     

  6. #6
    Senior Member CloudedVision's Avatar
    Join Date
    Jan 2009
    Posts
    824
    Blog Entries
    4

    Default 13 Jul 2009 @ 15.51

    Ok, guess I'm wrong lol.

    You can use <em>, but remember: Only use <em> for emphasized text, just like you only use <strong> for bold text. More info on phrase tags at HTML em, strong, dfn, code, samp, kbd, var, cite tag
     

  7. #7
    Trusted Guru saltedm8's Avatar
    Join Date
    Jun 2011
    Posts
    1,969
    Blog Entries
    3

    Default 13 Jul 2009 @ 16.02

    quote
    Ok, guess I'm wrong lol.

    You can use <em>, but remember: Only use <em> for emphasized text, just like you only use <strong> for bold text. More info on phrase tags at HTML em, strong, dfn, code, samp, kbd, var, cite tag
    Originally Posted by CloudedVision View Post
    yes, that s why I would use the span tag, even though the span tag should be avoided wherever possible.
     

  8. #8
    Senior Member Jason's Avatar
    Join Date
    Dec 2008
    Posts
    911

    Default 13 Jul 2009 @ 16.18

    Regarding em, emphasized doesn't have to be italic, it be anything that emphasis's something, I see no harm in using a color and stripping away the italic styling. It is usually best to keep strong bold
     

  9. #9
    Trusted Guru saltedm8's Avatar
    Join Date
    Jun 2011
    Posts
    1,969
    Blog Entries
    3

    Default 13 Jul 2009 @ 16.54

    its not the way it looks on screen that would be the problem mate, its the way search engines read it.. using <em> on something ( or any tag for that matter ) just to style it can have an impact on seo.. its called semantic coding ...
     

  10. #10
    Trusted Guru WelshStew's Avatar
    Join Date
    Dec 2008
    Posts
    2,555
    Blog Entries
    3

    Default 14 Jul 2009 @ 09.18

    quote
    Regarding em, emphasized doesn't have to be italic, it be anything that emphasis's something, I see no harm in using a color and stripping away the italic styling. It is usually best to keep strong bold
    Originally Posted by Jason View Post
    Yep I would totally agree with that.

    Glynn, this is semantic coding, using the right tag to emphasis a point within the sentence. I don''t think Jason is saying to use this to fool the search engines, but there is no hard and fast rule to say that <em> has to be italicised or cannot be styled to your own website look and feel.

    As with everything, as long as you don't overdo it and it is done within the correct structural markup, I don't think this is an issue.
     

Page 1 of 2 12 LastLast

Similar Threads

  1. styling empty p tags
    By sudhakararaog in forum HTML & CSS
    Replies: 4
    Last Post: 11 Jan 2013, @ 12.41
  2. Styling the Menu/NavBar
    By Wrams in forum HTML & CSS
    Replies: 21
    Last Post: 6 Dec 2011, @ 13.01
  3. styling table cell
    By sudhakararaog in forum HTML & CSS
    Replies: 2
    Last Post: 13 Jun 2011, @ 08.46
  4. styling iframe
    By sudhakararaog in forum HTML & CSS
    Replies: 1
    Last Post: 7 Dec 2010, @ 01.38
  5. styling table rows inside a div
    By sudhakararaog in forum HTML & CSS
    Replies: 3
    Last Post: 6 Oct 2009, @ 12.50

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •