Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #396366

    I use this

    .av-masonry-entry:before {
    background: url(p-bg-1.jpg) repeat transparent;
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    content: attr(title);
    margin-top: -(height/2)px;
    vertical-align: middle;
    }

    text-align: center; takes care about being centered horizontally.
    vertical-align: middle; has no effect on showing vertically centered

    Can you help me to center my title vertical?

    • This topic was modified 9 years, 10 months ago by royaltask.
    #396639

    Hey royaltask!

    Can you please post the link to your website and a screenshot showing the changes you would like to make?

    Cheers!
    Yigit

    #396650
    This reply has been marked as private.
    #396957

    Hey!

    Try to replace the code with this to vertically center align the element:

    .av-masonry-entry:before {
    background: url(p-bg-1.jpg) repeat transparent;
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    content: attr(title);
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    }

    Regards,
    Ismael

    #397104

    I had no luck on this.
    changes nothing (cache cleared) exept title shows a little higher.

    #397662

    Hi!

    can you please post a link to your website showing the issue? otherwise we can just guess.
    Try to play around with these values in Ismael’s code:

    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    

    and adjust as needed.

    Best regards,
    Andy

    #400250

    I’m having a problem trying to do the exact same thing … center the title and price vertically on a masonry element. I tried the above code and it didn’t work… any ideas?
    Here’s a link to the example : LINK

    #400568

    Hi!

    Use this:

    .av-inner-masonry-content-pos {
    top: 50%;
    -webkit-transform: translate(0,-50%);
    -moz-transform: translate(0,-50%);
    -ms-transform: translate(0,-50%);
    transform: translate(0,-50%);
    position: absolute;
    }

    Best regards,
    Ismael

    #403694

    Thanks Ismael, that worked perfectly.

    I have another issue regarding centering text with the masonry element…. here’s the scenario :

    I have two masonry galleries on a page each containing two (2) images each, and both are set to Perfect Masonry. On the top gallery I set the column number to ‘3’ and the bottom one to ‘4’. I did this to achieve a tiling effect so that the images stay grouped together on both top and bottom when the page size changes. However this causes an issue when trying to center the text horizontally. It seems like the width is being calculated using the column number instead of the image number, so the text is off center. Is there a way around this, or a solution to calculating the horizontal center for this type usage with the masonry element?

    here’s the page: Example

    #404277

    Hey!

    This should work:

    #home_grid1 .av-inner-masonry-content-pos, #home_grid2 .av-inner-masonry-content-pos {
    top: 50%;
    -webkit-transform: translate(-50%,-50%);
    -moz-transform: translate(-50%,-50%);
    -ms-transform: translate(-50%,-50%);
    transform: translate(-50%,-50%);
    position: absolute;
    left: 50%;
    }

    Regards,
    Ismael

    #404646

    Ismael, you are the man! That worked perfectly. Thanks you so much for your top-notch support.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Portfolio Pseudo Title .av-masonry-entry:before – center vertical’ is closed to new replies.