{"id":7172,"date":"2021-07-28T14:47:42","date_gmt":"2021-07-28T14:47:42","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=7172"},"modified":"2022-04-13T16:34:32","modified_gmt":"2022-04-13T16:34:32","slug":"how-to-set-table-width-height-color-padding-using-css","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/","title":{"rendered":"How to set Table width, height, color &#038; padding using CSS?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Empty-cells<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This property is used to set whether or not to display borders and background on empty cells in a table. It will work only if the border-collapse is set to separate. We can set this property to <em>show<\/em> (default) or <em>hide<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ex:-<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">table <strong>{ table-layout: fixed; }<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to set Table width and Height<\/strong>?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We use <em>width<\/em> and <em>height<\/em> property to set table width and height.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can also set table heading (th) width and height.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>table { width: 100% ;}<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>th { height: 10px; }<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to set Table Padding<\/strong>?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This property is used to control the space between the border and the content in a table, this is used on <strong>&lt;td><\/strong> and <strong>&lt;th><\/strong> elements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>th, td { padding: 10px; }<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.stack.imgur.com\/AGuDf.gif\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to set Table color<\/strong>?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>table {background-color: pink;}<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/proxy\/CJ00PfR6BFiSkSJo8UILqkHTzp6dGPIVtgAQYQbmHcWQS1DUyYj1B_FVKsvAwXH0XNQVQ5TZsuNagsnG6VdRJY_6U27oO07dunlRhl0P3SEZZA\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Empty-cells This property is used to set whether or not to display borders and background on empty cells in a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5309],"tags":[5717,5715,5134,5714,4459,5716,5712,5713],"class_list":["post-7172","post","type-post","status-publish","format-standard","hentry","category-css","tag-cells","tag-color","tag-css","tag-height","tag-html","tag-padding","tag-table","tag-width"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to set Table width, height, color &amp; padding using CSS? - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set Table width, height, color &amp; padding using CSS? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Empty-cells This property is used to set whether or not to display borders and background on empty cells in a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-28T14:47:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:34:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"How to set Table width, height, color &#038; padding using CSS?\",\"datePublished\":\"2021-07-28T14:47:42+00:00\",\"dateModified\":\"2022-04-13T16:34:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/\"},\"wordCount\":135,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/proxy\\\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\",\"keywords\":[\"cells\",\"color\",\"css\",\"height\",\"HTML\",\"padding\",\"table\",\"width\"],\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/\",\"name\":\"How to set Table width, height, color & padding using CSS? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/proxy\\\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\",\"datePublished\":\"2021-07-28T14:47:42+00:00\",\"dateModified\":\"2022-04-13T16:34:32+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#primaryimage\",\"url\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/proxy\\\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\",\"contentUrl\":\"https:\\\/\\\/lh3.googleusercontent.com\\\/proxy\\\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-set-table-width-height-color-padding-using-css\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set Table width, height, color &#038; padding using CSS?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set Table width, height, color & padding using CSS? - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/","og_locale":"en_US","og_type":"article","og_title":"How to set Table width, height, color & padding using CSS? - scmGalaxy","og_description":"Empty-cells This property is used to set whether or not to display borders and background on empty cells in a [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/","og_site_name":"scmGalaxy","article_published_time":"2021-07-28T14:47:42+00:00","article_modified_time":"2022-04-13T16:34:32+00:00","og_image":[{"url":"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ","type":"","width":"","height":""}],"author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"How to set Table width, height, color &#038; padding using CSS?","datePublished":"2021-07-28T14:47:42+00:00","dateModified":"2022-04-13T16:34:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/"},"wordCount":135,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ","keywords":["cells","color","css","height","HTML","padding","table","width"],"articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/","name":"How to set Table width, height, color & padding using CSS? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ","datePublished":"2021-07-28T14:47:42+00:00","dateModified":"2022-04-13T16:34:32+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#primaryimage","url":"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ","contentUrl":"https:\/\/lh3.googleusercontent.com\/proxy\/UAOzr1XIVZZtUAptuqXkg2sO8178lyTPWJ_gu2z_LKrDON2sBHqplSl0voaF5wIQiaavfzq_wnJ72i4gP0Ocruvf3Kypbxk90OuCpXbo7P09aPoJlQ"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-set-table-width-height-color-padding-using-css\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How to set Table width, height, color &#038; padding using CSS?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=7172"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7172\/revisions"}],"predecessor-version":[{"id":7173,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7172\/revisions\/7173"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=7172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=7172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=7172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}