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 trial
Konrad Pilch
2,435 PointsHow to sclae image
HI,
How can i scale image?
So what i mean if a picture is 100px width and 50px height, but i dont know it, and i want it to be smaller but so it keeps its properties , how do i do it?
1 Answer
Luke Pettway
16,593 PointsThere are numerous ways this could be answered, but it really is up to what you are trying to accomplish. You can simply specify an inline value using width="100px" or you can use CSS to control the size using a class.
.scale-me{
width: 100%;
max-width: 50px; /* or whatever the size should be */
}
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 PointsI managed to do it.
My code
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 PointsBut thank you, if that works.
Luke Pettway
16,593 PointsLuke Pettway
16,593 PointsOk yeah, that's all you need to do. You can also make them scale doing the above solution I provided, that way if the viewport size is smaller, the image will scale down.
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 Pointsi preffer your way , thank you :D!