Centering an image

I just began my first project and am trying to center an image in it. I have looked on a few websites and searched through the freecodecamp projects I have previously completed and can’t find anything that will work.
Here is my code so far:

<style>
  .green-text {
    color:green;
  }
  .smaller-image {
    width:500px
</style>
<h1 class="green-text text-center">Karl Marx</h1>
<a href="#"><img class="smaller-image" src='//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/freecodecamp/original/3X/8/c/8cb74b7339564360d451b4f3484be5340d0da18f.jpg'></a>

Thanks

You might want to look into margin, or text center

btw, you’re missing a closing bracket and the declarations should not really be in one line unless minimized for production purposes

You should add text-align: center to the container of the img tag. This will center it horizontally.

try placing a center element right before the image element and remember to close it.