I am using the following code
$("#numbers a").css({
"color":"whit开发者_StackOverflowe",
"text-decoration":"none",
"padding:":"5px"
});
The color and text-decoration change just fine, but the padding is not added to the element. How should I fix this?
You have a stray colon in your padding
property which is causing it to not be recognized:
"padding:":"5px"
Remove it and it should work:
"padding":"5px"
In the : is just a typo in to your post, you might be confused with padding and inline elements.
Your selector "#numbers a"
hints you are referencing an anchor tag. An anchor tag is an inline element and inline elements do not have padding on all sides. Nice article on padding|widths with inline elements
精彩评论