We can add a prop so that Slick does not add width: 100%; display: inline-block; ?
See original GitHub issueSlick is adding those styles to the Slider items and I must use important in the original styles to not lose them. This would be a very good idea, this is not the first time this has happened with Slick.
import React from 'react'
import ImageCircle from '../ImageCircle';
import Slider from "react-slick";
import './styles.scss'
export default ({ images, isAvatar }) => {
const settings = {
dots: false,
infinite: true,
autoplaySpeed: 2000,
slidesToShow: 5,
slidesToScroll: 5,
autoplay: true,
responsive: [],
arrows: false,
centerPadding: '100px',
accessibility: false,
};
return (
<div className='GalleryImages'>
<Slider {...settings}>
{
Array.isArray(images) && images.map((img) => (
<div className='BlockImage' key={img.url} >
<div className='BlockOverlary' />
{
isAvatar ? (
<ImageCircle
style={{
width: '100px',
height: '100px',
margin: 'auto'
}}
img={img.url}
alt={img.alt}
/>
) : (
<img
src={img.url}
alt={img.alt}
/>
)
}
</div>
))
}
</Slider>
</div>
)
}
If you allow me, I can do a PR. But we should discuss the name of the prop.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:10
Top Results From Across the Web
How to remove inline css width: 100%; display: inline-block
You need in CSS add after the element value !important . For example: .product-wrap { position: relative; width: 30px !important; display: ...
Read more >How to Make Inline-Block Elements Add Up to 100% Width
You can achieve your desired result by changing the div width to 49%, but that's not good enough. It NEEDS to be 50%!....
Read more >slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, CSS3 transitions, touch events/swiping & much more!
Read more >When do you use inline-block? | CSS-Tricks
The block-direction margin on inline elements is ignored entirely; The padding on inline elements doesn't affect the height of the line of text....
Read more >Quick fix: Inline-block HTML elements with total 100% width ...
Nowadays there are many ways to position 2+ elements next to each other: you can use inline blocks, floating, Flexbox, even CSS Grid....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To anyone still looking for a solution…
Try wrapping your list components in a react fragment. This worked for me.
<React.Fragment key={id}> <Item> </Item> </React.Fragment>
No