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:

  .green-text {
  .smaller-image {
<h1 class="green-text text-center">Karl Marx</h1>
<a href="#"><img class="smaller-image" src='//'></a>


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.

I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.