PixelatedOrange Posted July 26, 2022 Share Posted July 26, 2022 Hi all. Newbie here so apologies for the basic question. I'd like to add margin-top to an element I'm animating, but when I use margin-top: '50px' it doesn't work - my error console shows...Unexpected token '-'. Expected a ':' following the property name 'margin'. What's the correct way to do this please? Thanks in advance. Link to comment Share on other sites More sharing options...
Solution Cassie Posted July 26, 2022 Solution Share Posted July 26, 2022 Hey there, no worries, this tripped me up back in the day too. It's a common mistake ☺️ You have to camelCase your CSS properties, so margin-top would become marginTop Hope this helps! 1 Link to comment Share on other sites More sharing options...
PixelatedOrange Posted July 26, 2022 Author Share Posted July 26, 2022 Ahhhh, perfect, thank you Cassie Learnt a whole new term today hahaha, been coding for 10 years, never heard of the term camelCase. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now