www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > CSS

    CSS Discussion and technical support relating to Cascading Style Sheets.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-19-2009, 09:53 PM
    dmaher dmaher is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 6
    custom selectors ?

    Hi, sorry for the newbie question, I'm new to all this but having a go.

    What I'm trying to achieve is extremely simple, essentially I just want a part of some text in the footer a certain colour. I thought acc, for accent might be a reasonable name for it.

    I tried this:

    Code:
    acc{color: #6600FF; clear:both;}
    and then in my footer.php,

    Code:
    A <acc>quick</acc> brown fox jumps over the lazy dog.
    Now that works in FF, however the validator didn't really like it. It said acc not defined.

    So I changed it to a class so:

    Code:
    .acc{color: #6600FF; clear:both;}
    and

    Code:
    A <span class="acc">quick</span> brown fox jumps over the lazy dog.
    That also works and the validator seems okay with it, which is all good.

    However it got me wondering, can you not have 'custom' selectors similar to say p or h1 etc. and I have to make it a class and use the span tags every time ?
    Reply With Quote
      #2  
    Old 11-19-2009, 10:18 PM
    ssystems ssystems is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 278
    Yes you can. Create a custom DTD and use it as your doctype. However, this SHOULDN'T be done. If you've been in the industry long enough you'll recall that the one of the objectives why the W3C was formed was to avoid just anyone creating their own elements (standardization). Your the only one that knows the meaning of your element.
    __________________
    Good Luck

    Santos Systems
    Reply With Quote
      #3  
    Old 11-19-2009, 10:22 PM
    dmaher dmaher is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 6
    Quote:
    Originally Posted by ssystems View Post
    Yes you can. Create a custom DTD and use it as your doctype. However, this SHOULDN'T be done. If you've been in the industry long enough you'll recall that the one of the objectives why the W3C was formed was to avoid just anyone creating their own elements (standardization). Your the only one that knows the meaning of your element.
    So best practice is to use the span tags ?
    Reply With Quote
      #4  
    Old 11-19-2009, 10:23 PM
    ssystems ssystems is offline
    Registered User
     
    Join Date: Oct 2009
    Posts: 278
    Quote:
    Originally Posted by dmaher View Post
    So best practice is to use the span tags ?
    Yes.
    __________________
    Good Luck

    Santos Systems
    Reply With Quote
      #5  
    Old 11-23-2009, 05:30 AM
    dmaher dmaher is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 6
    Thanks for your help. Haven't exactly been in the industry... my qualifications are in comms cabling.
    Reply With Quote
      #6  
    Old 11-23-2009, 08:43 AM
    Charles's Avatar
    Charles Charles is offline
    JavaScript Banned
     
    Join Date: Nov 2002
    Location: Baltimore, Maryland
    Posts: 11,730
    But before you use the SPAN tag, ask your self "What am I trying to say?" Chances are that if you are trying to make some text stand out then you are trying to emphasize that text then you should use EM of STRONG. Only use SPAN as a last resort and then give it a class with a name that describes why you are setting that text apart.

    http://www.w3.org/TR/html4/struct/text.html#h-9.2.1
    __________________
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Reply With Quote
      #7  
    Old 11-24-2009, 02:31 AM
    dmaher dmaher is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 6
    It's to apply a certain colour to words, in line with one of the main colours used on the site to make them stand out. So I would like any changes to that colour reflected across the site, if the colour scheme is changed or altered slightly.

    Isn't strong more akin to bold ?
    Reply With Quote
      #8  
    Old 11-24-2009, 03:34 AM
    Fang's Avatar
    Fang Fang is offline
    Resistance is futile
     
    Join Date: Apr 2003
    Location: Netherlands
    Posts: 18,435
    It's a question of how much emphasis is required.
    __________________
    At least 98% of internet users' DNA is identical to that of chimpanzees
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:31 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.