2

http://www.gabrielleelizabethstudios.com/GEA_html/thejustingallery.html

I'm having trouble getting this to vertically align automatically. I know I can add a padding-bottom to center it manually, but I'd rather it position vertically automatically. How would I go about doing this? And I need to keep the display: inline-block functionality.

<div style="width:375px; height 250px; display: inline-block; margin:10px; padding: 0;text-align: center;">          
                <p>title</br></br>     
            text for paragraph goes here</p>
</div>
  • 3
    http://css-tricks.com/centering-in-the-unknown/ – nice ass Sep 21 '14 at 21:29
  • 2
    Also have a look at: [How to align text vertically center in div with css?](http://stackoverflow.com/questions/8865458/how-to-align-text-vertically-center-in-div-with-css?rq=1). – Hashem Qolami Sep 21 '14 at 21:36

2 Answers2

2

you must set vertical-align: middle; to .masonry .item { class

.masonry .item {
    height: 250px;
    margin: 10px;
    display: inline-block;
    vertical-align: middle;
    }

and add vertical-align: middle; to parent div of the p element

<div style="width: 375px; display: inline-block; margin: 10px; padding: 0px; text-align: center; vertical-align: middle;">
Farshad
  • 1,435
  • 1
  • 8
  • 12
-6

You could use a CSS class for your paragraph tags, something like this:

.p {
    padding-left:40px;
}
CH3M
  • 65
  • 7