X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Vertically centre thumbnail in 125px high div (https://forum.x-cart.com/showthread.php?t=55729)

Sisom 09-27-2010 09:31 AM

Vertically centre thumbnail in 125px high div
 
Hi, I was wondering if anybody has created a mod which will vertically centre a 125px wide thumbnail in a 125px high div, so that if the image is less than 125px high, it still centres vertically within the div?

Also, line 25 of product_list.tpl has "image_y=$product.tmbn_y" in it, which is currently pulling the value '74px' when there is no image - where does this 74px come from? I have set the maximum height of thumbnails to 125px in the control panel. I have changed this temporarily to "image_y=125px" but I thought there might be somewhere I can change it 'properly', i.e. not in the template itself, but by changing the variable $product.tmbn_y.


Many thanks in advance for any help you can give.


Edit:
I've found a way of doing it. I've added the following to line 25 of products_list.tpl:

Code:

<div class="imagethumbnail"> <a href="{$url}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a></div><!-- END OF IMAGETHUMBNAIL -->

and added the following style to altskin.css:

Code:

.imagethumbnail {width:125px;height:125px;display:table-cell;vertical-align:middle;background-color:#000;}



(Don't forget that my product box background is black, so you may want to change the colour of the background-color property to match your background.)


All times are GMT -8. The time now is 02:48 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.