Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use '100% 100%' instead of 'cover' ... #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,16 @@ ReactDOM.render(
<div style={{
height: responsiveImage.height,
width: responsiveImage.width,
backgroundSize: 'cover',
backgroundSize: '100% 100%',
backgroundImage: 'url("' + responsiveImage.placeholder + '")'
}}>
<img src={responsiveImage.src} srcSet={responsiveImage.srcSet} />
</div>, el);
```

**Tip:** The placeholder will have a slightly different height/width-ratio due to the reduced resolution.
Background size *'100% 100%'* will scale it to the height and width of the original image provided to the attributes `height` and `width` of the `div` element.
The background size *'cover'* would show a slightly enlarged and cropped placeholder that would show a little bit more flicker once the original image is loaded by the `img` element.

### Options

Expand Down