{"id":58509,"date":"2023-09-16T16:33:15","date_gmt":"2023-09-16T11:03:15","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=58509"},"modified":"2023-09-19T16:46:41","modified_gmt":"2023-09-19T11:16:41","slug":"the-complete-css-property-encyclopedia-your-ultimate-reference-part-2","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/the-complete-css-property-encyclopedia-your-ultimate-reference-part-2\/","title":{"rendered":"The Complete CSS Property Encyclopedia: Your Ultimate Reference (Part 2)"},"content":{"rendered":"<p>This blog is a continuation of the previous <a href=\"https:\/\/www.tothenew.com\/blog\/the-complete-css-property-encyclopedia-your-ultimate-reference-part-1\/\">blog<\/a>.<\/p>\n<h2><b>CSS \u2500 PADDINGS<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The padding property in CSS is used to add space between the content of an element and its inner border. It is used to control the internal spacing. It only affects its size and layout and it does not affect the element&#8217;s border or margins.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This property can take one of the following forms:<\/span><\/p>\n<p><strong>\u25cf Single Value: <\/strong>This is used to specify the same padding on all sides of an element:<\/p>\n<pre><span style=\"font-weight: 400;\">padding: 10px;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Two Values: <\/strong>This is used to specify padding for the top and bottom, followed by padding for the left and right:<\/p>\n<pre><span style=\"font-weight: 400;\">padding: 10px 20px; <\/span><\/pre>\n<p><strong>\u25cf Four Values: <\/strong>This is used to specify padding for the top, right, bottom, and left sides, in that order:<\/p>\n<pre><span style=\"font-weight: 400;\">padding: 10px 20px 15px 25px;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">We can specify each value by using various CSS measurement units, which include px, em, rem, %, and more. We can also use negative values for padding.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58493 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-1024x331.png\" alt=\"\" width=\"625\" height=\"202\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-1024x331.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-300x97.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-768x248.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-624x202.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1.png 1083w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/> <\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58500 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c22.png\" alt=\"\" width=\"511\" height=\"230\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c22.png 511w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c22-300x135.png 300w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\"> <img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58501 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33-1024x221.png\" alt=\"\" width=\"625\" height=\"135\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33-1024x221.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33-300x65.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33-768x165.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33-624x134.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c33.png 1300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<h2><b>CSS \u2500 MARGINS<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The margin property in CSS is used to control the space outside an element. This property affects the spacing between the element and other elements in its surrounding layout. It is used to create space between the outer boundary of an element and adjacent elements or the edges of its containing element.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This property can take one of the following forms:<\/span><\/p>\n<p><strong>\u25cf Single Value: <\/strong>This is used to specify the same margin on all sides of an element:<\/p>\n<pre><span style=\"font-weight: 400;\">margin: 10px; <\/span><\/pre>\n<p><strong>\u25cf Two Values: <\/strong><span style=\"font-weight: 400;\">This is used to specify the margin for the top and bottom, followed by the margin for the left and right:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">margin: 10px 20px;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Four Values: <\/strong><span style=\"font-weight: 400;\">This is used to specify the margin for the top, right, bottom, and left sides, in that order:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">margin: 10px 20px 15px 25px;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Auto: <\/strong>This is used to specify the horizontal margins to center an element horizontally within its containing element:<\/p>\n<pre><span style=\"font-weight: 400;\">margin-left: auto;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">margin-right: auto;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">We can specify each value by using various CSS measurement units, which include px, em, rem, %, and more. We can also use negative values for margins.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58502 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c44.png\" alt=\"\" width=\"1022\" height=\"454\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c44.png 1022w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c44-300x133.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c44-768x341.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c44-624x277.png 624w\" sizes=\"(max-width: 1022px) 100vw, 1022px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58503 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c55.png\" alt=\"\" width=\"476\" height=\"305\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c55.png 476w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c55-300x192.png 300w\" sizes=\"(max-width: 476px) 100vw, 476px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58504 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66-1024x183.png\" alt=\"\" width=\"625\" height=\"112\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66-1024x183.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66-300x54.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66-768x137.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66-624x112.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c66.png 1303w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h2><b>CSS \u2500 BORDERS<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Borders are used in CSS to define the visible edges of an element. It helps in creating a visual boundary around it. We can control the appearance of borders using various CSS properties.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This property can take one of the following forms:<\/span><\/p>\n<p><strong>\u25cf Border Width: <\/strong>This is used to set the width of the border. We can specify a single value for all sides, or we can use the border-top-width, border-right-width, border-bottom-width, and border-left-width properties in order to set different widths for individual sides.<\/p>\n<pre><span style=\"font-weight: 400;\">border-width: 2px;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Border Style: <\/strong><span style=\"font-weight: 400;\">This is used to define the style of the border, such as solid, dashed, dotted, or double.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">border-style: solid;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Border Color: <\/strong><span style=\"font-weight: 400;\">This is used to set the color of the border. We can specify a single color for all sides or use the <\/span><span style=\"font-weight: 400;\">border-top-color<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">border-right-color<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">border-bottom-color<\/span><span style=\"font-weight: 400;\">, and <\/span><span style=\"font-weight: 400;\">border-left-color<\/span><span style=\"font-weight: 400;\"> properties in order to set different colors for individual sides.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">border-color: #000;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Rounded Borders: <\/strong>This is used to round the corners of an element and helps in creating curved edges. We can specify a single value for a uniform rounding or we can say we can use the border-top-left-radius, border-top-right-radius, border-bottom-left-radius, and border-bottom-right-radius properties for different corner radii.<\/p>\n<pre><span style=\"font-weight: 400;\">border-radius: 10px;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Border Image: <\/strong><span style=\"font-weight: 400;\">This property allows us to use an image as a border rather than a solid color. We can often use this property for decorative and complex border designs.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">border-image: url(border-image.png) 10 10 round;\u00a0<\/span><\/pre>\n<p><strong>\u25cf Transparent Borders: <\/strong><span style=\"font-weight: 400;\">We can make an element appear without borders by using this property.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">border: none;\u00a0<\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58505 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c77.png\" alt=\"\" width=\"422\" height=\"148\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c77.png 422w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c77-300x105.png 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58506 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88-1024x34.png\" alt=\"\" width=\"625\" height=\"21\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88-1024x34.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88-300x10.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88-768x25.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88-624x21.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c88.png 1307w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h2><b>CSS \u2500 IMAGES<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">We can work with images in CSS in various ways, which include setting image backgrounds, controlling image dimensions, and handling responsive images. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">This property can take one of the following forms:<\/span><\/p>\n<p><strong>\u25cf Image Backgrounds: <\/strong>Using this property, we can set an image as the background of an element. This is commonly used for elements like divs and sections.<\/p>\n<pre><span style=\"font-weight: 400;\">.container {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-image: url('background.jpg');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Background Size: <\/strong>This property allows us to control the size of a background image. Common values include cover, contain, or specific dimensions.<\/p>\n<pre><span style=\"font-weight: 400;\">.container {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-image: url('background.jpg');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-size: cover;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Image Dimensions: <\/strong><span style=\"font-weight: 400;\">We can set the dimensions of an image by using this property. This is typically used with <\/span><span style=\"font-weight: 400;\">&lt;img&gt;<\/span><span style=\"font-weight: 400;\"> elements.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">img {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0width: 300px;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0height: 200px;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Responsive Images: <\/strong><span style=\"font-weight: 400;\">To make images responsive and prevent them from overflowing their parent containers, we can use this property.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">img {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0max-width: 100%;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0height: auto;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Image Opacity: <\/strong><span style=\"font-weight: 400;\">This property controls the transparency of an image. A value of <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\"> denotes completely transparent, and <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\"> denotes completely opaque.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">img {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0opacity: 0.5;\u00a0<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Image Position: <\/strong><span style=\"font-weight: 400;\">This is used to specify where the background image should be positioned within its container. We can use keywords like <\/span><span style=\"font-weight: 400;\">center<\/span><span style=\"font-weight: 400;\"> or specify percentages or lengths.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">.header {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-image: url('header.jpg');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-position: center top;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Image Filters: <\/strong><span style=\"font-weight: 400;\">This is used to apply various visual effects to images, such as blur, brightness, contrast, and more.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">img {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0filter: grayscale(50%) blur(3px);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Image Borders: <\/strong><span style=\"font-weight: 400;\">We can add borders around images using the <\/span><span style=\"font-weight: 400;\">border<\/span><span style=\"font-weight: 400;\"> property. This property specifies the border width, style, and color.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">img {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0border: 1px solid #ccc;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58507 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c99.png\" alt=\"\" width=\"791\" height=\"96\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c99.png 791w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c99-300x36.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c99-768x93.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c99-624x76.png 624w\" sizes=\"(max-width: 791px) 100vw, 791px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58492 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c10-1.png\" alt=\"\" width=\"621\" height=\"344\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c10-1.png 621w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c10-1-300x166.png 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58493 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-1024x331.png\" alt=\"\" width=\"625\" height=\"202\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-1024x331.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-300x97.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-768x248.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1-624x202.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c11-1.png 1083w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58494 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12-1024x408.png\" alt=\"\" width=\"625\" height=\"249\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12-1024x408.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12-300x120.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12-768x306.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12-624x249.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c12.png 1068w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h2><b>CSS \u2500 TABLES<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">In HTML and CSS, we can create and style tables to present tabular data in a structured and visually appealing way.\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;table&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0&lt;thead&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&lt;tr&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;th&gt;Header 1&lt;\/th&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;th&gt;Header 2&lt;\/th&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;th&gt;Header 3&lt;\/th&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/thead&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0&lt;tbody&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&lt;tr&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;td&gt;Data 1&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;td&gt;Data 2&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;td&gt;Data 3&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&lt;!-- More rows --&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0&lt;\/tbody&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;\/table&gt;<\/span><\/pre>\n<p><strong>\u25cf Table Borders: <\/strong>We can use this property in order to add borders to the table and its cells. This property ensures that adjacent table borders are merged.<\/p>\n<pre><span style=\"font-weight: 400;\">table {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0border-collapse: collapse;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">table, th, td {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0border: 1px solid #ddd;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Table Width and Alignment: <\/strong><span style=\"font-weight: 400;\">We can use this property to control the width of the table, and the <\/span><span style=\"font-weight: 400;\">text-align<\/span><span style=\"font-weight: 400;\"> property to align text within cells. For example:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">table {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0width: 100%;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">th, td {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0text-align: left;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Table Header Styles: <\/strong><span style=\"font-weight: 400;\">This is used to style the table header cells.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">th {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0background-color: #f2f2f2;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0color: #333;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0font-weight: bold;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Alternating Row Colors: <\/strong><span style=\"font-weight: 400;\">We can apply different background colors to alternate rows using the <\/span><span style=\"font-weight: 400;\">nth-child<\/span><span style=\"font-weight: 400;\"> pseudo-class.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">tr:nth-child(even) {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0background-color: #f2f2f2;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Hover Effects: <\/strong><span style=\"font-weight: 400;\">We can add hover effects to table rows or cells in order to provide feedback.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">tr:hover {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0background-color: #ddd;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Cell Padding and Margin: <\/strong>We can control the spacing within cells by using the padding property and the space between cells using the margin property.<\/p>\n<pre><span style=\"font-weight: 400;\">td {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0padding: 10px;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">table {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0margin: 20px;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Table Captions: <\/strong><span style=\"font-weight: 400;\">If our table has a caption, we can style it using this.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">caption {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0caption-side: bottom;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0font-size: 1.2em;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0color: #666;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><strong>\u25cf Responsive Tables: <\/strong>In order to make tables responsive on smaller screens, we can use CSS media queries and set the table to display as a block.<\/p>\n<pre><span style=\"font-weight: 400;\">@media (max-width: 600px) {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0table {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0display: block;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<pre><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58495 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c13.png\" alt=\"\" width=\"653\" height=\"507\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c13.png 653w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c13-300x233.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c13-624x484.png 624w\" sizes=\"(max-width: 653px) 100vw, 653px\" \/><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58496 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c14.png\" alt=\"\" width=\"682\" height=\"563\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c14.png 682w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c14-300x248.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c14-624x515.png 624w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58497 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15-1024x152.png\" alt=\"\" width=\"625\" height=\"93\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15-1024x152.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15-300x44.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15-768x114.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15-624x92.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c15.png 1304w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58498 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c16.png\" alt=\"\" width=\"460\" height=\"115\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c16.png 460w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c16-300x75.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-58499 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c17.png\" alt=\"\" width=\"447\" height=\"201\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/09\/c17.png 447w, \/blog\/wp-ttn-blog\/uploads\/2023\/09\/c17-300x135.png 300w\" sizes=\"(max-width: 447px) 100vw, 447px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4><strong>CONCLUSION:<\/strong><\/h4>\n<p><span style=\"font-weight: 400;\">CSS properties such as padding, margin, borders, images, and tables are essential for controlling the layout, spacing, appearance, and behavior of elements within a web page. They help in creating visually appealing and responsive designs. It also helps in improving the user experience on websites.\u00a0<\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>This blog is a continuation of the previous blog. CSS \u2500 PADDINGS The padding property in CSS is used to add space between the content of an element and its inner border. It is used to control the internal spacing. It only affects its size and layout and it does not affect the element&#8217;s border [&hellip;]<\/p>\n","protected":false},"author":1505,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":17},"categories":[3602,3429,1994,4488],"tags":[5448,245,4842,1665,5451,5450,5449,5452],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58509"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1505"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=58509"}],"version-history":[{"count":2,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58509\/revisions"}],"predecessor-version":[{"id":58579,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58509\/revisions\/58579"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=58509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=58509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=58509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}