{"id":7175,"date":"2021-07-29T12:53:53","date_gmt":"2021-07-29T12:53:53","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=7175"},"modified":"2022-04-13T16:34:32","modified_gmt":"2022-04-13T16:34:32","slug":"how-an-element-should-display-in-css","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/","title":{"rendered":"How an element should display in CSS?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This property is used to define how an element should display. Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>inline<\/td><td>table-row-group<\/td><\/tr><tr><td>block<\/td><td>table-caption<\/td><\/tr><tr><td>flex<\/td><td>table-column-group<\/td><\/tr><tr><td>inline-block<\/td><td>table-header-group<\/td><\/tr><tr><td>inline-flex<\/td><td>table-footer-group<\/td><\/tr><tr><td>inline-table<\/td><td>table-cell<\/td><\/tr><tr><td>list-item<\/td><td>table-column<\/td><\/tr><tr><td>run-in<\/td><td>table-row<\/td><\/tr><tr><td>table<\/td><td>none<\/td><\/tr><\/tbody><\/table><figcaption><strong>p { display: inline; }<\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png\" alt=\"How to use the top 5 CSS display values: none, block, inline-block, table,  and flex\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Block-level Elements<\/strong>&#8211;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Block-level element always starts on a new line and takes up the full width available.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ex: &#8211;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;div&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;h1&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0&lt;p><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wonderfulengineering.com\/wp-content\/uploads\/2021\/03\/sublime-syntax-1024x614-1024x614-1.jpg\" alt=\"Best JavaScript Development Services Provided by Developers\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Inline Elements<\/strong>&#8211;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An inline element does not start on a new line and only takes up as much width as necessary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ex: &#8211;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;span&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;a&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.udacity.com\/blog\/wp-content\/uploads\/2021\/06\/CSSImageGallery1.png\" alt=\"The Easy Guide to Building A CSS Image Gallery | Udacity\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Display<\/strong>&#8211;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>inline<\/strong> \u2013 When we set this value, the element does not start on a new line and only takes up as much width as necessary (we can\u2019t set width\/height it won\u2019t work)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>block<\/strong> \u2013 When we set this value, element always starts on a new line and takes up the full width available (we can set width\/height)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>inline-block<\/strong> \u2013 It is combination of inline and block value. It doesn\u2019t start on new line but we can set width and height.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>none <\/strong>&#8211; The element will not be displayed at all (has no effect on layout)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>flex<\/strong> &#8211; Displays an element as a block-level flex container.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>inline-flex<\/strong> &#8211;\u00a0 Displays an element as an inline-level flex container.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>inline-table<\/strong> &#8211; The element is displayed as an inline-level table\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2022<strong>run-in<\/strong> &#8211; Displays an element as either block or inline, depending on context<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to use Display?<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>table \u2013 It works like a element<\/li><li>table-caption &#8211; It works like a element<\/li><li>table-header-group &#8211; It works like a element<\/li><li>table-footer-group &#8211; It works like a element<\/li><li>table-row-group &#8211; It works like a element<\/li><li>table-cell &#8211; It works like a element<\/li><li>table-row &#8211; It works like a element<\/li><li>list-item &#8211; It works like a element<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This property is used to define how an element should display. Every HTML element has a default display value depending [&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":[5134,5480,5461,4459,5455,5712],"class_list":["post-7175","post","type-post","status-publish","format-standard","hentry","category-css","tag-css","tag-display","tag-element","tag-html","tag-inline","tag-table"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How an element should display in 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-an-element-should-display-in-css\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How an element should display in CSS? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"This property is used to define how an element should display. Every HTML element has a default display value depending [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-29T12:53:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:34:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png\" \/>\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-an-element-should-display-in-css\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"How an element should display in CSS?\",\"datePublished\":\"2021-07-29T12:53:53+00:00\",\"dateModified\":\"2022-04-13T16:34:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/\"},\"wordCount\":325,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/daqxzxzy8xq3u.cloudfront.net\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/20122804\\\/display-block-example-css-code-2.png\",\"keywords\":[\"css\",\"display\",\"element\",\"HTML\",\"inline\",\"table\"],\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/\",\"name\":\"How an element should display in CSS? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/daqxzxzy8xq3u.cloudfront.net\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/20122804\\\/display-block-example-css-code-2.png\",\"datePublished\":\"2021-07-29T12:53:53+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-an-element-should-display-in-css\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#primaryimage\",\"url\":\"https:\\\/\\\/daqxzxzy8xq3u.cloudfront.net\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/20122804\\\/display-block-example-css-code-2.png\",\"contentUrl\":\"https:\\\/\\\/daqxzxzy8xq3u.cloudfront.net\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/20122804\\\/display-block-example-css-code-2.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-an-element-should-display-in-css\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How an element should display in 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 an element should display in 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-an-element-should-display-in-css\/","og_locale":"en_US","og_type":"article","og_title":"How an element should display in CSS? - scmGalaxy","og_description":"This property is used to define how an element should display. Every HTML element has a default display value depending [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/","og_site_name":"scmGalaxy","article_published_time":"2021-07-29T12:53:53+00:00","article_modified_time":"2022-04-13T16:34:32+00:00","og_image":[{"url":"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png","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-an-element-should-display-in-css\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"How an element should display in CSS?","datePublished":"2021-07-29T12:53:53+00:00","dateModified":"2022-04-13T16:34:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/"},"wordCount":325,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#primaryimage"},"thumbnailUrl":"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png","keywords":["css","display","element","HTML","inline","table"],"articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/","name":"How an element should display in CSS? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#primaryimage"},"thumbnailUrl":"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png","datePublished":"2021-07-29T12:53:53+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-an-element-should-display-in-css\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#primaryimage","url":"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png","contentUrl":"https:\/\/daqxzxzy8xq3u.cloudfront.net\/wp-content\/uploads\/2019\/05\/20122804\/display-block-example-css-code-2.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-an-element-should-display-in-css\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How an element should display in 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\/7175","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=7175"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7175\/revisions"}],"predecessor-version":[{"id":7178,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7175\/revisions\/7178"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=7175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=7175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=7175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}