0

I am trying to create a Carousel, where i will show some tweets along with the user's profile picture.

I have a created a sprite with all user's profile picture, to reduce number of network requests.

I can position the images of the sprite with background-position

For applying the background-position I can select the container-div which will hold the images either with :nth-child selector or I can assign a seperate id / class to each of the container for example position-1, position-2 and so on.

Is there any better way apart from the above methods, by which i can efficiently position them ?

I want a CSS only solution don't want to use JavaScript.

  • Please provide an [mcve]. How would we know if `nth` selectors are the best option if we don't know the HTML? Guessing is a waste of time. – zer00ne Feb 21 '19 at 09:27
  • nope, no other way, you have mentioned the 2 unique possibilities – Richard Feb 21 '19 at 09:33
  • mmh, there's a third one of course, it's obvious, you can assign a style attribute directly in your html tag elements `
    ` but that's it
    – Richard Feb 21 '19 at 09:35

0 Answers0