I am currently trying to center images and text for the subcategories but I cannot figure out how to do this. I have tried all sorts of aligns but noting will fix it, the images and text keep left justifying. Here is my code:
```php
{if $subcategories or $category_data.description || $category_data.main_pair}
{split data=$subcategories size=$columns|default:“3” assign=“splitted_subcategories”}
{math equation=“floor(100/x)” x=$columns|default:“3” assign=“cell_width”}
{if $category_data.description && $category_data.description != “”}
{$category_data.description|unescape}
{/if}
{if $category_data.main_pair}
{/if}
{foreach from=$splitted_subcategories item="scats"}
{foreach from=$scats item="category"}
{if $category}
{else}
{/if}
{/foreach}
{foreach from=$scats item="category"}
{if $category}
{else}
{/if}
{/foreach}
{/foreach}
{/if}
{if $smarty.request.advanced_filter}
{include file="views/products/components/product_filters_advanced_form.tpl" separate_form=true}
{/if}
{if $products}
{assign var="layouts" value=""|fn_get_products_views:false:0}
{if $category_data.product_columns}
{assign var="product_columns" value=$category_data.product_columns}
{else}
{assign var="product_columns" value=$settings.Appearance.columns_in_products_list}
{/if}
{if $layouts.$selected_layout.template}
{include file="`$layouts.$selected_layout.template`" columns=`$product_columns`}
{/if}
{elseif !$subcategories}
{$lang.text_no_products}
{/if}
{capture name="mainbox_title"}{$category_data.category}{/capture}
```
Any help with me getting everything centered would be appreciated.
Dear CS-Cart Support Team,
When utilizing this article for 3.0.3 on a fresh installation,
Sub-category images and text are not centred as the element is being actively styled via reset.css.
th, td, caption {
font-weight: normal;
text-align: center;
vertical-align: top;
}
In order to rectify this, the customer needs to apply a style via CSS to the table.
My solution is below:
/public_html/skins/basic/customer/addons/my_changes/styles.css
table.sub-categories tbody tr td {
text-align:center;
}
/public_html/skins/basic/customer/addons/my_changes/hooks/categories/view.override.tpl [Line 8]
```php
```
Thanks Jesse, I had to tweak it a little bit but I got it to work.
I added the code here to:
[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/skins/basic/customer/addons/my_changes/base.css[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]
.sub-categories tbody tr td {
text-align:center;
}
[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]And changed the view.override.tpl like you said. Thanks a ton![/font][/color] Change the
[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/skins/basic/customer/addons/my_changes/base.css[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]To[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]/public_html/skins/basic/customer/base.css[/font][/color]
Do you know how I get the images to vertically align the the bottom? Right now thy are going to the top of the 's and it just doesn't look right. Thanks,
buging
November 2, 2014, 12:00am
5
Any idea how to do this in 4.2.x?
buging
November 2, 2014, 12:00am
6
[quote name='buging' timestamp='1414939929' post='195919']
Any idea how to do this in 4.2.x?
[/quote]
seem to do the trick for v4.2
.ty-subcategories__item {
display: inline-block;
margin: 5px 20px 5px 0px;
text-align:center; <— add this
}