Connecting Tech Pros Worldwide Help | Site Map

Defining and using a class in CSS. About spaces

Newbie
 
Join Date: Sep 2009
Posts: 2
#1: Sep 24 '09
The question is about spaces.
1. If the code is:
<a class="title newProduct " href="clinicians_rem_sleep_60.html">test here</a>

Q. Is the class "title newProduct " recognised?
I ask this because it the two words are separated by a space and it has a trailing space.
I had always thought that the class name should contain no spaces at all!
cheers
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Sep 24 '09

re: Defining and using a class in CSS. About spaces


Quote:

Originally Posted by peterbiggs View Post

I had always thought that the class name should contain no spaces at all!

a class name must not contain any spaces, yet the code is correct. there simply are two classes.
Newbie
 
Join Date: Sep 2009
Posts: 2
#3: Sep 24 '09

re: Defining and using a class in CSS. About spaces


Thanks for that. I appreciate it! It's driven me crazy trying to find a tutorial that includes this issue.
So. Any leading & trailing spaces are then ignored, and the separating space(s) just 'separate' the two (in this case) class names.
That makes life easy then!
Reply

Tags
css spaces class