0

I'm running into a weird inconsistency with an image on my website. It's structured like this:

<div class="intro">
    <div>
        <p>Some text</p>
        <p>More text</p>
    </div>
    <img src="images/headshot.jpg" />
</div>
.intro {
    display: flex;
    align-items: center;
}

.intro>img {
    width: 11rem;
    height: 11rem;
    border-radius: 6rem;
    margin: 1rem 0;
    align-self: center;
}

.intro>div {
    padding-right: 1rem;
}

After a hard reload in Chrome 74, it renders like this (wrong):

incorrect render

But then if I inspect element and toggle any of the img's properties off and on again, it renders like this (correct):

correct render

I've come across this question, which suggested adding align-self: center; to the img, but that hasn't helped.

You can see the issue live here: https://leonoverweel.com/. Any idea what the problem is?

Leon Overweel
  • 1,488
  • 4
  • 17
  • 27

1 Answers1

0

Adding flex-shrink: 0 to .intro>img seems to fix this, as per Piotr's comment.

Leon Overweel
  • 1,488
  • 4
  • 17
  • 27