[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-701113-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-701113-en":130,"doc-similar-701113":161},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","a-complete-guide-to-flexbox-css-flexbox-properties","A Complete Guide to Flexbox - CSS flexbox properties","","Comprehensive guide to CSS flexbox layout, covering the flex container and flex items in practical detail. Explains key parent properties such as display, flex-direction, flex-wrap, flex-flow, justify-content, and flex-basis, including how each affects the main and cross axes and how space is distributed when items overflow or have flexible sizing. Also details child-item properties including order, flex-grow, flex-shrink, flex shorthand, and align-self, with notes on defaults and invalid values.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/a-complete-guide-to-flexbox-css-flexbox-properties/701113/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/a-complete-guide-to-flexbox-css-flexbox-properties/701113.png","ImageObject",300,407,{"name":42,"@type":43},"Chumphorn","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-17","2026-11-12",true,{"@type":52,"interactionType":53,"userInteractionCount":33},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What does display: flex do in flexbox?","Question",{"text":62,"@type":63},"It turns an element into a flex container, enabling a flex context for all its direct children. The container can behave as block or inline depending on the chosen value.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How do flex-direction and flex-wrap work together?",{"text":67,"@type":63},"flex-direction sets the main axis direction, determining how flex items are placed. flex-wrap controls whether items stay on one line or wrap onto multiple lines as needed.",{"name":69,"@type":60,"acceptedAnswer":70},"What is the difference between flex-grow and flex-shrink?",{"text":71,"@type":63},"flex-grow controls how much a flex item can expand to use available free space, based on a unitless proportion. flex-shrink controls how much it can shrink when space is insufficient; it defaults to 1.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},701113,1794523516,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":33,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":105,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":79,"read_time":143,"preview_page_count":33,"preview_urls":144},2336475401981,"https://ap-avatar.wpscdn.com/avatar/22000c94efd8d5204d?x-image-process=image/resize,m_fixed,w_180,h_180&k=1786935347598174694","Guide  \nA Complete Guide to Flexbox  \nLast Updated  \nJun 12, 2020  \nOur comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) and the child elements (the flex items) . It also includes history, demos, patterns, and a browser support chart.  \n Background (\\#flexbox-background)  \n Basics & Terminology (\\#flexboxbasics)  \nProperties for the Parent (flex container)  \ndisplay  \nThis defines a flex container; inline or block depending on the given value. It enables a flex context for all its direct children.  \nCSS  \n.container {  \ndisplay: flex; /* or inline-flex */}  \nNote that CSS columns have no effect on a flex container.  \nflex-direction  \nGet the poster!  \nReference this guide a lot? Pin a copy up on the office wall.  \nBuy Poster (/product/css-flexbox-poster/)  \n(/product/css-flexboxposter/)  \nProperties for the Children (flex items)  \norder  \nBy default, flex items are laid out in the source order.  \nThis establishes the main-axis, thus defining the direction flex items are placed in the flex container. Flexbox is (aside from optional wrapping) a singledirection layout concept. Think offlex items as primarily laying out either in horizontal rows or vertical columns.  \nCSS  \n.container {  \nflex-direction : row | row-reverse | column | column-r}  \n• row (default): left to right in ltr ; right to left in rtl  \n• row-reverse : right to left in ltr ; left to right in rtl  \n• column : same as row but top to bottom  \n• column-reverse : same as row-reverse but bottom to top  \nflex-wrap  \nBy default, flex items will all try to fit onto one line. You can change that and allow the items to wrap as needed with this property.  \nCSS  \n.container {  \nflex-wrap : nowrap | wrap | wrap-reverse;  \nHowever, the order property controls the order in which they appear in the flex container.  \n\n| CSS\u003Cbr>.item {\u003Cbr>order: 5 ; /* default is 0 */\u003Cbr>} |\n| --- |\n| flex-grow\u003Cbr>This defines the ability for a flex item to grow if necessary. It accepts a unitless value that serves as a proportion. It dictates what amount of the available space inside the flex container the item should take up.\u003Cbr>If all items have flex-grow set to 1, the remaining space in the container will be distributed equally to all children. If one of the children has a value of 2, the remaining space would take up twice as much space as the others (or it will try to, at least) . |\n| CSS\u003Cbr>.item {\u003Cbr>flex-grow: 4; /* default 0 */\u003Cbr>} |\n| Negative numbers are invalid.\u003Cbr>flex-shrink\u003Cbr>This defines the ability for a flex item to shrink if necessary. |\n| CSS\u003Cbr>.item {\u003Cbr>flex-shrink: 3 ; /* default 1 */\u003Cbr>} |\n\n}  \na  \n\n| • nowrap (default): all flex items will be on one line\u003Cbr>• wrap : flex items will wrap onto multiple lines, from top to bottom.\u003Cbr>• wrap-reverse : flex items will wrap onto multiple lines from bottom to top.\u003Cbr>There are some visual demos offlex-wrap here ([https://css-tricks.com/almanac/properties/f/flex](https://css-tricks.com/almanac/properties/f/flex)wrap/) .\u003Cbr>flex-flow\u003Cbr>This is a shorthand for the flex-direction and flexwrap properties, which together define the flex container’s main and cross axes. The default value is row nowrap . |\n| --- |\n| CSS\u003Cbr>.container {\u003Cbr>flex-flow : column wrap ;\u003Cbr>} |\n| justify-content\u003Cbr>This defines the alignment along the main axis. It helps distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. It also exerts some control over the alignment of items when they overflow the line. |\n| CSS\u003Cbr>.container {\u003Cbr>justify-content : flex-start | flex-end | center | sp} |\n\nNegative numbers are invalid.  \nflex-basis  \nThis defines the default size of an element before the remaining space is distributed. It can be a length (e.g. 20%, 5rem, etc.) or a keyword. The auto keyword means“look at my width or heigh","cbCain5gwTCZ7Wmy","https://ap.wps.com/l/cbCain5gwTCZ7Wmy","pdf",758336,"English","# Background\n# Basics & Terminology\n# Properties for the Parent (flex container)\n## display\n## flex-direction\n## flex-wrap\n## flex-flow\n## justify-content\n## flex-basis\n## flex\n# Properties for the Children (flex items)\n## order\n## flex-grow\n## flex-shrink\n## align-self","[{\"question\":\"What does display: flex do in flexbox?\",\"answer\":\"It turns an element into a flex container, enabling a flex context for all its direct children. The container can behave as block or inline depending on the chosen value.\"},{\"question\":\"How do flex-direction and flex-wrap work together?\",\"answer\":\"flex-direction sets the main axis direction, determining how flex items are placed. flex-wrap controls whether items stay on one line or wrap onto multiple lines as needed.\"},{\"question\":\"What is the difference between flex-grow and flex-shrink?\",\"answer\":\"flex-grow controls how much a flex item can expand to use available free space, based on a unitless proportion. flex-shrink controls how much it can shrink when space is insufficient; it defaults to 1.\"}]","A Complete Guide to Flexbox - CSS flexbox properties | PDF",18,[145,149,153,157],{"page_no":22,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/06b00db6d1b0b59fa748998898bf3c80.webp",983,1272,{"page_no":26,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/9ff64258c2365804e0fb8507cde0244e.webp",982,1270,{"page_no":30,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/0edd3c8d4b3296424441169bbf961d94.webp",981,1269,{"page_no":33,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/517d5b00c9a6991b739f4264323d15b9.webp",980,1268,{"list":162,"token":11},[163,169,175,181,187,193,199,205,211,217],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":96,"category_name":29,"create_tm":168},701117,"Flexbox in CSS - O’Reilly Media Book","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230011579048/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=WcfMLGgM2I80hwK%2FexgYaErpAxY%3D","flexbox-in-css-oreilly-media-book",1794523532,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":30,"category_name":29,"create_tm":174},701112,"Understanding Flexbox - CSS Flexbox Basics and Layout Building","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012050509/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=fzR31bCBIZuj1xlxV0BrlAcrVLk%3D","understanding-flexbox-css-flexbox-basics-and-layout-building",1794523515,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":105,"category_name":29,"create_tm":180},703160,"CSS in Depth - Second Edition - comprehensive CSS learning guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230013426146/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=GRT0OjFxVtTduhILNpIQGSeFF1g%3D","css-in-depth-second-edition-comprehensive-css-learning-guide",1794561904,{"doc_id":182,"doc_title":183,"file_type":137,"home_preview_img_url":184,"slug":185,"view_count":96,"category_name":29,"create_tm":186},693034,"CSS Handbook","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230005053838/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=nPIKWgCdMvKnBYr9pFgPfx0N64E%3D","css-handbook",1794246437,{"doc_id":188,"doc_title":189,"file_type":137,"home_preview_img_url":190,"slug":191,"view_count":33,"category_name":29,"create_tm":192},701118,"CS193X: Web Programming Fundamentals - Lecture 5 - Spring 2017","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230011579050/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=vkSz9iT9hlLoZ%2FxxBRngScDAyNg%3D","cs193x-web-programming-fundamentals-lecture-5-spring-2017",1794523552,{"doc_id":194,"doc_title":195,"file_type":137,"home_preview_img_url":196,"slug":197,"view_count":30,"category_name":29,"create_tm":198},701114,"Introducing CSS Flexbox Layout - read online free","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012050525/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=yOvHaSa%2BYHdvzj3VizUqgOQxehg%3D","introducing-css-flexbox-layout-read-online-free",1794523525,{"doc_id":200,"doc_title":201,"file_type":137,"home_preview_img_url":202,"slug":203,"view_count":33,"category_name":29,"create_tm":204},699456,"CSS Properties - CSS Property Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010042151/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=H%2BbWajRWowWZpCQEE9oBdMUfv8Y%3D","css-properties-css-property-reference",1794468351,{"doc_id":206,"doc_title":207,"file_type":137,"home_preview_img_url":208,"slug":209,"view_count":101,"category_name":29,"create_tm":210},703161,"Cascading Style Sheets (CSS) Course Syllabus","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230013426121/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=70HmbeNomKtaP8Frh0VETbOMCtI%3D","cascading-style-sheets-css-course-syllabus",1794561905,{"doc_id":212,"doc_title":213,"file_type":137,"home_preview_img_url":214,"slug":215,"view_count":33,"category_name":29,"create_tm":216},693038,"HTML Styles-CSS - learn cascading style sheets","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230005053917/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=OGgGTYmMdfj%2B20jmdUWUIQMedBw%3D","html-styles-css-learn-cascading-style-sheets",1794246445,{"doc_id":218,"doc_title":219,"file_type":137,"home_preview_img_url":220,"slug":221,"view_count":101,"category_name":29,"create_tm":222},693037,"Cascading Style Sheets (CSS) - CS142 Lecture Notes - CSS 1 - Driving problem behind CSS","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230004257728/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112059&Signature=p8MPEW9LQrvx5T7GrqBkMQ%2FKSpo%3D","cascading-style-sheets-css-cs142-lecture-notes-css-1-driving-problem-behind-css",1794246439]