Question

I am struggling with a cell padding issue in a given HTML table (generated by Drupal).

The table is the following:

enter image description here

I tried the following:

.view-thumbnails-of-tips-and-tricks {
    padding: 10px 10px 10px 10px;  
}

I want to adding padding around cell content as following:

enter image description here

Unfortunately, the padding goes around the table, rather than the cells' content. How can I solve this?

Was it helpful?

Solution

.view-thumbnails-of-tips-and-tricks tr td {
    padding: 10px;  
}

OTHER TIPS

Specify td after your class:

.view-thumbnails-of-tips-and-tricks td {
    padding: 10px;  
}

Also, make sure to set cellpadding to zero in the HTML in case user-agent stylesheets provide their own value. This value may override or add to the CSS value.

<table cellpadding="0">

You should set css to that cell, not the holder.

So you can set class name for that cell and customize the css.

e.g: .view-thumbnails-of-tips-and-tricks td { padding: 10px; }

Hope this help

Try defining your style like this:

.view-thumbnails-of-tips-and-tricks td {
    padding: 10px 10px 10px 10px;
}

It means that you are defining style for:

  1. top div (identifier ".view-thumbnails-of-tips-and-tricks")
  2. table inside that div ("td")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top