{"id":325,"date":"2023-12-28T21:48:31","date_gmt":"2023-12-28T21:48:31","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=325"},"modified":"2023-12-28T21:48:31","modified_gmt":"2023-12-28T21:48:31","slug":"vertical-centering-in-a-block-level-element","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/vertical-centering-in-a-block-level-element\/","title":{"rendered":"Vertical Centering in a Block-Level Element"},"content":{"rendered":"\n<p>Rachel Andrew, blowing my mind a bit:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The\u00a0<code>align-content<\/code>\u00a0property from the Box Alignment spec does the job, however browsers require that you make the parent element either a flex or a grid layout. While the property was specified to work in block layout, no browser had implemented it, until now.<\/p>\n<cite><a href=\"https:\/\/rachelandrew.co.uk\/archives\/2023\/12\/19\/align-content-in-block-layout\/\">align-content in block layout<\/a><\/cite><\/blockquote>\n\n\n\n<p>So now we can vertically center an element without <em>having<\/em> to reach for grid or flexbox. <\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_GRzVVRz\" src=\"\/\/codepen.io\/anon\/embed\/GRzVVRz?height=450&amp;theme-id=47434&amp;slug-hash=GRzVVRz&amp;default-tab=css,result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed GRzVVRz\" title=\"CodePen Embed GRzVVRz\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>Ollie Williams covered the news as well in <a href=\"https:\/\/fullystacked.net\/vertical-alignment\/?ck_subscriber_id=2246502080\">Easy vertical alignment without flexbox<\/a>, and also notes:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><code>align-content<\/code>\u00a0now also works for elements with a\u00a0<code>display<\/code>\u00a0of\u00a0<code>table-cell<\/code>\u00a0or\u00a0<code>list-item<\/code>.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Rachel Andrew, blowing my mind a bit: The\u00a0align-content\u00a0property from the Box Alignment spec does the job, however browsers require that you make the parent element either a flex or a grid layout. While the property was specified to work in block layout, no browser had implemented it, until now. align-content in block layout So now [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":327,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[7,53],"class_list":["post-325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-css","tag-layout"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2023\/12\/centered-thumb.jpg?fit=1000%2C500&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=325"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/325\/revisions\/328"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/327"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}