Stellix Flex: Learn CSS Flexbox Visually (Free Beginner Playground)

Stellix Flex – Learn CSS Flexbox Visually | Coding Stellix

What is Stellix Flex?

Flexbox is the part of CSS that decides how boxes line up on a page. It is used for menus, cards, buttons, forms and almost every modern layout. It is also the topic where many beginners get stuck, because words like justify-content and align-items do not explain themselves.

Stellix Flex fixes that by letting you see every setting. You click a button, the boxes move at once, and a plain-English sentence tells you what just happened. Below the preview, the matching CSS updates live, so you can copy it into your own project.

What you can change

  • flex-direction – decide whether boxes go across or stack downward, forward or reversed.
  • justify-content – push boxes to the start, middle or end, or spread the space between them.
  • align-items – control how boxes sit in the other direction.
  • flex-wrap – choose whether boxes stay on one line or move down when they run out of room.
  • gap – set the space between boxes from 0 to 40 pixels.
  • Number of boxes – add or remove boxes from 2 to 8 to see how the layout reacts.

The two ideas every beginner needs

1. There is a parent and there are children. In Stellix Flex the parent is the container and the numbered colored boxes are its children. You write display: flex on the parent, and the children arrange themselves.

2. There are two directions. The main direction is the way boxes flow, set by flex-direction. The cross direction is the other one. justify-content works along the main direction, and align-items works along the cross direction. When you change flex-direction from row to column, these two swap their visual meaning. Try it in the tool and you will see it clearly.

How to practice

  1. Start with the default settings and add boxes with the plus button.
  2. Click through every justify-content value and read the sentence under it.
  3. Switch flex-direction to column and click through justify-content again.
  4. Turn on wrap, add eight boxes and drag the gap slider.
  5. Copy the CSS and paste it into a small HTML file of your own to try it for real.

Common beginner mistakes

  • Putting justify-content on the children instead of the parent.
  • Forgetting display: flex, so none of the other settings do anything.
  • Expecting align-items: center to work in a container with no height. The container needs room to center inside.
  • Mixing up the two directions after changing to column.

Sample CSS

css

.container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

Frequently asked questions

Is Stellix Flex free? Yes, it is free with no sign-up.

Do I need to know CSS first? No. It is made for people who are just starting.

Does the copied CSS work everywhere? Yes. Flexbox is supported by all current browsers.

Does it teach CSS Grid? Not yet. Learn flexbox first, then move to grid.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Stellix Flex – Learn CSS Flexbox Visually | Coding Stellix</title>
<meta name="description" content="Stellix Flex helps beginners learn CSS Flexbox by clicking. Change direction, alignment, wrap and gap, see the boxes move, and copy the CSS. By Coding Stellix.">
<style>
:root{--bg:#f4f5fb;--card:#ffffff;--line:#e3e6f3;--ink:#1b1f3a;--mute:#5d6485;--acc:#5b5bf0;--accsoft:#ecebff;--stage:#fafbff;--code:#14172b;color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
@media (prefers-color-scheme:dark){:root{--bg:#0e1020;--card:#171a30;--line:#2a2f52;--ink:#eef0ff;--mute:#a2a9d1;--acc:#8b8bff;--accsoft:#24285a;--stage:#12152a;--code:#0a0c18;color-scheme:dark}}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:"Segoe UI","Trebuchet MS",Arial,sans-serif;line-height:1.5}
.wrap{max-width:1080px;margin:auto;padding:36px 20px 48px}
.pill{display:inline-block;font-size:13px;font-weight:600;color:var(--acc);background:var(--accsoft);padding:5px 12px;border-radius:99px}
h1{margin:14px 0 8px;font-size:clamp(32px,6vw,52px);line-height:1.08;letter-spacing:-1px}
.lead{margin:0 0 28px;max-width:56ch;color:var(--mute);font-size:18px}
.layout{display:grid;grid-template-columns:340px 1fr;gap:20px;align-items:start}
@media(max-width:860px){.layout{grid-template-columns:1fr}}
.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:20px}
.grp{margin-bottom:18px}
.grp:last-child{margin-bottom:0}
.grp h3{margin:0 0 8px;font-size:14px;font-family:Consolas,"Courier New",monospace;color:var(--ink)}
.opts{display:flex;flex-wrap:wrap;gap:6px}
button{font:inherit;font-size:13px;color:var(--ink);background:var(--stage);border:1px solid var(--line);border-radius:10px;padding:7px 11px;cursor:pointer;transition:background .15s,border-color .15s,transform .1s}
button:hover{border-color:var(--acc)}
button:active{transform:scale(.97)}
button.on{background:var(--acc);border-color:var(--acc);color:#fff;font-weight:600}
@media (prefers-color-scheme:dark){button.on{color:#10122a}}
.hint{margin:8px 0 0;font-size:13px;color:var(--mute);min-height:38px}
input[type=range]{width:100%;accent-color:var(--acc)}
.cnt{display:flex;align-items:center;gap:12px}
.cnt b{min-width:24px;text-align:center;font-size:18px}
button:focus-visible,input:focus-visible{outline:3px solid var(--acc);outline-offset:2px}
.stagebox{padding:14px}
.stage{background:var(--stage);border:2px dashed var(--line);border-radius:12px;height:320px;overflow:auto}
.box{display:grid;place-items:center;flex:none;border-radius:10px;color:#fff;font-weight:700;font-size:18px;box-shadow:0 2px 0 rgba(0,0,0,.15);transition:all .25s}
.row{display:flex;align-items:center;justify-content:space-between;margin:18px 0 8px}
.row h2{margin:0;font-size:17px}
.copy{background:var(--acc);border-color:var(--acc);color:#fff;font-weight:700;padding:8px 16px}
@media (prefers-color-scheme:dark){.copy{color:#10122a}}
pre{margin:0;background:var(--code);color:#dfe4ff;border-radius:12px;padding:16px;font:14px/1.7 Consolas,"Courier New",monospace;overflow-x:auto}
.tip{margin-top:20px;font-size:14px;color:var(--mute)}
</style>
</head>
<body>
<!-- Stellix Flex by Coding Stellix -->
<div class="wrap">
<span class="pill">Coding Stellix</span>
<h1>Stellix Flex</h1>
<p class="lead">Learn CSS Flexbox by clicking. Change a setting, watch the boxes move, then copy the code.</p>
<div class="layout">
<section class="card" aria-label="Controls" id="ctl"></section>
<section>
<div class="card stagebox"><div class="stage" id="stage" aria-label="Flexbox preview"></div></div>
<div class="row"><h2>Your CSS</h2><button class="copy" id="cp">Copy CSS</button></div>
<pre id="out" tabindex="0"></pre>
<p class="tip">Tip: the box named "container" is the parent. The numbered boxes are its children. Flexbox settings go on the parent.</p>
</section>
</div>
</div>
<script>
var $=function(i){return document.getElementById(i)};
var S={d:"row",j:"flex-start",a:"stretch",w:"nowrap",g:12,n:4};
var G=[
{k:"d",p:"flex-direction",o:["row","row-reverse","column","column-reverse"],t:{"row":"Boxes go in a line from left to right.","row-reverse":"Boxes go in a line from right to left.","column":"Boxes stack from top to bottom.","column-reverse":"Boxes stack from bottom to top."}},
{k:"j",p:"justify-content",o:["flex-start","center","flex-end","space-between","space-around","space-evenly"],t:{"flex-start":"Boxes sit at the start of the main direction.","center":"Boxes sit in the middle.","flex-end":"Boxes sit at the end.","space-between":"First and last box touch the edges, the rest spread evenly.","space-around":"Equal space around every box, so edges get half as much.","space-evenly":"Exactly the same space between every box and the edges."}},
{k:"a",p:"align-items",o:["stretch","flex-start","center","flex-end"],t:{"stretch":"Boxes grow to fill the other direction.","flex-start":"Boxes line up at the start of the other direction.","center":"Boxes are centered in the other direction.","flex-end":"Boxes line up at the end of the other direction."}},
{k:"w",p:"flex-wrap",o:["nowrap","wrap"],t:{"nowrap":"All boxes stay on one line, even if they do not fit.","wrap":"Boxes move to a new line when there is no more room."}}
];
var cols=["#5b5bf0","#e8590c","#0ca678","#d6336c","#1c7ed6","#f08c00","#7048e8","#2b8a3e"];
var ctl=$("ctl");
G.forEach(function(g){var d=document.createElement("div");d.className="grp";
d.innerHTML='<h3>'+g.p+'</h3><div class="opts" id="o'+g.k+'"></div><p class="hint" id="h'+g.k+'"></p>';ctl.appendChild(d);
g.o.forEach(function(v){var b=document.createElement("button");b.textContent=v;b.dataset.v=v;b.onclick=function(){S[g.k]=v;draw()};d.querySelector(".opts").appendChild(b)})});
var gd=document.createElement("div");gd.className="grp";
gd.innerHTML='<h3>gap: <span id="gv"></span></h3><input type="range" id="gap" min="0" max="40" value="12" aria-label="Gap">';ctl.appendChild(gd);
var nd=document.createElement("div");nd.className="grp";
nd.innerHTML='<h3>number of boxes</h3><div class="cnt"><button id="mi" aria-label="Remove a box">-</button><b id="nv"></b><button id="pl" aria-label="Add a box">+</button></div>';ctl.appendChild(nd);
$("gap").oninput=function(){S.g=+this.value;draw()};
$("mi").onclick=function(){if(S.n>2){S.n--;draw()}};
$("pl").onclick=function(){if(S.n<8){S.n++;draw()}};
function draw(){
G.forEach(function(g){[].forEach.call($("o"+g.k).children,function(b){b.className=b.dataset.v==S[g.k]?"on":""});$("h"+g.k).textContent=g.t[S[g.k]]});
$("gv").textContent=S.g+"px";$("nv").textContent=S.n;
var st=$("stage");st.innerHTML="";
var c=document.createElement("div");
c.style.cssText="display:flex;min-height:100%;flex-direction:"+S.d+";justify-content:"+S.j+";align-items:"+S.a+";flex-wrap:"+S.w+";gap:"+S.g+"px;padding:12px";
for(var i=0;i<S.n;i++){var b=document.createElement("div");b.className="box";b.textContent=i+1;b.style.background=cols[i];
b.style.minWidth=(54+(i%3)*16)+"px";b.style.minHeight=(46+(i%3)*18)+"px";c.appendChild(b)}
st.appendChild(c);
$("out").textContent=".container {\n  display: flex;\n  flex-direction: "+S.d+";\n  justify-content: "+S.j+";\n  align-items: "+S.a+";\n  flex-wrap: "+S.w+";\n  gap: "+S.g+"px;\n}"}
$("cp").onclick=function(){var b=$("cp"),t=$("out").textContent;
function ok(){b.textContent="Copied";setTimeout(function(){b.textContent="Copy CSS"},1500)}
function fb(){var r=document.createRange();r.selectNodeContents($("out"));var s=getSelection();s.removeAllRanges();s.addRange(r);try{document.execCommand("copy");ok()}catch(e){}}
try{navigator.clipboard.writeText(t).then(ok,fb)}catch(e){fb()}};
draw();
</script>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *

SHARE:-

Trending Post

Latest Post