Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] How to Center Varying Text Width in Div in Div

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #150157
    sanclementejoe
    Participant

    How can I center my text in it’s own div within a parent div. I’m working with a product slider where the text width is of varying length, so the standard left: 50%; margin-left:-150px; for example doesn’t exactly work.

    I have both text-aligns set to center for the text div and it’s parent div. I current set the div to align-left at 40% to get it kind of close, but I don’t know how to center the text of varying lengths.

    On this page, the product carousel/slider at the bottom is the item in question: http://www.coastalrepro.com/home-with-carousel-test/

    Thanks!

    #150165
    Senff
    Participant

    If you remove the width (so that it’s full width), and the left-position (so that it’s positioned all the way to the left) of .rsGCaption, then it should be centered with the image above it.

    #150227
    sanclementejoe
    Participant

    Thanks @Senff, it worked beautifully!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.