+ 1
Coding
What do I do to my rubbish coding page to make it good https://sololearn.com/compiler-playground/WLAAte16Y4SD/?ref=app https://sololearn.com/compiler-playground/WLAAte16Y4SD/?ref=app
4 Answers
+ 5
Where is your javascript? Nothing will happen without it
Also you will need to separate your functions with a semi-colon â;â not a comma â,â
Also your css is not using the same class names as your html elements
I see that you are taking the web development course, which is great. But you shouldnât try to code things that you donât know. It would be much better to add a little at a time to your code as you learn the new concepts.
+ 2
Innocent Agoha Zvi touched on lot of your issues.
Also be aware that class attribute values with spaces are treated as multiple classes.
EXAMPLE
<div class ="right hand"></div>
is treated as belonging to 2 classes - "right" and "hand"
If you wanted only one class, use camel case (rightHand) or snake case (right_hand) for the class name.
0
https://sololearn.com/compiler-playground/WtEtjmcdNY6C/?ref=app
This is the finished code with JavaScript
0
Innocent Agoha
Couple items to fix:
đ leftover tags at end of your HTML
đ avoid using "var" to declare variables in JS. It gives variable global scope. You should use "const" or "let" instead to limit variable to local scope.
Some improvements you could make:
đ Use #ids for CSS applied to only one element, and .classes for CSS applied to multiple elements.
đ Can also use combinator selectors to apply rules to multiple elements.
đ I changed your body parts from classes to ids.
đ I consolidated CSS common to all body parts in "good" class, and used "#sign > .good" selector - all good class children of sign id element
đ I consolidated all toggle CSS rules into single "evil" class, and used "#sign > .evil" selector
đ I consolidated all JS functions into single function.
It finds the #sign element, and then loops over all its children, toggling "evil" class for each.
https://sololearn.com/compiler-playground/Wh07ENC4v8sk/?ref=app