Jump to content

CSS Selectors

Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

CSS Selectors Rate Topic: -----

#21 User is offline   Catalyst 

  • Codesmith
  • Group: Administrators
  • Posts: 1,049
  • Joined: 04-April 06
  • Gender:Male
  • Location:San Diego

Posted 30 November 2006 - 07:02 PM

I'd just add that in addition to indentation (and a good editor will take care of that for you) I'd recommend using meaningful names for objects and classes.

You'll often see things like id="ccf" or class="rbwt" which would be better written as id="CenterColumnFooter" and class="RedBorderWhiteText"
0

#22 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 30 November 2006 - 07:26 PM

View PostCatalyst, on Nov 30 2006, 07:02 PM, said:

I'd just add that in addition to indentation (and a good editor will take care of that for you) I'd recommend using meaningful names for objects and classes.

You'll often see things like id="ccf" or class="rbwt" which would be better written as id="CenterColumnFooter" and class="RedBorderWhiteText"


Red Border White Text?! What kind of meaning is that? A meaningful name would describe the content, not the appearance. What if you wanted to change to Red Text and White Border? Are you going to go back and change each instance of "RedBorderWhiteText" to "WhiteBorderRedText".

I agree that you should label things meaningfully, I just disagree with the example.

Also, I would suggestnot to use uppercase letters in class names. Instead of "CompanyName", it would be better as "company-name". This will avoid problems with case-sensitivity. [That is gleaned knowledge, but I can't remember where I read that... This article mentions it, but is not this is not the article I am recalling.]

Related: http://www.456bereastreet.com/archive/2005..._tricks_part_1/
0

#23 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 30 November 2006 - 09:06 PM

Good points there TJ. And I can speak from experience on the case-sensitivity issue, it burned me more than once.
Posted Image
0

#24 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 30 November 2006 - 11:08 PM

I've also learned the hard way, but I'm referring to class or id naming schemes. In the past, I would create them as in Catalyst's example (sorry man, I'm not picking on you!), and as mentioned by TJ, I would later change the style; at which point it's descriptive name became a pile of poop.

So one more vote for your class or id describing the content and not the style.
0

#25 User is offline   Catalyst 

  • Codesmith
  • Group: Administrators
  • Posts: 1,049
  • Joined: 04-April 06
  • Gender:Male
  • Location:San Diego

Posted 01 December 2006 - 12:20 AM

Note to self: put more effort into examples
0

#26 User is offline   benbacardi 

  • Administrator
  • Group: Administrators
  • Posts: 1,140
  • Joined: 06-April 06
  • Gender:Male
  • Location:United Kingdom

Posted 01 December 2006 - 03:40 AM

On the case-sensitivity issue, I just have a convention that I stick to regardless. If its one word its lower case, more than one and I write it like companyName, first one lowercase others not. I follow the same conventions in my scripting code for function names etc :)
0

#27 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 01 December 2006 - 08:38 AM

View Postbenbacardi, on Dec 1 2006, 03:40 AM, said:

On the case-sensitivity issue, I just have a convention that I stick to regardless. If its one word its lower case, more than one and I write it like companyName, first one lowercase others not. I follow the same conventions in my scripting code for function names etc :)

That is exactly how I do it with my classes and IDs. With my image and document file names, it's always 'image-name.jpg' and 'privacy-policy.php'.
0

#28 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 01 December 2006 - 11:17 AM

View Postherkalees, on Nov 30 2006, 08:55 PM, said:

moojoo's way is certainly helpful and thorough, but I'm afraid I don't have the patience to write all that ;)


Thats why I have a snippet set up in skEdit to do it then I can change the id names etc as needed. :blush: It come sin very handy if several people need to work on your code and/or a project gets put on hold for a while and you come back to it after a few others. One does not always remember why/how/when they did a specific thing etc. And for me at least it gives me info I need without having to pull the css doc or whatever. Sure takes a few secs to write out but the time it saves is way more. But I am a code nazi so there!

This post has been edited by moojoo: 01 December 2006 - 11:19 AM

Its not girly, its web 2.0!
0

#29 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 01 December 2006 - 11:30 AM

I don't do an opening comment, but I have started doing the closing comment which is where it gets harder to identify quickly -- plus you can use find to jump right too it.
<div class="article">
	 <h2>Title</h2>
	 <p>Some content here........</p>
</div>
<!-- end article -->


This has become a recent practice of mine.

I have also started doing my filenames that way. Makes things easy to understand/remember doesn't it?
0

#30 User is offline   sypher 

  • the owner3r
  • Group: Administrators
  • Posts: 1,578
  • Joined: 04-April 06
  • Location:North Wales, UK
  • Interests:Art, Boxing, MMA, Graphic Design, Web Design etc. ;)

Posted 01 December 2006 - 04:28 PM

I do alot of commenting in my php/actionscript files but not really in the html.

I also use the functionName style, i think thats standard practice in most coding languages?
sypher design - North Wales Web Design | Latest Work: - Scala Cinema

CSS - Can't See Sh*t
0

#31 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 04 December 2006 - 01:21 PM

fooFarghHippySkunk is how it goes.. lowercase then capitalizing every first letter after is the norm.

This post has been edited by moojoo: 04 December 2006 - 01:21 PM

Its not girly, its web 2.0!
0

#32 User is offline   lwaxhaxnc 

  • W.R. Private
  • Group: Members
  • Posts: 14
  • Joined: 24-September 11

Posted 24 September 2011 - 01:18 PM

Thanks for finding it and posting it! Once IE7 becomes "the norm", I know I'll be using more of these to my advantage. :)
0

#33 User is offline   webdesigner12345 

  • W.R. Private
  • Group: Members
  • Posts: 16
  • Joined: 27-September 11

Posted 27 September 2011 - 10:13 AM

Web Design Philippines develop high quality websites for businesses and individuals at affordable prices.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users