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
Anthony Scott
Courses Plus Student 9,001 PointsAligning images
Just started making this website. I would like the images to be aligned so the staff lines are lined up properly. How do I go about this? Do I have to edit the images so they all lineup, or can this be done with CSS? https://w.trhou.se/s3n727kqoq
Thanks
2 Answers
Cory Harkins
16,500 PointsBest fix = edit the images to have the same X x Y values, I'm looking at some of the .png's and the Y value is different for most of them, the X value I believe shouldn't be an issue, as, you would like the staff margin to align, that is dictated by it's Y value.
IF you don't wish to align them by use of image editing, instead of writing the image to the html by use of JS. You can calculate the marginal difference between each photo using CSS i.e,
In your app.js, create a new array that will target class numbers while concatenating them with a class, i.e; document.write('<img class="image' + j[3] + 'src="images/' + arr[0] + '.png" ' + '>');
.image1 { margin-bottom: -(n)px; }
This way, when each image is written to the site, the class is already set to align them... Sounds time consuming though.
That's just my two cents.
Goodluck!
Anthony Scott
Courses Plus Student 9,001 PointsWow, thanks!