0

Here's my code. In the screenshot provided I included two situations in which me trying to reference the css style sheet does not work.

In the html, I used < body class="1" >. And then in the stylesheet I referenced it by saying body.1{}. This does not work. I tried making the background black and that won't show. Previously, I tried name it "home" instead of "1", that didn't work either. It also wouldn't let me set a background image in the css file so I had to add an image in the html instead.

The same things go for < body class="2" > and body.2{}.

enter image description here

Obsidian Age
  • 41,205
  • 10
  • 48
  • 71
  • Thank you for the response. Here is how I have the link formatted in the head. Is this correct? Or is there an error in how i'm linking it? – jdetlet Oct 09 '19 at 23:13

1 Answers1

0

You can't use numbers as class names.

"A valid name should start with an underscore (_), a hyphen (-) or a letter (a-z) which is followed by any numbers, hyphens, underscores, letters. A name should be at least two characters long. Cannot start with a digit, two hyphens or a hyphen followed by a number."

https://pineco.de/css-quick-tip-the-valid-characters-in-a-custom-css-selector/

Try something like:

a1 

Code pen for demonstration: https://codepen.io/jamiecalder/pen/rNNVgMj

Jamie Calder
  • 931
  • 7
  • 12
  • Thank you for the response, I'm going to implement this further and call it something like index. Changing the class name didn't work so I think i need to change "body". – jdetlet Oct 09 '19 at 23:34