tags:

views:

1331

answers:

4

If it said "oneword", then I could write "#oneword", but what do I write when there is a space in the word?

+14  A: 

You can't have multiple words for the id, but you can for class.

<p class="one two">lalala</p>

.one {
    color: black;
}

.two {
    font-weight: bold;
}
Philip Morton
+20  A: 

If it contains spaces, it is not legal HTML. You shouldn't expect this to work. Here is the relevant section of the HTML 4.01 specification.

[EDIT] As others have noted, you can get around this by assigning one or more class names to the div and using a class name to do the selection.

tvanfosson
+4  A: 

You should not use whitespace in the ID element, as whitespace is generally accepted as a selector combinator.

Aron Rotteveel
+1  A: 

Change it to two-words. Like others said, you cannot use spaces for the id, but you can for the class.

#two-words { font-family: arial; }
.center { text-align: center; }
.bold { font-weight: bold; }

<div id="two-words" class="center bold">STUFF HERE</div>
rodey