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
Peter Hearne
6,803 Pointshelp with icon align in css
Hello, i am wondering how i can align 2 icons next to eachother using css? i cant seem to get it right, im trying to place them in the center of my page next to eachother in a line
here is my css for the social icons
social-icon {
position: relative;
padding: 20px;
width: 125px;
height: 125px;
display: block;
margin-left: auto;
margin-right: auto;
}
2 Answers
Stephen O'Connor
22,291 PointsThere are lots of ways to do this, but try changing your display to inline-block.
Peter Hearne
6,803 Pointsthank you i had the html part in footer instead of section, and changing it to inline-block worked :)
Adam Sackfield
Courses Plus Student 19,663 PointsGlad it's sorted. You could also use inline elements like "span" to achieve the same result without the need for display property.
You will develop your own technique over time.
Adam Sackfield
Courses Plus Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsWould it be possible to see the HTML as well. Then we can see what we can do :)