Back to Explore
GuideVibeFix editorialUpdated Nov 20, 2026

Stop shimming with margins: Flexbox one-dimensional layout, explained plainly

Flexbox lays things out in one direction at a time, and when it is done right, the nav bar, the card wall, and the cart rows all behave. This guide follows MDN's Basic concepts of flexbox, Aligning items in a flex container, and Controlling ratios of flex items along the main axis: the two axes, containers and items, direction and wrapping, free space, the three flex properties, alignment on both axes, and gaps and auto margins.

Real photo: a woman in an office sticking colorful sticky notes in rows on a white wall, holding a pink note in her hand

Let me set the boundaries first. This site already has a CSS Grid layout guide, which covers two-dimensional layout: rows and columns arranged together. This guide does not cover Grid. It covers one thing: Flexbox, which is one-dimensional layout — one direction at a time, either a row or a column. The "Greenstone Cafe" below is the same fictional practice project as before: a small web tool that helps a street-corner cafe take orders. Earlier guides covered how its order page handles logic, splits modules, draws Canvas pictures, and names elements with selectors; this time we look at how the page is arranged: the navigation bar with the shop name on the left and the cart on the right, rows of dish cards on the order page and how they line up, and how each line in the cart drawer puts the dish name and the price at opposite ends. Every operation, code sample, and number that uses the cafe as an example was made up to explain how things work; none of it is a real record. Everything about Flexbox syntax and behavior comes from three official MDN documents — "Basic concepts of flexbox", "Aligning items in a flex container", and "Controlling ratios of flex items along the main axis" — listed in each article's meta information and evidence record. The examples from the documents, such as three 100-pixel items in a 500-pixel container, the One Two Three boxes, and margin-left: auto pushing the fourth item to the right, are the documents' own examples, not a real service. This guide does not go deep into choosing between Grid and Flexbox beyond the basic distinction, nor into the full rules of writing modes or multi-column layout. It covers the set beginners use every day: the two axes, containers and items, direction and wrapping, free space, the three flex properties, alignment on both axes, and gaps and auto margins. When you finish, you should be able to do four things: build a flex container, work out where the free space goes, center a row of things or push them to opposite ends, and know which properties to check first when a layout goes wrong.

Step 1: Forget up, down, left, and right — remember the two axes

Working with Flexbox starts with a different sense of direction: stop thinking in up, down, left, and right, and think in two axes — the main axis and the cross axis. MDN's "Basic concepts of flexbox" states this plainly at the start: everything we do with Flexbox refers back to these axes, so it is worth understanding how they work from the outset. The main axis is defined by the flex-direction property, which has four possible values: row, row-reverse, column, and column-reverse. Choose row or row-reverse and the main axis runs along the row, in the inline direction of the text; choose column or column-reverse and the main axis runs in the block direction, from the top of the page to the bottom. The cross axis runs perpendicular to the main axis: when the main axis is row, the cross axis runs down the columns; when the main axis is column, the cross axis runs along the rows. There is another idea here that is easy to miss: Flexbox makes no assumption about the writing mode of the document. It does not assume that all lines of text start at the top left and run toward the right, with new lines appearing one under the other; like other logical properties, it supports all writing modes. The document's example makes this concrete: with flex-direction row in English, the start edge of the main axis is on the left and the end edge on the right; in Arabic, the start edge is on the right and the end edge on the left; in both cases the start edge of the cross axis is at the top and the end edge at the bottom, because both languages have a horizontal writing mode. That is why Flexbox talks about start and end instead of left and right, top and bottom. It feels strange at first, becomes natural after a while, and the same vocabulary carries over to CSS Grid Layout. The cafe order page's navigation bar is one horizontal axis: the shop name on the left, the search box in the middle, the cart on the right, with the start on the left; the dish list on the order page runs vertically, so its main axis is the block direction from top to bottom. Work out which axis is the main axis first, and the alignment properties will stop being used backwards.

Step 2: Write display: flex, and the direct children become flex items

Creating a flex container takes one line: display: flex. MDN defines it this way: an area of a document that is laid out using Flexbox is called a flex container, and to create one, set the area's display property to flex. When you do this, the direct children of that container become flex items. You can explicitly control whether the container itself is displayed inline or in a block formatting context, using inline-flex for inline flex containers or flex for block-level flex containers. With only display: flex written and nothing else, the contents behave according to a set of initial values, which MDN lists one by one and which are worth memorizing: items display in a row, because the flex-direction property's default value is row; the items start from the start edge of the main axis; the items do not stretch on the main dimension but can shrink, because a flex item's flex-grow property defaults to 0 and its flex-shrink property defaults to 1; the items will stretch to fill the size of the cross axis, because the align-items property defaults to stretch; the flex item's flex-basis property defaults to auto, which means it equals the flex item's width in horizontal writing mode and its height in vertical writing mode, or the content size if width and height are also auto; and all the items will be in a single row, because the flex-wrap property defaults to nowrap, so they overflow their container if their combined width or height exceeds the containing element. The result is that all your items line up in a row, each taking only as much space on the main axis as its content needs, and if there are more items than fit, they do not wrap but overflow instead; if some items are taller than others, all items stretch along the full length of the cross axis. The order page's navigation bar is built exactly this way: nav gets display: flex, and its three direct children — the shop name, the search box, and the cart — immediately sit in a row; inside a dish card, the dish name and the price are two spans, and the div wrapping them gets display: flex so the two spans sit side by side. Remember the words "direct children": grandchildren do not count, only children become items, and if you want to lay out the grandchildren, the child needs its own container.

Step 3: flex-direction has four values, and each changes the main axis

The direction of the main axis is set by flex-direction, and each of its four values lays things out differently. Write row and the items run along the row from start to end — this is the default. Write row-reverse and the items still run along the row, but the start and end lines are switched, so the visual order is completely reversed and the first item ends up on the far right. Write column and the main axis switches to the vertical direction, with items running from top to bottom. Write column-reverse and the start and end lines switch again, with items running from bottom to top. MDN's demo uses the same three boxes — One, Two, Three — and swaps the four values, with the layout changing and nothing else moving. On the order page, the dish category tabs sit in a horizontal row on desktop using row; on a phone they stack vertically, and changing it to column does the job without touching a single character of HTML. row-reverse has a use on the order page too: in the cart drawer's title row, the close button sits on the right and the words "Shopping cart" on the left, and row-reverse lets the HTML list the title first and the button second while the button still appears on the left visually — though this is confusing to read, so a team should agree on it before using it. column-reverse needs even more care: the visual order and the HTML order, including keyboard Tab order, end up opposite each other, and a screen reader still reads the HTML order, so the visual order and the spoken order disagree — avoid it when you can. The rule for this step is one line: flex-direction only changes the direction of the main axis, not the size of the items or how they align, but once the direction changes, what "main axis" and "cross axis" mean for the alignment properties changes with it.

Step 4: flex-wrap controls wrapping, and flex-flow is a shorthand for two properties

Flexbox is a one-dimensional model, but it is possible to make flex items wrap across multiple lines. MDN's advice is that when you do this, you should consider each line as a new flex container: any space distribution happens across each line, without reference to the previous or subsequent lines. To get wrapping behavior, add the flex-wrap property with a value of wrap: when the items are too large to all display in one line, they wrap onto another line. In the document's example, three items 200 pixels wide sit in a container 500 pixels wide: with wrap set, the third item moves to the second line; with nowrap, which is the initial value, the items shrink to fit the container first, because they use the initial flexbox values including flex-shrink: 1, and only overflow if they cannot shrink, or cannot shrink small enough. The dish card wall on the order page is the classic use for wrap: four cards per row on desktop, automatically dropping to three, then two, as the window narrows, with the cards falling to the next line on their own and no media query needed to count them; each line in the cart drawer, by contrast, must not wrap, so it uses nowrap and lets a long dish name shrink rather than pushing the price onto the next line. flex-direction and flex-wrap can be combined into the flex-flow shorthand: flex-flow: row wrap means the direction is row and wrapping is allowed, with the first value being the flex-direction value and the second the flex-wrap value. Keep the order right when writing the shorthand. Wrapping has one companion trap: once items wrap, alignment between the lines is no longer align-items' job — that belongs to align-content, covered in step 12.

Step 5: Whether the free space is positive or negative decides grow versus shrink

Before flex-grow and flex-shrink make sense, you need the idea of free space. MDN's "Controlling ratios" guide defines it as the difference between the combined natural size of all the flex items along the main axis and the size of the main axis itself. It comes in two signs: when the container has more space than required to display the flex items, that is positive free space; when the combined natural sizes are larger than the available space, that is negative free space. The document's example works it out plainly: a 500-pixel-wide container with flex-direction row holding three 100-pixel-wide items needs 300 pixels to lay the items out, leaving 200 pixels of positive free space, which can be distributed between the items if filling the container is desired. If the three items are each 200 pixels wide instead, their combined natural width is 600 pixels, resulting in 100 pixels of negative free space, which can be removed from the items to make them fit, or the items will overflow. The order page's navigation bar is an arithmetic problem of the same kind: a container 900 pixels wide holds a shop name of 120 pixels, a search box of 400 pixels, and a cart button of 100 pixels, adding up to 620 pixels and leaving 280 pixels of positive free space — whether the search box grows to eat it or it stays on the right as blank space depends on steps 6 to 8; on a phone the container is only 360 pixels wide, the three things still add up to 620 pixels, and the 260 pixels of negative free space force a decision about who shrinks and by how much. Remember the test: if the items' sizes add up to less than the container, there is positive free space and flex-grow takes the stage; if they add up to more than the container, there is negative free space and flex-shrink takes the stage. Each property handles one side, and they never fight over the same job.

Step 6: flex-basis is the starting size before any space is shared out

The flex-basis property specifies the initial size of a flex item before any distribution of the positive or negative free space happens. Its initial value is auto, it accepts the same values as the width and height properties, and it also accepts the content keyword. MDN's rules split into three cases. If flex-basis is set to auto, the initial size of the item is the length-percentage size of the main size, if any was set — for example, if the item has width: 200px set, then 200px would be the flex-basis for this item; percentage values are relative to the flex container's inner main size, so width: 50% would make the flex-basis half of the container's content-box width; if no such size is set, meaning the item is auto-sized, then auto resolves to the size of its content, so the flex-basis is the item's max-content size. In the document's example, three inflexible items have both flex-grow and flex-shrink set to 0: the first item, with an explicit width of 150px, takes a flex-basis of 150px, while the other two have no width set and are sized according to their content width, or max-content. The content keyword as a flex-basis bases the flex-basis on the content size even if a width is set, which creates the same effect as removing any width set and using auto as the flex-basis, while also letting any aspect-ratio be calculated based on the cross-axis size. To completely ignore the size of the flex item during space distribution, set flex-basis to 0 and set a non-zero flex-grow value — step 7 shows that trick in action. On the order page, dish cards use a flex-basis of 200px, meaning each card counts as 200 pixels before space is shared out; the search box uses a flex-basis of auto, meaning it counts by its own content width first, and then the remaining space is divided. flex-basis is not width: it is "count this size before sharing the space out", and after the sharing the item's actual size may be larger or smaller than it, so do not treat the two as the same thing.

Step 7: flex-grow shares positive free space by ratio — and different bases give different results

The flex-grow property specifies the flex grow factor, which determines how much a flex item will grow relative to the other flex items in the flex container when positive free space is distributed. MDN's rule is that if all items have the same flex-grow factor, the positive free space will be distributed evenly among them, and it is a ratio: setting flex-grow: 1 is common practice, but you could give them any value, such as 88, 100, or 1.2, and equal factors still mean equal shares. The document works through the 500-pixel container with three 100-pixel items: the positive free space is 200 pixels, and with flex-grow of 1 on all three items, each gets a third of it; give the first item a flex-grow of 2 and the other two a value of 1 each, and there are 4 parts in total — the first item gets 2 parts of the available space (100 pixels out of 200) and the other two get 1 part each (50 pixels each). But there is a trap in how flex-grow and flex-basis interact. Take three items of different content lengths, all with flex: 1 1 auto: the flex-basis is auto, the items have no width set, so they are auto-sized and the flex-basis used is the max-content size of each item. After laying out the items, the remaining positive free space is shared equally between the three items — but each item starts from its own content width, so the biggest item remains the largest, because it started from a bigger size even though it got the same amount of spare space as the others. To create three equally-sized items even if the original elements have different sizes, set the flex-basis component to 0: with flex: 1 1 0, the size of each item is set to 0 for the purpose of the space-sharing calculation, so all the space is available for distribution, and since all the items have the same flex-grow factor, they each get an equal amount of space. The document also shows how to make differently sized items with different flex-grow factors: keeping flex-basis at 0, the first two items get a flex-grow of 1 and the third gets 2, for a total of 4 parts, so the third item ends up twice the size of the first and second — and changing the values to .25, .25, and .50 gives the same result, because only the ratio matters. On the order page, the dish card wall uses flex: 1 1 0, so four cards in a row come out the same width; in the cart drawer, the dish name column is flex: 2 1 0 while quantity and price are each flex: 1 1 0, so the name column is twice as wide as the others.

Step 8: The flex shorthand takes three values in order, and four preset values cover most cases

The three properties flex-grow, flex-shrink, and flex-basis are very rarely used individually; instead they are combined into the flex shorthand, which allows you to set the three values in this order — flex-grow, flex-shrink, flex-basis. For example, flex: 2 1 auto sets flex-grow to 2, flex-shrink to 1, and flex-basis to auto. MDN also lists four predefined shorthand values that cover most use cases and that you will often see in tutorials. flex: initial resets the item to the initial values of the three longhand properties, which is the same as flex: 0 1 auto: the initial value of flex-grow is 0, so items will not grow larger than their flex-basis size; the initial value of flex-shrink is 1, so items can shrink if they need to rather than overflowing; and the initial value of flex-basis is auto, so items either use any size set on the item in the main dimension or get their size from the content size. Using flex: auto is the same as using flex: 1 1 auto: similar to flex: initial, except that the items can grow and fill the container as well as shrink if needed. Using flex: none creates fully inflexible flex items — it is as if you wrote flex: 0 0 auto — the items cannot grow or shrink and are laid out using flexbox with a flex-basis of auto. The shorthand you often see in tutorials is flex: 1 or flex: 2 and so on: this is the same as writing flex: 1 1 0 or flex: 2 1 0 respectively. The items get minimum size due to flex-basis: 0 and then proportionally grow to fill the available space; in this case the flex-shrink value of 1 is redundant because the items start with minimum size and are not given any size that could cause them to overflow the flex container. MDN's reminder is that these values are proportions: if you had all items set to flex: 1 1 200px and wanted one item to grow at twice the rate, you would set that item to flex: 2 1 200px — but you could also use flex: 10 1 200px and flex: 20 1 200px, since only the ratio matters. The order page's rule is: the card wall uses flex: 1, meaning every card starts at 0 and shares the space equally; the "today's special" card uses flex: 2, making it twice as wide as the others; and the shop name in the navigation bar uses flex: none, meaning it never grows or shrinks and always stays exactly as wide as its own content.

Step 9: flex-shrink removes negative free space by ratio, but never below the content's minimum

Where flex-grow adds space, flex-shrink removes it. MDN defines it this way: the flex-shrink property specifies the flex shrink factor, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when negative free space is distributed. It deals with situations where the combined flex-basis value of the flex items is too large to fit in the flex container and would otherwise overflow: as long as an item's flex-shrink is a positive value, the item will shrink to not overflow the container. In the document's example, three 200-pixel-wide items sit in a 500-pixel-wide container: with flex-shrink set to 0, the items are not allowed to shrink, so they overflow the container; change the flex-shrink value to 1, and each item shrinks by the same amount, fitting all the items into the container, with the negative free space proportionally removed from each item. But flex-shrink works differently from flex-grow in one important way: the concept of flex base size affects how negative space is distributed, because the flex shrink factor is multiplied by the flex base size when distributing negative space. This distributes negative space in proportion to how much the item is able to shrink, so a small item will not shrink to zero before a larger item has been noticeably reduced. And there is a floor: small items will not shrink to less than their min-content size, which is the smallest size the element can be if it used all of the available soft-wrapping opportunities — essentially, the longest word in its content dictates the size. In the document's example, the first two items have short content and the third has much more: as the container gets smaller, the first two items wrap and shrink, but they never become smaller than their min-content size, and when the container gets small, the space is only removed from the third item when shrunken further. Different flex-shrink factors work the same way as with flex-grow: in the document's example, the first item has a factor of 1, the second 0 (so it will not shrink at all), and the third 4, making a total of 5 shrink factors, so the third item shrinks approximately four times more rapidly than the first — but neither will shrink below its min-content width. On the order page, the dish name column has a flex-shrink of 1 and shrinks fastest; the price column has a flex-shrink of 0, so it never gives up a cent and never shrinks; the quantity column has a flex-shrink of 1 and shrinks along. When writing flex-shrink, ask first: if this thing shrinks to its minimum, can it still be recognized? Prices and buttons cannot shrink; dish names can, and they stop at their min-content floor.

Step 10: align-items handles the cross axis, and align-self makes an exception for one item

Alignment is split by axis: justify-content handles the main axis and align-items handles the cross axis, and both properties are set on the flex container, not on the items themselves. MDN's "Basic concepts" guide introduces align-items first: it aligns all the flex items on the cross axis, and its initial value is stretch — which is why flex items stretch to the height of the flex container by default, or to the width if flex-direction is set to column or column-reverse. This height may come from the tallest item in the container or the size set on the flex container itself. Other values line things up differently: flex-start, or simply start, lines items up at the start of the flex container; flex-end, or just end, aligns them to the end; center aligns them in the center; and baseline aligns them by their text baselines. In MDN's demo, the flex container is given a height so you can see how the items can be moved around inside it, and the third item, with its extra lines of text, makes the effect most visible. align-items is set on the container and impacts all the flex items, so if you want to align one flex item differently from the others, you set align-self on that item: it accepts all of the same values as align-items, plus a value of auto, which resets the value to that defined on the flex container. In the document's example, the container uses align-items: flex-start, the first item gets align-self: stretch through a .box > *:first-child rule and fills the full height, and the item with the selected class gets align-self: center and sits in the middle. One more thing that is easy to get backwards: change flex-direction to column and the cross axis switches from vertical to horizontal, so align-items and align-self now align items left and right instead of top and bottom — the same properties, but the axis has moved and the effect moves with it. On the order page, the image and text inside a dish card stretch to the same height by default; changing it to align-items: flex-start lets the image take only its own content height; and the price in each cart drawer line uses align-self: center to sit vertically centered without anyone having to calculate margins.

Step 11: justify-content handles the main axis — centering takes both properties together

On the main axis there is only one alignment property available: justify-content. This is because we are only dealing with items as a group on that axis, and with justify-content we control what happens with available space, should there be more space than is needed to display the items. Its initial value is normal, which behaves as start: items line up at the start edge of the container, and any available space is placed at the end of the items. Other values change the arrangement: flex-end lines items up at the end, center lines them up in the center; space-between takes all the spare space after the items have been laid out and shares it out evenly between the items, so there is an equal amount of space between each item and the first and last items sit flush with the start and end; space-around gives an equal amount of space on the right and left (or top and bottom for columns) of each item, with items having a half-size space on either end; space-evenly gives items equal space around them, with a full-size space on either end. The document also lists start, end, left, right, and stretch among the values, but space-between, space-around, and space-evenly are the three that do most of the work when laying out navigation bars and card rows. The classic use is centering: to center one element inside a container both horizontally and vertically, write align-items: center and justify-content: center together — the first handles the cross axis, the second the main axis, and leaving one out centers only one direction. MDN opens with exactly this example: a 100-by-100-pixel box inside a container, and however large the container becomes, the box always stays in the exact middle. Two details are worth remembering: the values start and end are writing-mode-aware, so in English left-to-right writing, start is the left side, while in Arabic right-to-left writing, start is the right side; and flex-start and flex-end are also affected by flex-direction — with flex-direction: row-reverse and justify-content: flex-end, items in a left-to-right language line up on the left, and the visual order of the items is reversed. On the order page, the navigation bar uses justify-content: space-between, so the shop name hugs the left, the cart hugs the right, and the gap in the middle divides itself; the category tabs at the top of the order page use justify-content: center, so the row of tabs sits centered; and the cart drawer's empty-state message uses align-items: center plus justify-content: center, so a single sentence sits steadily in the exact middle.

Step 12: align-content only works with multiple lines — use gap for spacing and auto margins to push things aside

The align-items and justify-content properties from the previous steps arrange items inside a single line. Once items wrap, the space between the lines belongs to align-content. MDN's condition is that for align-content to have an effect, the cross-axis dimension of the flex container (the height, in the usual case) must be greater than needed to display the items, so there is extra space to distribute — and it works on all the items as a set. Its values are much like justify-content's: flex-start, flex-end, start, end, center, space-between, space-around, space-evenly, stretch, and normal, which behaves as stretch. In the document's example, the container is 300 pixels tall, the items wrap across several lines, and align-content: space-between shares the available space out between the flex lines, which sit flush with the start and end of the container on the cross axis. Writing align-content on a single-line container does nothing, because there is only one line and no space between lines to distribute — a common beginner mistake. For the gaps between items and between flex lines, MDN recommends the gap, column-gap, and row-gap properties: column-gap creates gaps between items in a row, row-gap creates gaps between flex lines when flex-wrap is set to wrap, and gap is a shorthand that sets both row-gap and column-gap. When gap takes two values, their order depends on the direction: if flex-direction creates rows, the first value defines the gap between flex lines and the second defines the gap between items within each line; with columns (flex-direction column or column-reverse), the first value defines the gap between flex items and the second defines the gaps between flex lines. There is one more way to align individual items on the main axis: auto margins. There is no justify-self on the main axis, because items are treated as a group there, but it is possible to separate an item or a group of items from the others by using auto margins along with Flexbox. The document's example is a navigation bar with three items on one side and two on the other: instead of a second container, the fourth item gets margin-left: auto, which consumes all the space it can in its axis and pushes itself and everything after it to the right — the same mechanism as centering a block with margin auto on the left and right, where each side tries to take as much space as it can and the block is pushed into the middle. Two footnotes to finish: the justify-items property is ignored in flexbox layouts, and place-content is a shorthand for align-content and justify-content while place-items is a shorthand for align-items and justify-items — set on a flex container, place-items sets the alignment but not the justification, because justify-items is ignored in flexbox. The chart below shows a fictional count of Flexbox layout mistakes on the Greenstone Cafe order page over one month: 124 in total. Forgetting to write display: flex, so the container never became a flex container at all, leads with 25 (20.2%); mixing up the main and cross axes and using justify-content and align-items on the wrong axis follows with 23 (18.5%); writing flex: 1 on three items that still came out different widths, forgetting that flex-basis is the content width, with 21 (16.9%); centering with only justify-content, so nothing moved vertically, with 18 (14.5%); content overflowing because flex-wrap was forgotten, with 15 (12.1%); spacing done entirely with margins, so the margins broke after wrapping, with 12 (9.7%); and align-content written on a single-line container, where it does nothing, with 10 (8.1%). 25 + 23 + 21 + 18 + 15 + 12 + 10 equals 124, and the percentages add up to 100.0%, so the books balance. The top three mistakes are all about not understanding the axes and the free space; the last four are about using a property in the wrong place.

Bar chart: fictional breakdown of 124 Flexbox layout mistakes in one month on the Greenstone Cafe order page, with forgetting display:flex at 25 the largest group

Here is a checklist to run through, in order, when a layout goes wrong. First, did the container get display: flex? Without it, none of the flex properties inside do anything, so add that line first. Second, which axis is the main axis? Check whether flex-direction is row or column: justify-content handles the main axis and align-items handles the cross axis, so do not use them backwards. Third, do the items' sizes add up to more or less than the container? Less than the container means positive free space, so look at flex-grow; more than the container means negative free space, so look at flex-shrink. Fourth, if three items are meant to be equal in width, flex-basis must be 0 — writing only flex: 1 1 auto leaves the item with the longest content the longest after sharing. Fifth, centering takes both properties together: align-items: center for the vertical direction and justify-content: center for the horizontal, and leaving one out centers only half the job. Sixth, if content overflows, check whether flex-wrap is nowrap and whether flex-shrink is 0. Seventh, prefer gap for spacing instead of shimming with margins, because margins break after wrapping. Eighth, align-content only works on multi-line containers — writing it on a single-line container does nothing. Ninth, to push one item to the other side, use margin-left: auto or margin-right: auto instead of wrapping it in another container. Tenth, after every change, check the layout at several window widths — desktop, tablet, and phone — and confirm that wrapping, shrinking, and centering all behave as expected. Flexbox, in the end, is two axes plus one account of free space: get the axes right, work out where the space goes, and a row of things will sit exactly where you want them.

Views 0Comments 0

Comments (0)

ME
0/1000
Loading comments...

Sources

Browse projectsPublish your project

Related articles

Real photo: top-down view of hands sorting handwritten index cards on a dark desk, with clipboards holding tables beside them
Guide
Put the data in a labeled box first: objects and JSON, explained plainly

One order is one object: table, dishes, total, paid — all filed by label. This guide follows MDN's Working with objects, JSON, and Object references: object literals, dot vs bracket notation, adding and deleting properties, for...in with hasOwn, methods and this, getters and setters, references vs copies, Object.assign and friends, null-prototype objects, JSON's strict rules, and stringify and parse with their number-precision trap.

Developer WorkflowFrontend EngineeringAI Coding
Real photo: hands typing on a MacBook Pro showing JavaScript code that changes HTML content, with a white mouse, papers, and binders on a white desk
Guide
Functions without the confusion: JavaScript functions, parameters, and arrow functions, explained plainly

You already call functions every day; this guide names what you have been doing. Following MDN's Functions, Arrow function expressions, and Rest parameters: declarations versus expressions, parameters and arguments, default values, rest parameters, spread syntax, return values, arrow function shorthand, the this trap, callbacks, and scope.

Tool TipsFrontend EngineeringAI Coding
Real photo: a laptop, tablet, and phone on a wooden table showing the same green-leaf website, the phone view with navigation in one column, a potted plant nearby
Guide
Squashed on phones? Responsive layout and media queries, explained plainly

One page should stand up on a phone, a tablet, and a computer. This guide follows MDN's Responsive web design, Using media queries, and the viewport meta reference: fluid HTML, the viewport tag, fluid grids and max-width, images that never burst their container, media query syntax, breakpoints set by content, mobile first, responsive type, testing capability instead of width, and a pre-launch checklist.

Mobile AppsDesign ExperienceFrontend Engineering