SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Coding Style

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    USA
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding Style

    I'm planning to make a webpage where a section of the content will have text that uses a lot of different font colors. Is there a "good" way to do this or will I just end up using a lot of <span class="red">, <span class="blue">, etc.?

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use tags that semantically represent their content.

    There are loads of different tags you could use to represent different types of text: <pre>, <code>, <samp>, <cite>, <var> - would any of those be useful? Otherwise, yes use different spans if there is no semantic reason for all the different colours.

  3. #3
    SitePoint Enthusiast Mikeymoo's Avatar
    Join Date
    Jul 2003
    Location
    St. Albans, Uk
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It depends on what you want to do.. But using the spans are great if you do not get the colour right first time or you feel you want to change the colours later.

    If the colours are going to be on certain elements only, you could assign the colour to that element.

    One design I'm currently working on requires the colours to change depending on the section of the site you're in.

    So I've created a set of palettes, ie "fresh" "calm" etc and attach these to the relevent pages after the main sheet to change the colours.
    Mikel
    Good decisions come from experience.
    Experience comes from making bad decisions.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    USA
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The content will be logos for different groups that consists of a lot of different colors within each logo. So using existing tags won't work. I guess using a bunch of span colors is it.

    Thanks for the help.

    BaenSidhe

  5. #5
    Phil fillup07's Avatar
    Join Date
    May 2002
    Location
    Jacksonville, FL
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the purpose of staying away from class names such as "red", you could always assign an number class to it. It wouldn't be the easiest to remember, but if the colors will ever change it'd be better than using a color name:

    <span class="section1"></span>


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
  •