We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38318
    • 128 Posts
    I had a discussion on another post about how to vertical centre an image in a div. I'm using the gallery plugin.

    The solution kindly offered was to change to this:
    <img class="[[+galitem.imgCls]]" src="[[+galitem.image:phpthumbof=`w=940&h=466&zc=1`]]" alt="[[+galitem.name]]"/>
    


    But this doesn't seem to work for me. Does anyone else have any ideas?

    This is my code:
    <div class="slider-wrapper">
                            <div class="sliderGallery">
    [[!GalleryItem?]]
    
    [[!+galitem.image:notempty=`
    <div class="image">
      <a href="[[+galitem.image]]"><img class="[[+galitem.imgCls]]" src="[[+galitem.image]]" alt="[[+galitem.name]]"/></a>
    </div>
    `]]
    
                                   
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </header>    
    
    <section id="content"><div class="ic"></div>
            <div class="main">
                <div class="wrapper img-indent-bot">
    
    [[$MenuBoxes]]
    
    <div class="wrapper">
                	<article class="column-1">
                    	<div class="indent-left">
                            <div class="maxheight indent-bot">
                                <h3 class="p1">Stock fencing</h3>
                            <h6 class="p2">If you need to patch up an existing stock fence or install new stock proof fencing then ask us about our services before you go anywhere else.</h6>
                          <p class="p2">We can fit a full range of stock fencing wire, posts, staples and stakes.</p>
                            </div>
                        </div>
                    </article>
    
    
                    <article class="column-2">
                    	<div class="maxheight indent-bot">
    
    
    [[!Gallery? &album=`Stock` &toPlaceholder=`gallery` &thumbTpl=`NewGalleryThumb` &thumbWidth=`150`]]
    
    [[+gallery]]
    
    </div>
      
    
    
                    </article>
    
    
                </div>
            </div>
    </div>
        </section>


    Then
      • 38318
      • 128 Posts
      I seem to have solved it by using CSS:
      .sliderGallery {
      	width:940px;
      	height:466px;
      	background-image: url(../images/slider-gallery.jpg);
      	background-repeat: no-repeat;
      	position: relative;
           margin-left: auto;
           margin-right: auto;
           overflow: hidden;
      
      }
      
      
      .sliderGallery img {
      	overflow: hidden;
      	width:100%;
      	position: absolute;
          margin: auto;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
      	
      }


      Although it doesn't work in Firefox, works in IE, Safari and Chrome though.