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

CSS How to Make a Website Customizing Colors and Fonts Use Classes in CSS

Image

I have an image and I want to center it ,so when I move the browser it moves with it, so it fits as the screen moves.

here's my code

''' <header>

<a href="index.html" id="logo"> <img src="SalonSoful.jpg" alt="SalonSoful"/> <h1>Sonia Negasingh</h1> <h2>Hair Stylist</h2> </a> <nav> <ul> <li><a href="index.html" class="selected">Gallery</a></li> <li><a href="about.html">About</a></li> <li><a href="Contact.html">Contact</a></li> </ul> </nav> </header> '''

1 Answer

Benjamin Bornschein
Benjamin Bornschein
1,364 Points

Your code isn't posted.

But the easiest way is just to put a DIV around the image.

<div style="text-align: center;">
<img src="your_image.png" alt="MyImage">
</div>

Thank you Ben.