[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Borders around empty cells

Simple question I hope.

I have an HTML table. I'd like an empty cell to have no borders (except where it touches another cell). How do I do that?
0
skbohler
Asked:
skbohler
  • 2
1 Solution
 
David S.Commented:
That's what the empty-cells property of CSS is for: http://reference.sitepoint.com/css/empty-cells

td {
  empty-cells: hide;
}

Open in new window

0
 
skbohlerAuthor Commented:
Would this syntax work:

<table border="1" cellspacing="0" cellpadding="5" width="400" style="empty-cells:hide">

It's not working in the latest version of Firefox.
0
 
David S.Commented:
No, the "empty-cells" property only applies to table-cells themselves, not the table they are in.

Also it's best to avoid using the style attribute. While external stylesheets are best, you could also use an embedded stylesheet, like the following. (<style> elements may only appear inside the <head> element.)
<style type="text/css">
td {
  empty-cells: hide;
}
</style>

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now