Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjordan Buckhalt
1,606 PointsCSS vs HTML image styling
I'm seeing that I can styling the size of an image with either the width and height attributes in HTML, or in CSS. Is one better or more preferable than the other?
1 Answer
Steven Parker
231,268 PointsMy approach may not be universal, but if I'm loading an image of a known size, I place the dimensions in the tag attributes. But I only do this for the image's actual size.
If i'm modifying the image, including displaying it in a size other than how it is stored, I will use CSS instead.
jordan Buckhalt
1,606 Pointsjordan Buckhalt
1,606 PointsThat's a good rule of thumb to follow. Seems pretty logical. Thanks Steven!