mvasin / react-div-100vh

A workaround for the '100vh' issue in mobile browsers

Home Page:https://react-div-100vh.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Images

opened this issue · comments

Hello all,

Is it possible to apply this library to images? I tried something like this:

<Div100vh as="img" src={logo} style={{ height: '9.43rvh' }}></Div100vh>

The resulting HTML was:

<div as="img" src={logo} style={{ height: '9.43rvh' }}></div>

So no image was rendered.

A feature like this would be awesome.

Not sure if this covers your use case, but would this work?

<Div100vh style={{ height: '9.43rvh', position: 'relative' }}>
  <img src={logo} style={{ height: '100%' }} />
</Div100vh>

@gzunigaskyjack did that work? Not sure whether this issue needs to remain open.

Yes, I ended up doing something similar:

<Div100vh className="Machine-tu-not-found-img-container" style={{ height: '40.21rvh' }}>
    <img className="Machine-tu-not-found-img" src={modelImage.default}></img>
</Div100vh>

.Machine-tu-not-found-img-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.Machine-tu-not-found-img {
    height: 100%;
    width: auto;
    pointer-events: none;
}

Thank you!