Internet, Networking, & Security Web Development Banish Funky Spaces in Your HTML Tables By Jennifer Kyrnin Freelance Contributor Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. our editorial process LinkedIn Jennifer Kyrnin Updated November 04, 2019 Lightcome / Getty Images Web Development CSS & HTML Web Design SQL Tweet Share Email If you’re using tables for page layout (a no-no in XHTML), it's likely you'll experience the unsightly addition of extra space in your layouts. To fix this problem, you need to check both your HTML table definition and the specifics of any governing style sheet. HTML Table Definition The HTML tag for tables by default doesn't control for some spacing requirements. Verify three things about the table tag within your HTML document: Does your table have the cellpadding attribute set to 0?cellpadding="0"Does your table have the cellspacing attribute set to 0?cellspacing="0"Are there any spaces before or after your content and the table's tags? Number 3 is the kicker. Many HTML editors like to have the code all spaced out, to make it easy to read. But many browsers interpret those tabs, spaces, and carriage returns as desired extra space inside your tables. Get rid of the whitespace surrounding your tags and you’ll have crisper tables. Style Sheets However, it may not be the HTML that's off. Cascading style sheets do control some display attributes of tables and depending on the page, you may or may not have deliberately added table-specific CSS in the first place. Scan the governing CSS file for any of the following values inside the table, th, or td properties and adjust as needed: border: Specifies the attributes of a table or cell borderborder-collapse: Treats adjacent borders as one, to avoid duplicating border widthspadding: Offers blank space, in pixels, around each celltext-align: Determines the alignment of text within the cellborder-spacing: Sets spacing between cells, in pixels Alternatives Although you can still use HTML tables (the standard is well-established and universally supported in today's browsers), most modern responsive web design uses cascading style sheets to place elements on a page. Tables still make sense for their original intended purpose of displaying tabular data, but for organizing the layout and content of a page, you're much better off using CSS layout instead.