How to fix collection image padding issue in my code?

Topic summary

  • Issue: CSS overlay text on collection images was wrapping because the overlaid element didn’t span the image width. The existing code positioned the title absolutely and centered it via transform, but lacked width control.

  • Fix suggested: Add “width: 100%” and “text-align: center” to the overlaid link (.full-unstyled-link) so it spans the full image width and centers the text.

  • Outcome: The change resolved the wrapping; the original poster confirmed it works. A screenshot was shared to illustrate the result. A site link was provided for context.

  • New question: The poster asked how to make the image opacity 60% (in CSS, opacity controls element transparency). This follow-up was not yet answered.

  • Status: Primary issue resolved; thread remains open regarding the opacity adjustment.

Summarized with AI on January 7. AI used: gpt-5.

Hi,

I have edited some code to put each collection title on top of the corresponding image, however, my issue is that the text keeps wrapping as there seems to be padding on each side of the image and the text won’t go the full way across it on one line.

This is what I mean:

This is the code I have already written to achieve this:

<style>
ul#Slider-template--20911263318360__477125e9-4070-47c9-ab6d-93a16c1c6ed6 .full-unstyled-link{
  position: absolute;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px; /* change this to adjust the text size */
  color: white;
  justify-content: center !important;
} /* Homepage collection text desktop */ 

</style>

Site link is: https://mauriciobenyar.myshopify.com/

Would really appreciate if someone could help,

Thanks

1 Like

Hi @tobyh4

Add this to your code.

width: 100%;
text-align: center;

And Save.

Result:

Please don’t forget to Like and Mark Solution to the post that helped you. Thanks!

Thank you, works perfectly.
Do you also know if I could add code to make the image opacity 60%?