If it said "oneword", then I could write "#oneword", but what do I write when there is a space in the word?
Yes, yes you can.
CSS ID selector To use an ID selector in CSS, you simply write a hashtag (#) followed by the ID of the element. Then put the style properties you want to apply to the element in brackets.
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
Class names can be one or multiple words. If your class name is multiple words, use hyphens where you would put spaces.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With