To remind me the shorthand syntax of the border property, my technique was to think about Metal Gear Solid.
Because, 1px solid black is like Metal Gear Solid, isn't it? 😅
To remind me the shorthand syntax of the border property, my technique was to think about Metal Gear Solid.
Because, 1px solid black is like Metal Gear Solid, isn't it? 😅
When I started learning JavaScript, I mean jQuery, there are things I didn't understand.
One of this thing was the method $(selector).css();
.
I don't use it anymore, #separationOfConcern, preferring HTML classes, but hey, changing style when user click on a button is something very cool.
One thing I didn't understand at first, and that I have noticed very recently was the stuff we pass to the method.
What is this weird syntax $(selector).css({backgroundColor: 'red', borderLeft: '1px solid black' });
?
Why there are uppercases, braces, when we can pass directly the CSS like this $(selector).css('background-color', 'red');
?
When you dig into the property of DOM, you notice that it was written in camel case. And of course, we can pass to the jQuery method css
, either a string, an array or an object.
And this something I learned later. At first, the only thing that interested me was to turn my background color in red. And it din't matter, you learn the way you learn. 😅