I have a grid view with 3 columns. I style the grid so that each cell has a border and background color. The trouble is, if the total number of cells is not a multiple of 3, I get empty cells displayed. See attached image (I wish to hide the last 2 cells by removing the border and background color). I dont think there is a way to hide these cells using css as css cant tell that they are empty. Is there a setting in Views to help with this?
If not, one way it could be done, is for the views module to add a class "empty", or something, to the TD cells that it knows are empty. Then I can target css at these cells to hide them.

Comments
Comment #0.0
spiderplant0 commentedclarity
Comment #1
wjaspers commentedThis should be handled in your site's theme.
Comment #2
dawehnerOn the actual configuration of the grid in views you can choose to "fill_single_line" which allows you to achieve what you want.
Comment #3
spiderplant0 commentedThanks wjaspers, I was hoping there is a way to do it but cant figure out how. Can you elaborate please.
Comment #4
spiderplant0 commenteddwehner, thanks but are you sure? I tried toggling this but there was no change. The description beside the control says it is for single rows - I dont have a single row, so I'm confused.
Comment #5
wjaspers commented@spiderplant0,
Using the Views UI, you'll see a button (in the lower right corner) titled "Theme info".
Click on it.
It will give you a list of templates used for this display.
You can override any one of those templates by creating one using the suggested naming scheme for the file and placing it in your theme's "templates/" folder.
You will likely want the --table.tpl.php
All you need to do is modify how the cell is rendered....
It will take a small amount of PHP, but is doable.
Comment #6
spiderplant0 commentedthanks wjaspers
in case anyone else needs to do this,
I overrode views-view-grid.tpl.php
and in your CSS file you can hide your empty cells, eg ...
Comment #7.0
(not verified) commentedcorrection
Comment #8
tajdar commentedThanks Mr spiderplant0
Your solution works for me...!!!
Comment #9
alletsefinn commentedOr you can just hide the empty cells with css:
table.views-view-grid {
border-collapse: separate;
empty-cells: hide;
}
cf: http://www.w3schools.com/cssref/pr_tab_empty-cells.asp