Questions tagged [css-tables]

Use this tag instead of just [css] for questions about styling HTML

elements with CSS, or about using the CSS display:table property declaration to define an element's layout to mimic that of an HTML
.

The tag should be used in preference over the tag for questions about using CSS to present <table> or table-like content in HTML pages.

Typically, these activities involve:

  • Styling HTML <table> elements with CSS, and/or
  • Using the CSS display: table property declaration to define an element's layout to mimic that of an HTML <table>.

References

2231 questions
339
votes
4 answers

What replaces cellpadding, cellspacing, valign, and align in HTML5 tables?

In Visual Studio, I'm seeing these warnings: Validation (HTML 5): Attribute 'cellpadding' is not a valid attribute of element 'table'. Validation (HTML 5): Attribute 'cellspacing' is not a valid attribute of element 'table'. Validation (HTML 5):…
Code Maverick
  • 20,171
  • 12
  • 62
  • 114
217
votes
10 answers

How do I keep CSS floats in one line?

I want to have two items on the same line using float: left for the item on the left. I have no problems achieving this alone. The problem is, I want the two items to stay on the same line even when you resize the browser very small. You know...…
Jiaaro
  • 74,485
  • 42
  • 169
  • 190
131
votes
6 answers

Repeat table headers in print mode

Is it possible in CSS using a property inside an @page to say that table headers (th) should be repeated on every page if the table spreads over multiple pages?
avernet
  • 30,895
  • 44
  • 126
  • 163
124
votes
10 answers

Border around specific rows in a table?

I'm trying to design some HTML/CSS that can put a border around specific rows in a table. Yes, I know I'm not really supposed to use tables for layout but I don't know enough CSS to completely replace it yet. Anyways, I have a table with multiple…
Kyle Cronin
  • 77,653
  • 43
  • 148
  • 164
123
votes
5 answers

How to specify table's height such that a vertical scroll bar appears?

I have a table with many rows on my page. I would like to set table's height, say for 500px, such that if the height of the table is bigger than that, a vertical scroll bar will appear. I tried to use CSS height attribute on the table, but it…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
122
votes
16 answers

CSS Cell Margin

In my HTML document, I have a table with two columns and multiple rows. How can I increase the space in between the first and second column with css? I've tried applying "margin-right: 10px;" to each of the cells on the left hand side, but to no…
Tom
  • 4,341
  • 9
  • 27
  • 21
113
votes
8 answers

What's the best way to center your HTML email content in the browser window (or email client preview pane)?

I normally use CSS rules for margin:0 auto along with a 960 container for my standard browser based content, but I'm new to HTML email creation and I've got the following design that I'd like to now center in the browser window without standard…
Joel Glovier
  • 7,469
  • 9
  • 51
  • 86
109
votes
5 answers

space between divs - display table-cell

I have here two divs:
content
content
Is there a way to make space between these two divs (that have display:table-cell)?
System-x32z
  • 1,921
  • 5
  • 20
  • 31
106
votes
11 answers

CSS way to horizontally align table

I want to show a table of fixed width at the center of browser window. Now I use But Visual Studio 2008 gives warning on this line: Attribute 'align' is considered outdated. A newer construct is recommended. What…
Alexander Prokofyev
  • 33,874
  • 33
  • 95
  • 118
99
votes
11 answers

How to apply CSS page-break to print a table with lots of rows?

I have a dynamic table in my web page that sometimes contains lots of rows. I know there are page-break-before and page-break-after CSS properties. Where do I put them in my code in order to force page breaking if needed?
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
95
votes
7 answers

How can I limit table column width?

One of the columns in my table can contain a long text without whitespaces. How can I limit its width to, say, 150px? I don't want it to be 150px always (if it's empty it should be narrow), but if there is a long text I want it to be limited with…
nightcoder
  • 13,149
  • 16
  • 64
  • 72
92
votes
2 answers

How is a CSS "display: table-column" supposed to work?

Given the following HTML and CSS, I see absolutely nothing in my browser (Chrome and IE latest at time of writing). Everything collapses down to 0x0 px. Why?
Vivek Chandra
  • 4,240
  • 9
  • 33
  • 38
1
2 3
99 100