Skip to content Skip to sidebar Skip to footer

Creating Html Table With Fixed Dimensions

Short Trying to get table with exact dimensions for a4 print Table's first and last rows' margin from top and bottom sides of paper must be 11 mm Margin between rows' 0 mm Table's

Solution 1:

It's clear you want the output for printing, and that the dimensions are critical; possibly you're printing onto kiss-cut label sheets or something. It seems unlikely you'll ever get an HTML solution that will produce pixel-perfect results on all browsers and operating systems. The two options I'd be considering are:

  1. Generating the grid as an image and displaying it on the webpage for printing.
  2. Generating the grid as a PDF for downloading and printing.

There are libraries in all server-side environments to do both of these tasks. In my experience, #2 produces the better results.

Solution 2:

Css is not effective in changing the width of table cell elements. What you'll want to do is either wrap the content of the cell in a div or span and use the td:first-child to set the width in the css, or use the css table model.

Post a Comment for "Creating Html Table With Fixed Dimensions"