This course is out of date and does not reflect our standards or industry best practices. We now recommend you take the Complete Intro to Web Development, v3 course.

Check out a free preview of the full Learning jQuery course:
The "CSS Styles and Dimensions" Lesson is part of the full, Learning jQuery course featured in this preview video. Here's what you'd learn in this lesson:

CSS is like attr to set and get CSS style properties, but it’s better to change the class with addClass, removeClass and toggleClass instead of changing individual css properties camelCase css properties without quotes or use dashes inside quotes. For example, css({ backgroundColor: “red”, ‘margin-top’: ‘10px” }) Pass in functions to CSS methods to do computation css(‘font-size’, fn); The width and height methods return a number. The offset returns object with top and left properties relative to the document. The position returns relative to its offset parent

Get Unlimited Access Now