Solution 1 :

your code is working, maybe the size of your two images can’t fit in the screen

check this code:

 .childhood {
  display: inline;
  float:left;
  margin: 0px;
  padding: 0px;
  
  width: 200px;
 }
<figure>
  <div class="child">
  <img class="childhood" src="https://i.ibb.co/c3y4KSf/104938518-2777265905826942-8721565023138927238-o.jpg">
  <img class="childhood" src="https://i.ibb.co/c3y4KSf/104938518-2777265905826942-8721565023138927238-o.jpg">
  <figcaption>
  SOME TEXT
  </figcaption>
  </div>
</figure>

Solution 2 :

try this:

.child {
  display: flex;
  aign-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

figcaption {
  width: 100%;
}

.childhood {
  width: 50%;
}

Let me know

Problem :

I have the two images below in HTML and wanted to put them next to each other,however it seems one gets placed under the other.I have used the CSS display:inline-block to address this issues.

HTML :
  <figure>
    <div class="child">
      <img class="childhood" src="/home/ali/FullStack/try/Images/1.JPG">
      <img class="childhood" src="/home/ali/FullStack/try/Images/2.JPG">
      <figcaption>
      SOME TEXT
      </figcaption>
    </div>
  </figure>

CSS:

.childhood {
    display: inline;
    float:left;
    margin: 0px;
    padding: 0px;
}

I Was wondering what am I doing wrong that is preventing the two images from being displayed next to each other?

Comments

Comment posted by Canolyb1

Just an FYI: Your HTML is not valid becuase

has to be a child of

and you have it nested inside

Comment posted by Aliman

Both this and the other answer above are now working the way I wanted them to work,however they show different results.

Comment posted by Marik Ishtar

Yes, the first answer set the width of an image to 50% of the width of its parent in this case the .child div, so two images with width 50% each will occupy 100%, so the text will have to be displayed under the images because the .child is using flex-wrap: wrap;, and in my answer there’s still a space for the text to be displayed.

By