<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dwi Yulianto on Medium]]></title>
        <description><![CDATA[Stories by Dwi Yulianto on Medium]]></description>
        <link>https://medium.com/@98dwiyulianto?source=rss-22cbd1cd3df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*biqJYr51p3YRqMHQ</url>
            <title>Stories by Dwi Yulianto on Medium</title>
            <link>https://medium.com/@98dwiyulianto?source=rss-22cbd1cd3df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 23 May 2026 12:24:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@98dwiyulianto/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[The Ultimate Beginner-Friendly Guide to Template Literals in JavaScript & TypeScript]]></title>
            <link>https://medium.com/@98dwiyulianto/the-ultimate-beginner-friendly-guide-to-template-literals-in-javascript-typescript-98a04e5e0448?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/98a04e5e0448</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[wev-development]]></category>
            <category><![CDATA[template-literals]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 12:16:00 GMT</pubDate>
            <atom:updated>2025-12-19T12:27:44.749Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*hP7imG8juiMllueUaJWXow.png" /><figcaption>Template Literals — also known as <em>Template Strings</em></figcaption></figure><p>Template Literals — also known as <em>Template Strings</em> — are one of the most powerful and beginner-friendly features introduced in modern JavaScript (ES6).</p><p>TypeScript takes them even further with additional type-based features.</p><p>This guide teaches you <strong>side-by-side</strong>: JavaScript → TypeScript → JavaScript → TypeScript</p><p>so beginners can clearly see the difference.</p><h3>Template Literals — A Clear Guide for JavaScript and TypeScript Beginners</h3><p>Template Literals — also known as <strong>Template Strings</strong> — are one of the most powerful and beginner-friendly features introduced in modern JavaScript (ES6).</p><p>TypeScript takes them even further with additional type-based features that make your code safer and more predictable.</p><p>This guide teaches you <strong>side-by-side</strong>:</p><p><strong>JavaScript → TypeScript → JavaScript → TypeScript</strong></p><p>so beginners can clearly see how both languages compare.</p><h3>JavaScript — What Are Template Literals?</h3><p>A <strong>template literal</strong> is a modern way to write strings in JavaScript and TypeScript.</p><p>With this feature, you can:</p><ul><li>Insert JavaScript expressions directly into a string</li><li>Write multi-line strings without using \n</li><li>Produce cleaner and more readable code</li><li>Avoid + string concatenation entirely</li></ul><h4>Basic Syntax</h4><p>Template literals use <strong>backticks</strong> (`), not ‘ or “.</p><p>To insert a value, use ${ … }.</p><pre>const name = &quot;Johan&quot;;<br>console.log(`Hello ${name}!`);</pre><h3>TypeScript — Same Syntax, but Safer</h3><p>TypeScript uses the exact same syntax as JavaScript, but enhances it with:</p><ul><li>Type checking</li><li>Template literal <strong>types</strong></li><li>Safer, stricter string combinations</li></ul><h3>JavaScript — Basic Interpolation</h3><pre>const name = &quot;Johan&quot;;<br>console.log(`Hello ${name}!`);</pre><p>Compare with the old style:</p><pre>console.log(&quot;Hello &quot; + name + &quot;!&quot;);</pre><p>Template literals are shorter, cleaner, and easier to maintain.</p><h3>TypeScript — Basic Interpolation With Types</h3><pre>const name: string = &quot;Johan&quot;;<br>const age: number = 25;</pre><pre>const message: string = `Hello, my name is ${name}. I am ${age} years old.`;</pre><p>The output is the same, but TypeScript ensures that name and age match the expected types.</p><h3>JavaScript — Multi-Line Strings (Without \n)</h3><h3>Old way:</h3><pre>const text = &quot;Hello\n&quot; + &quot;Be Fullstack JavaScript Developer!&quot;;</pre><h3>Modern way:</h3><pre>const text = `Hello Be Fullstack JavaScript Developer!`;</pre><p>No escaping needed — what you write is exactly what you get.</p><h3>TypeScript — Template Literal Types (Superpower Feature)</h3><p>This feature exists <strong>only in TypeScript</strong>, and it’s incredibly powerful:</p><pre>type Role = &quot;admin&quot; | &quot;user&quot;;<br>type Greeting = `Hello, ${Role}!`;</pre><pre>const msg: Greeting = &quot;Hello, admin&quot;; // ✔ valid<br>// const wrong: Greeting = &quot;Hi, admin&quot;; // ❌ invalid</pre><p>TypeScript validates the <strong>pattern</strong> of the string — extremely useful for APIs, routing, file paths, and UI states.</p><h3>JavaScript — Dynamic HTML (Common in Frontend Work)</h3><pre>const item = &quot;Laptop&quot;;<br>const price = 15000;</pre><pre>const html = `<br>  &lt;div&gt;<br>    &lt;h2&gt;${item}&lt;/h2&gt;<br>    &lt;p&gt;Price: $${price}&lt;/p&gt;<br>  &lt;/div&gt;<br>`;</pre><p>Template literals make generating reusable HTML snippets simple and elegant.</p><h3>TypeScript — Template Literals Inside React Components</h3><pre>type Props = {<br>  name: string;<br>  age: number;<br>};</pre><pre>export default function Greeting({ name, age }: Props) {<br>  return &lt;h2&gt;{`Hello ${name}, you are ${age} years old.`}&lt;/h2&gt;;<br>}</pre><p>React + TypeScript gives you type-safe props with clean dynamic rendering.</p><h3>JavaScript — Tailwind / Conditional CSS Example</h3><pre>const isDark = true;</pre><pre>const className = `p-4 ${isDark ? &quot;bg-black text-white&quot; : &quot;bg-white text-black&quot;}`;</pre><p>One of the most common real-world uses of template literals in frontend development.</p><h3>TypeScript — Logging in Node.js</h3><pre>const logRequest = (url: string, method: string) =&gt; {<br>  const timestamp = new Date().toISOString();<br>  console.log(`[${timestamp}] ${method.toUpperCase()} request to ${url}`);<br>};</pre><pre>logRequest(&quot;/api/products&quot;, &quot;get&quot;);</pre><p>Template literals produce clean, human-readable logs.</p><h3>JavaScript — Dynamic File Paths</h3><pre>const file = &quot;profile.png&quot;;<br>const path = `/uploads/images/${file}`;<br>console.log(path);</pre><p>Very readable — and reduces path-related mistakes.</p><h3>TypeScript — Path Building With Type Safety</h3><pre>import path from &quot;path&quot;;</pre><pre>const fileName = &quot;data.json&quot;;<br>const filePath = path.join(__dirname, `files/${fileName}`);<br>console.log(filePath);</pre><p>Still simple, but now protected with type checking.</p><h3>When Should You Use Template Literals?</h3><p>Use template literals when you need:</p><ul><li>Dynamic UI rendering</li><li>Clean log formatting (Node.js)</li><li>Dynamic URLs or file paths</li><li>Long or multi-line text</li><li>Dynamic HTML generation</li><li>Easier variable insertion</li></ul><p>Template literals reduce bugs and make your code significantly easier to read.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98a04e5e0448" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to Modern Variables & Functions in JavaScript and TypeScript]]></title>
            <link>https://medium.com/@98dwiyulianto/beginners-guide-to-modern-variables-functions-in-javascript-and-typescript-5f644bef2fde?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f644bef2fde</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[typescript-tips]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Fri, 12 Dec 2025 13:33:59 GMT</pubDate>
            <atom:updated>2025-12-12T13:33:59.456Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Before ES6, JavaScript relied heavily on var — a keyword with behavior that often confused beginners.</p><p>ES6 improved the language dramatically by introducing <strong>block-scoped</strong> variables (let, const) and a cleaner way to write functions: the <strong>arrow function</strong>.</p><p>TypeScript builds on these features by adding <strong>types</strong>, <strong>readonly properties</strong>, and safety guarantees.</p><p>This tutorial will guide you step-by-step, using visuals and simple examples.</p><h3>JavaScript — Understanding var, let, and const</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*4l9exTNAsxSvX1lHqgal1A.png" /><figcaption>Understanding var, let, and const</figcaption></figure><p>Before ES6, developers only had:</p><pre>var</pre><p>But var has two problems:</p><ol><li>It ignores block scope (like inside if or for)</li><li>It can create unexpected bugs because it “leaks” outside its block</li></ol><h3>📌 Example: var ignores block scope</h3><pre>var x = 20;</pre><pre>if (x === 20) {<br>  var y = 10; // declared inside if-block<br>}</pre><pre>console.log(y); // ✅ 10 — because var ignores block scope</pre><p>Even though y was created inside the if block, it is still available outside.</p><p>This is why var is considered unsafe for modern code.</p><h3>1. TypeScript — Using let and const With Types</h3><p>TypeScript improves clarity by letting you specify what type of value a variable holds:</p><pre>const pi: number = 3.14;<br>let diameter: number;</pre><pre>diameter = 10;</pre><pre>const area: number = pi * diameter;<br>console.log(area);</pre><ul><li><strong>const</strong> → cannot be reassigned</li><li><strong>let</strong> → can be reassigned</li><li>Both are <strong>block scoped</strong>, meaning they respect { }</li></ul><h3>2. JavaScript — Block Scoping With let</h3><pre>let i = 200;</pre><pre>for (let i = 1; i &lt;= 5; i++) {<br>  console.log(i); // prints 1 → 5<br>}</pre><pre>console.log(i); // 200 (outer block remains unchanged)</pre><p>Each i lives in its own scope.</p><p>This eliminates many unpredictable bugs caused by var.</p><h3>2. TypeScript — Objects With readonly and as const</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*C79agB9Tg14ZjFZgUjztzg.png" /><figcaption>Objects With readonly and as const</figcaption></figure><p>JavaScript allows mutation even when using const:</p><pre>const person = { name: &quot;Fuad&quot;, age: 35 };<br>person.name = &quot;Hafid&quot;; // allowed</pre><p>TypeScript helps prevent this:</p><h3>🔹 Using as const</h3><pre>const fixedPerson = {<br>  name: &quot;Fuad&quot;,<br>  age: 35,<br>} as const;</pre><pre>// fixedPerson.name = &quot;Hafid&quot;; // ❌ Error</pre><h3>🔹 Using readonly in interfaces</h3><pre>interface Person {<br>  readonly name: string;<br>  age: number;<br>}</pre><pre>const user: Person = { name: &quot;Fuad&quot;, age: 30 };<br>// user.name = &quot;Hafid&quot;; // ❌ Error</pre><h3>3. JavaScript — Arrow Functions (ES6)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*pSWVlFVopqej9Cr2aSCWxg.png" /><figcaption>Arrow Functions (ES6)</figcaption></figure><p>Arrow functions provide a shorter, cleaner way to write functions.</p><h3>Basic form</h3><pre>const getPrice = () =&gt; 25000;</pre><h3>With parameters</h3><pre>const increment = (x) =&gt; ++x;<br>const multiply = (a, b) =&gt; a * b;</pre><h3>With default values</h3><pre>const increment = (x = 1) =&gt; ++x;</pre><h3>4. TypeScript — Arrow Functions With Type Safety</h3><pre>const increment = (x: number = 1): number =&gt; ++x;<br>const multiply = (a: number, b: number): number =&gt; a * b;</pre><pre>console.log(increment(5)); // 6<br>console.log(multiply(2, 3)); // 6</pre><p>TypeScript warns you if:</p><ul><li>You pass the wrong type</li><li>You forget a parameter</li><li>You return an incompatible value</li></ul><p>This reduces errors and improves debugging efficiency.</p><h3>5. JavaScript — Arrow Functions and this</h3><p>this behaves differently in arrow functions.</p><h3>Traditional function — incorrect behavior:</h3><pre>const Web = {<br>  text: &quot;hello&quot;,<br>  render: function () {<br>    setTimeout(function () {<br>      console.log(this.text); // ❌ undefined<br>    }, 1000);<br>  },<br>};</pre><pre>Web.render();</pre><h3>Solution — arrow function:</h3><pre>render: function () {<br>  setTimeout(() =&gt; {<br>    console.log(this.text); // ✅ &quot;hello&quot;<br>  }, 1000);<br>}</pre><p>Arrow functions automatically inherit the surrounding this.</p><h3>6. TypeScript — Arrow Functions in React</h3><p>React developers love arrow functions because:</p><ul><li>They preserve this correctly</li><li>They are concise</li><li>They work beautifully with Hooks</li></ul><h3>Example: Counter component</h3><pre>const Counter = () =&gt; {<br>  const [count, setCount] = useState&lt;number&gt;(0);<br><br>  const increment = (): void =&gt;<br>    setCount(prev =&gt; prev + 1);<br><br>return (<br>    &lt;div&gt;<br>      &lt;p&gt;Count: {count}&lt;/p&gt;<br>      &lt;button onClick={increment}&gt;Add&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><h3>Bonus: Stable Functions With useCallback</h3><pre>const handleClick = useCallback(() =&gt; {<br>  setCount(prev =&gt; prev + 1);<br>}, []);</pre><p>This reduces unnecessary re-creation of functions and improves performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f644bef2fde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Naming in JavaScript and TypeScript Matters More Than We Admit]]></title>
            <link>https://medium.com/@98dwiyulianto/why-naming-in-javascript-and-typescript-matters-more-than-we-admit-2a723c5ea248?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a723c5ea248</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[basics-of-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Fri, 12 Dec 2025 10:24:45 GMT</pubDate>
            <atom:updated>2025-12-12T10:24:45.985Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Small Detail That Isn’t Actually Small</h3><p>One thing I learned early on is that ECMAScript sets the rules of the language, but it never dictates how developers should write their code. The ecosystem and the community fill that gap. Because of that, syntax style tends to drift from project to project.</p><p>Still, there are fundamentals worth mastering — those small conventions that help us write code others can trust.</p><p>Identifier naming is one of them.</p><h3>What JavaScript Allows at the Syntax Level</h3><p>JavaScript gives us a set of simple but important constraints. They’re minimal, almost deceptively so.</p><h3>1. Identifiers Must Begin with Letters, _, or $</h3><p>Once the first character is valid, the rest may include numbers as well.</p><pre>let band1 = &quot;Peterpan&quot;;<br>let _backupSinger = &quot;Wali&quot;;<br>let $production = &quot;Dewa 19&quot;;</pre><p>It’s a flexible system, maybe too flexible at times. That’s why conventions matter even more.</p><h3>2. Case Sensitivity</h3><p>Two identifiers that look nearly identical at a glance can represent entirely different values.</p><pre>const version = 1;<br>const Version = 2;</pre><p>This is one of those things that feels obvious until an unexpected bug reveals how unforgiving this distinction can be.</p><h3>3. Reserved Words Must Stay Untouched</h3><p>Everything from class to return is off-limits.</p><pre>const price = 5000;    // valid<br>Const count = 3;        // invalid</pre><p>JavaScript will throw a syntax error immediately, which is almost a mercy compared to the silent bugs caused by poor naming choices elsewhere.</p><h3>Community Conventions That Help Code Breathe</h3><p>Some rules aren’t enforced by the language, but they make a project far easier to navigate.</p><h3>camelCase for Variables and Functions</h3><pre>let productPrice = 1000;</pre><pre>function calculateTotal() {<br>  return productPrice * 2;<br>}</pre><h3>PascalCase for Classes or Constructor Functions</h3><pre>class Product {<br>  constructor(name, price) {<br>    this.name = name;<br>    this.price = price;<br>  }<br>}</pre><pre>function Book(name, price) {<br>  this.name = name;<br>  this.price = price;<br>}</pre><p>These aren’t laws, but following them helps future readers feel at home in your code.</p><h3>TypeScript and the Quiet Discipline of Types</h3><p>Switching into TypeScript brought structure I didn’t realize I needed. Once I began annotating types, I also became more thoughtful about naming. It wasn’t just about correctness; it was about clarity.</p><h3>Identifier Rules Still Apply</h3><p>The basics of JavaScript carry over unchanged.</p><pre>let band1: string = &quot;Peterpan&quot;;<br>let _backupSinger: string = &quot;Wali&quot;;<br>let $production: string = &quot;Dewa 19&quot;;</pre><h3>Case Sensitivity Remains the Same</h3><pre>const name: string = &quot;A&quot;;<br>const Name: string = &quot;B&quot;;</pre><h3>camelCase, PascalCase, and Everything in Between</h3><pre>let itemPrice: number = 10000;</pre><pre>function calculateStock(): number {<br>  return 0;<br>}</pre><pre>class Product {<br>  constructor(public name: string, public price: number) {}<br>}</pre><pre>type UserProfile = {<br>  name: string;<br>  age: number;<br>};</pre><p>There’s something calming about how TypeScript nudges your code into consistency, without demanding perfection.</p><h3>TypeScript Features That Influence Naming</h3><p>Over time, the type system encourages patterns that naturally result in clearer identifiers.</p><h3>Type Annotations</h3><pre>let title: string = &quot;Learning TypeScript&quot;;<br>let pages: number = 200;<br>let published: boolean = true;</pre><h3>Interfaces and Type Aliases</h3><pre>interface Book {<br>  title: string;<br>  pages: number;<br>}</pre><pre>type Status = &quot;draft&quot; | &quot;published&quot; | &quot;archived&quot;;</pre><h3>Enums for Meaningful Labels</h3><pre>enum Role {<br>  Admin,<br>  User,<br>  Guest<br>}</pre><h3>Generic Functions That Communicate Intent</h3><pre>function identity&lt;T&gt;(value: T): T {<br>  return value;<br>}</pre><p>These features quietly influence how we think about structure, and in turn, how we name the things that live within that structure.</p><h3>Reserved Keywords to Keep in Mind</h3><p>JavaScript and TypeScript share a pool of restricted words. Some belong to the language, some are reserved for the future, and some represent literal values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*12KLQwIeyVD1tZv5Y2FWEA.png" /><figcaption>Reserved Keywords to Keep in Mind</figcaption></figure><p>This includes:</p><pre>break, case, catch, class, const,<br>continue, debugger, default, delete, do,<br>else, export, extends, finally, for,<br>function, if, import, in, instanceof,<br>new, return, super, switch, this,<br>throw, try, typeof, var, void,<br>while, with, yield</pre><p>And a few more that might be used by future versions of the language:</p><pre>enum, implements, interface, let,<br>package, private, protected, public, static,<br>await</pre><p>Literal values like null, true, and false aren’t technically keywords, but they sit in their own untouchable category.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a723c5ea248" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Grid Demystified: Your Ultimate Guide to Responsive Design]]></title>
            <link>https://medium.com/@98dwiyulianto/css-grid-demystified-your-ultimate-guide-to-responsive-design-3914e33e8316?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/3914e33e8316</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[css-grid]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Tue, 27 May 2025 17:26:21 GMT</pubDate>
            <atom:updated>2025-05-27T17:26:21.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRyhR4RGxkmBRMCNzHZfmA.jpeg" /></figure><p>Welcome to your hands-on journey through modern CSS layouts! This tutorial covers 10 fundamental patterns, each accompanied by concise explanations and interactive code snippets. Let’s dive in!</p><h3>1. 🎯 Super Centered</h3><p><strong>Concept</strong>: Center any element both vertically and horizontally using a single line of CSS.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;center-container&quot;&gt;<br>  &lt;div class=&quot;center-box&quot; contenteditable&gt;<br>    :)<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.center-container {<br>  display: grid;<br>  place-items: center;<br>  height: 100vh;<br>  background-color: #e0e0e0;<br>}<br><br>.center-box {<br>  background-color: #42a5f5;<br>  color: white;<br>  padding: 25px;<br>  text-align: center;<br>  border-radius: 10px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rz3D6u9YUeE8Za5pBJpalw.jpeg" /><figcaption>Super Centered</figcaption></figure><h3>2. 🥞 The Deconstructed Pancake</h3><p><strong>Concept</strong>: Create a flexible layout where items stack vertically on smaller screens and align horizontally on larger ones.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;flex-wrapper&quot;&gt;<br>  &lt;div class=&quot;flex-box green&quot;&gt;1&lt;/div&gt;<br>  &lt;div class=&quot;flex-box green&quot;&gt;2&lt;/div&gt;<br>  &lt;div class=&quot;flex-box green&quot;&gt;3&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.flex-wrapper {<br>  display: flex;<br>  flex-wrap: wrap;<br>  justify-content: space-around;<br>}<br>.flex-box {<br>  flex: 1 1 160px;<br>  margin: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfOR5tWIXwvcHOzAE6MOdw.jpeg" /><figcaption>The Deconstructed Pancake</figcaption></figure><h3>3. 📐 Sidebar Says</h3><p><strong>Concept</strong>: Design a responsive layout with a sidebar that adjusts between a minimum and maximum width.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;flex-container&quot;&gt;<br>  &lt;div class=&quot;section orange&quot; contenteditable&gt;<br>    Min: 160px / Max: 30%<br>  &lt;/div&gt;<br>  &lt;div class=&quot;section teal&quot; contenteditable&gt;<br>    This is the main content area, which spans the rest.<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.flex-container {<br>  display: grid;<br>  grid-template-columns: minmax(160px, 30%) 1fr;<br>  grid-gap: 20px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vDz7SfN4WuepC8koAEwANw.jpeg" /><figcaption>Sidebar Says</figcaption></figure><h3>4. 🥞 Pancake Stack</h3><p><strong>Concept</strong>: Structure a layout with a header, main content, and footer stacked vertically.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;stacked-layout&quot;&gt;<br>  &lt;header class=&quot;header&quot; contenteditable&gt;Header&lt;/header&gt;<br>  &lt;main class=&quot;main-content&quot; contenteditable&gt;Main Content&lt;/main&gt;<br>  &lt;footer class=&quot;footer&quot; contenteditable&gt;Footer&lt;/footer&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.stacked-layout {<br>  display: grid;<br>  grid-template-rows: auto 1fr auto;<br>  height: 100vh;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6r8hSrSR6pNlAt8SKb19NQ.jpeg" /><figcaption>Pancake Stack</figcaption></figure><h3>5. 🏰 Classic Holy Grail Layout</h3><p><strong>Concept</strong>: Implement a three-column layout with a fixed header and footer.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;main-layout&quot;&gt;<br>  &lt;header class=&quot;header&quot;&gt;Header&lt;/header&gt;<br>  &lt;div class=&quot;sidebar-left&quot;&gt;Left Sidebar&lt;/div&gt;<br>  &lt;main class=&quot;content&quot;&gt;Main Content&lt;/main&gt;<br>  &lt;div class=&quot;sidebar-right&quot;&gt;Right Sidebar&lt;/div&gt;<br>  &lt;footer class=&quot;footer&quot;&gt;Footer&lt;/footer&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.main-layout {<br>  display: grid;<br>  grid-template-areas: &quot;header header header&quot; &quot;sidebar-left content sidebar-right&quot; &quot;footer footer footer&quot;;<br>  grid-template-columns: 1fr 3fr 1fr;<br>  grid-template-rows: 100px 1fr 50px;<br>}<br><br>.header { grid-area: header; background-color: #ff5722; }<br>.sidebar-left { grid-area: sidebar-left; background-color: #8e24aa; }<br>.content { grid-area: content; background-color: #00796b; }<br>.sidebar-right { grid-area: sidebar-right; background-color: #0288d1; }<br>.footer { grid-area: footer; background-color: #3e2723; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmTcCdXTiFIdrepZEoKOTg.jpeg" /><figcaption>Classic Holy Grail Layout</figcaption></figure><h3>6. 🧮 12-Span Grid</h3><p><strong>Concept</strong>: Create a 12-column grid system for flexible content placement.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;grid-wrapper&quot;&gt;<br>  &lt;div class=&quot;full-width grid-item&quot;&gt;Full Width&lt;/div&gt;<br>  &lt;div class=&quot;half-width grid-item&quot;&gt;Half Width&lt;/div&gt;<br>  &lt;div class=&quot;third-width grid-item&quot;&gt;Third Width&lt;/div&gt;<br>  &lt;div class=&quot;quarter-width grid-item&quot;&gt;Quarter Width&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.grid-wrapper {<br>  display: grid;<br>  grid-template-columns: repeat(12, 1fr);<br>  gap: 15px;<br>}<br>.full-width {<br>  grid-column: span 12;<br>}<br>.half-width {<br>  grid-column: span 6;<br>}<br>.third-width {<br>  grid-column: span 4;<br>}<br>.quarter-width {<br>  grid-column: span 2;<br>}<br>.grid-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  text-align: center;<br>  border-radius: 8px;<br>  display: grid;<br>  place-items: center;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MI5lj9CrxE7WvOAivBis-g.jpeg" /><figcaption>12-Span Grid</figcaption></figure><h3>7. 🔁 RAM (Repeat, Auto, Minmax)</h3><p><strong>Concept</strong>: Build a responsive grid that adapts to different screen sizes using auto-fit and minmax.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;responsive-grid&quot;&gt;<br>  &lt;div class=&quot;box red&quot;&gt;1&lt;/div&gt;<br>  &lt;div class=&quot;box teal&quot;&gt;2&lt;/div&gt;<br>  &lt;div class=&quot;box yellow&quot;&gt;3&lt;/div&gt;<br>  &lt;div class=&quot;box purple&quot;&gt;4&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.responsive-grid {<br>  display: grid;<br>  gap: 1rem;<br>  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));<br>}<br>.box {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  text-align: center;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tLvhMJfbIQqcMQJW5GwgQ.jpeg" /><figcaption>RAM (Repeat, Auto, Minmax)</figcaption></figure><h3>8. 📏 Line Up</h3><p><strong>Concept</strong>: Distribute items evenly with space between them.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;cards-container&quot;&gt;<br>  &lt;div class=&quot;card&quot;&gt;<br>    &lt;h3&gt;Card 1&lt;/h3&gt;<br>    &lt;p&gt;Medium length description.&lt;/p&gt;<br>    &lt;div class=&quot;image-box red&quot;&gt;&lt;/div&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;<br>    &lt;h3&gt;Card 2&lt;/h3&gt;<br>    &lt;p&gt;Long description text.&lt;/p&gt;<br>    &lt;div class=&quot;image-box blue&quot;&gt;&lt;/div&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;<br>    &lt;h3&gt;Card 3&lt;/h3&gt;<br>    &lt;p&gt;Short description.&lt;/p&gt;<br>    &lt;div class=&quot;image-box green&quot;&gt;&lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.cards-container {<br>  display: grid;<br>  gap: 1rem;<br>  grid-template-columns: repeat(3, 1fr);<br>  height: auto;<br>}<br>.card {<br>  background-color: #4CAF50;<br>  padding: 20px;<br>  text-align: center;<br>  border-radius: 8px;<br>}<br>.image-box {<br>  width: 100%;<br>  height: 100px;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m7JencRPizuMXwtBZpmFTg.jpeg" /><figcaption>Line Up</figcaption></figure><h3>9. 🎚️ Clamping My Style</h3><p><strong>Concept</strong>: Use the clamp() function for responsive typography or spacing.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;card-container&quot;&gt;<br>  &lt;div class=&quot;card&quot;&gt;<br>    &lt;h1&gt;Main Title&lt;/h1&gt;<br>    &lt;div class=&quot;visual-box yellow&quot;&gt;&lt;/div&gt;<br>    &lt;p&gt;Responsive text for the card.&lt;/p&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.card-container {<br>  display: grid;<br>  place-items: center;<br>}<br>.card {<br>  width: clamp(24ch, 50%, 48ch);<br>  display: flex;<br>  flex-direction: column;<br>  padding: 1rem;<br>}<br>.visual-box {<br>  width: 100%;<br>  height: 120px;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryKeg8QcY0UqzRRXkqry8g.jpeg" /><figcaption>lamping My Style</figcaption></figure><h3>10. 📸 Respect for Aspect</h3><p><strong>Concept</strong>: Maintain a consistent aspect ratio for elements like images or videos.</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;aspect-ratio-card&quot;&gt;<br>  &lt;h1&gt;Video Content&lt;/h1&gt;<br>  &lt;div class=&quot;image-box green&quot;&gt;&lt;/div&gt;<br>  &lt;p&gt;Descriptive text for maintaining aspect ratio.&lt;/p&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.aspect-ratio-card {<br>  display: grid;<br>  place-items: center;<br>}<br>.image-box {<br>  aspect-ratio: 16 / 9;<br>  width: 100%;<br>}<br>.aspect-ratio-card {<br>  width: 50%;<br>  display: flex;<br>  flex-direction: column;<br>  padding: 1rem;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ZQPu6QQXN4Pb9kv6EIICg.png" /><figcaption>Respect for Aspect</figcaption></figure><h3>Conclusion</h3><p>🎯 <strong>Wrapping Up with CSS Grid Layouts</strong></p><p>Mastering <strong>CSS Grid</strong> is a powerful step in any web developer’s journey. Not only does it provide unparalleled control over your layouts, but it also opens the door to creating responsive, scalable designs with ease. From simple one-line layouts like the <strong>Super Centered</strong> to more complex structures like the <strong>Classic Holy Grail</strong> layout, CSS Grid allows for flexibility and precision that simply can’t be matched by older methods like floats or even Flexbox alone.</p><p>🚀 <strong>Why Should You Care?</strong></p><p>As modern websites increasingly require more intricate and responsive layouts, mastering CSS Grid is essential for creating clean, maintainable, and adaptable designs. Whether you’re a seasoned developer or just starting, incorporating CSS Grid into your skillset will allow you to meet these demands efficiently.</p><p>🔥 <strong>Take Action Today!</strong></p><ul><li><strong>Experiment</strong> with the examples provided here. Tweak the grid values, and try creating your own layouts.</li><li><strong>Challenge yourself</strong> to convert older layout systems into CSS Grid-based designs for improved responsiveness and performance.</li><li><strong>Leverage the power of Grid</strong>: Don’t hesitate to combine CSS Grid with Flexbox for even more advanced layouts.</li></ul><p>With CSS Grid, the possibilities are virtually endless. So, get hands-on, explore the different grid properties, and let your creativity flow. Happy coding, and keep pushing the boundaries of what you can create with CSS!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3914e33e8316" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Modern CSS Grid Layouting: A Practical Guide]]></title>
            <link>https://medium.com/@98dwiyulianto/mastering-modern-css-grid-layouting-a-practical-guide-da47e68dbfa5?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/da47e68dbfa5</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[css-grid]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Tue, 27 May 2025 15:42:43 GMT</pubDate>
            <atom:updated>2025-12-12T09:59:20.962Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2UqxjLVYuy8bfEh3mBxrIg.jpeg" /></figure><h3>✨ Introduction</h3><p>In the ever-evolving world of web development, creating responsive, dynamic layouts with minimal effort is a common goal. Traditional methods of positioning elements (such as floats and positioning) are quickly being replaced by more efficient, flexible tools.</p><p>🎯 <strong>Enter CSS Grid Layout</strong> — a two-dimensional layout system that has revolutionized how we structure content on web pages.</p><p>This article aims to guide you through mastering CSS Grid, helping you transition from basic to advanced layouts with a hands-on, practical approach.</p><h3>❓ Why CSS Grid?</h3><p>🧩 For over a decade, developers have dealt with float-based layouts, Flexbox for one-dimensional alignment, and clearfix hacks. While Flexbox is helpful, CSS Grid solves the <strong>two-dimensional layout problem </strong>handling rows and columns simultaneously.</p><h3>⚙️ How Does CSS Grid Work?</h3><p>To use CSS Grid:</p><ul><li>Create a <strong>grid container</strong> using display: grid;</li><li>Define <strong>columns and rows</strong></li><li>Place items automatically or explicitly in the grid</li></ul><p>💡 A simple example:</p><p><strong>HTML :</strong></p><pre>&lt;div class=&quot;grid-container&quot;&gt;<br>  &lt;div class=&quot;grid-item&quot;&gt;1&lt;/div&gt;<br>  &lt;div class=&quot;grid-item&quot;&gt;2&lt;/div&gt;<br>  &lt;div class=&quot;grid-item&quot;&gt;3&lt;/div&gt;<br>  &lt;div class=&quot;grid-item&quot;&gt;4&lt;/div&gt;<br>  &lt;div class=&quot;grid-item&quot;&gt;5&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS :</strong></p><pre>.grid-container {<br>  display: grid;<br>  grid-template-columns: repeat(3, 1fr); /* 3 columns, equal width */<br>  grid-gap: 10px;  /* Space between grid items */<br>}<br><br>.grid-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  text-align: center;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ieWPFirfP4Vk_zCsNOoolQ.jpeg" /><figcaption><em>Visual representation of a basic grid layout with 3 columns and 2 rows.</em></figcaption></figure><p>🧭 <em>This layout automatically distributes items in 3 columns and 2 rows.</em></p><h3>🔧 Advanced CSS Grid Concepts</h3><h4>📏 Defining Grid Rows and Columns</h4><p>With CSS Grid, you can define the <strong>size</strong> of columns and rows using units such as pixels (px), percentages (%), or the most powerful unit: <strong>fractions</strong> (fr). The fr unit allows the container to divide space proportionally.</p><p><strong>CSS :</strong></p><pre>.grid-container {<br>  display: grid;<br>  grid-template-columns: 2fr 1fr 1fr; /* First column twice as wide */<br>  grid-template-rows: 200px auto;<br>  grid-gap: 15px;<br>}</pre><p>📐 The first column gets <strong>twice as much space</strong>. This layout adapts well to different screen sizes using the fr unit.</p><h4>🗺️ Placing Items in Specific Grid Areas</h4><p>You can use grid-template-areas to create named regions within the grid, making it much easier to understand and maintain complex layouts.</p><p><strong>CSS :</strong></p><pre>.grid-container {<br>  display: grid;<br>  grid-template-areas: <br>    &quot;header header header&quot;<br>    &quot;sidebar content ads&quot;<br>    &quot;footer footer footer&quot;;<br>  grid-template-columns: 1fr 3fr 1fr;<br>  grid-template-rows: 100px 1fr 50px;<br>}<br><br>.header { grid-area: header; background-color: #6a0dad; }<br>.sidebar { grid-area: sidebar; background-color: #ff4500; }<br>.content { grid-area: content; background-color: #008080; }<br>.ads { grid-area: ads; background-color: #ffa500; }<br>.footer { grid-area: footer; background-color: #800080; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osGZVR6MvuDmeQy82TrYSw.jpeg" /><figcaption><em>Visual representation of a layout using grid-template-areas for header, sidebar, content, and footer.</em></figcaption></figure><p>🧩 <em>Use grid-template-areas to make layout structure more readable and semantic.</em></p><h4>📱 Responsive Design with CSS Grid</h4><p>CSS Grid offers a more efficient way to create responsive layouts. Unlike older layout techniques, with CSS Grid you can easily define different layouts for different screen sizes using <strong>media queries</strong>.</p><p><strong>CSS :</strong></p><pre>.grid-container {<br>  display: grid;<br>  grid-template-columns: repeat(3, 1fr);<br>  grid-gap: 20px;<br>}<br><br>@media (max-width: 768px) {<br>  .grid-container {<br>    grid-template-columns: repeat(2, 1fr); /* 2 columns on smaller screens */<br>  }<br>}<br><br>@media (max-width: 480px) {<br>  .grid-container {<br>    grid-template-columns: 1fr; /* 1 column on mobile */<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbJrqb6MsB1dP2NMvqxJUw.jpeg" /><figcaption><em>Responsive CSS Grid Layout shifting from 3 columns to 2 columns, and finally to 1 column on mobile screens.</em></figcaption></figure><p>🔄 <em>CSS Grid layouts adjust gracefully across devices with minimal media query effort.</em></p><h3>🧩 Real-World Example: CSS Grid in Action</h3><p>Here’s a <strong>practical demo layout</strong> using grid-template-areas, including a header, sidebar, content, ads, and footer. It adapts beautifully to mobile screens.</p><p>🧱 <strong>Example Code:</strong></p><p>➡️ <em>HTML + CSS Grid layout sample</em></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br> &lt;meta charset=&quot;UTF-8&quot; /&gt;<br> &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br> &lt;title&gt;CSS Grid Layout Example&lt;/title&gt;<br> &lt;style&gt;<br>  * {<br>   box-sizing: border-box;<br>   margin: 0;<br>   padding: 0;<br>  }<br><br>  body {<br>   font-family: Arial, sans-serif;<br>   background-color: #f4f4f4;<br>   color: #333;<br>  }<br><br>  .grid-container {<br>   display: grid;<br>   grid-template-areas: <br>    &quot;header header header&quot;<br>    &quot;sidebar content ads&quot;<br>    &quot;footer footer footer&quot;;<br>   grid-template-columns: 1fr 3fr 1fr;<br>   grid-template-rows: 80px 1fr 60px;<br>   gap: 15px;<br>   min-height: 100vh;<br>   padding: 20px;<br>  }<br><br>  .grid-container &gt; div {<br>   padding: 20px;<br>   color: white;<br>   border-radius: 8px;<br>  }<br><br>  .header  { grid-area: header; background-color: #6a0dad; }<br>  .sidebar { grid-area: sidebar; background-color: #ff4500; }<br>  .content { grid-area: content; background-color: #008080; }<br>  .ads   { grid-area: ads; background-color: #ffa500; color: #000; }<br>  .footer  { grid-area: footer; background-color: #800080; text-align: center; }<br><br>  @media (max-width: 768px) {<br>   .grid-container {<br>    grid-template-areas: <br>     &quot;header&quot;<br>     &quot;content&quot;<br>     &quot;sidebar&quot;<br>     &quot;ads&quot;<br>     &quot;footer&quot;;<br>    grid-template-columns: 1fr;<br>    grid-template-rows: auto;<br>   }<br>  }<br> &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br> &lt;div class=&quot;grid-container&quot;&gt;<br>  &lt;div class=&quot;header&quot;&gt;Header&lt;/div&gt;<br>  &lt;div class=&quot;sidebar&quot;&gt;Sidebar&lt;/div&gt;<br>  &lt;div class=&quot;content&quot;&gt;<br>   &lt;h2&gt;Main Content&lt;/h2&gt;<br>   &lt;p&gt;This area is styled using CSS Grid and adapts beautifully to different screen sizes.&lt;/p&gt;<br>  &lt;/div&gt;<br>  &lt;div class=&quot;ads&quot;&gt;Ads&lt;/div&gt;<br>  &lt;div class=&quot;footer&quot;&gt;&amp;copy; 2025 CSS Grid Mastery&lt;/div&gt;<br> &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5nvpSzAKoe6UMzPap2usg.jpeg" /></figure><h3>🧾 What This Layout Demonstrates:</h3><ul><li>📐 A structured grid layout using grid-template-areas</li><li>🖼️ CSS that mirrors the layout visually</li><li>📱 Responsive behavior using media queries</li><li>✅ Modern, semantic HTML with clean structure</li></ul><p>🧪 <strong>Tip</strong>: Open this HTML file in a browser and resize it to see responsiveness in action!</p><h3>🧠 Conclusion</h3><h3>🧩 Final Thoughts on CSS Grid</h3><p>As a seasoned developer, I can confidently say CSS Grid has changed the way we build layouts. No more floats. No more hacks. Just clean, powerful design.</p><h3>🚀 Why Should You Master CSS Grid?</h3><ul><li>Stay competitive 💼</li><li>Master adaptive layout systems 🧱</li><li>Improve code readability and maintainability 🧹</li><li>Build interfaces that scale across screen sizes 🌐</li></ul><h3>🎁 My Incentive to You</h3><p>Still using outdated methods? Don’t worry.</p><p>🌱 Start small</p><p>🛠 Build often</p><p>🔁 Iterate and experiment</p><p>You’ll be amazed how intuitive CSS Grid becomes over time.</p><pre>🔮 Stay curious, keep learning, and embrace the future of web design.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da47e68dbfa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Modern CSS Flexbox Layouting: A Practical Guide]]></title>
            <link>https://medium.com/@98dwiyulianto/mastering-modern-css-flexbox-layouting-a-practical-guide-35300d15bfee?source=rss-22cbd1cd3df------2</link>
            <guid isPermaLink="false">https://medium.com/p/35300d15bfee</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[layout]]></category>
            <category><![CDATA[style]]></category>
            <dc:creator><![CDATA[Dwi Yulianto]]></dc:creator>
            <pubDate>Sat, 24 May 2025 05:14:16 GMT</pubDate>
            <atom:updated>2025-12-12T09:59:55.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3UWMsnVAMQ7zvxU7yD8LQ.png" /></figure><h3>✨Introduction</h3><p>In this article web development landscape, creating responsive and flexible layouts is essential. CSS Flexbox is a powerful layout module designed to help developers build complex and adaptive user interfaces with ease. Unlike traditional layout techniques that require cumbersome floats or positioning, Flexbox offers an intuitive, one-dimensional system for distributing space and aligning content.</p><p>Whether you’re building navigation bars, card layouts, or full-page designs, mastering Flexbox will significantly improve your workflow and the user experience of your site. This article walks you through core Flexbox concepts, real-world examples, and practical tips to harness its full potential.</p><h3>📐1. Basic Flexbox Layout</h3><p>Starting simple, Flexbox arranges child elements horizontally by default, providing control over spacing and alignment with minimal code.</p><p><strong>HTML:</strong></p><pre>&lt;div class=&quot;flex-container&quot;&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 1&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 2&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 3&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS:</strong></p><pre>.flex-container {<br>  display: flex;<br>  justify-content: space-between; /* Space evenly between items */<br>  align-items: center;            /* Vertically center items */<br>  height: 100vh;                  /* Full viewport height */<br>  background-color: #f0f0f0;<br>}<br><br>.flex-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  font-size: 1.5rem;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fOekKMPfl95o9N61xz4zw.jpeg" /><figcaption>Basic Flexbox Layout</figcaption></figure><h3>📱2. Responsive Flexbox Layout</h3><p>Flexbox shines in responsive design by allowing items to wrap and resize according to screen size — especially when combined with media queries.</p><p><strong>HTML:</strong></p><pre>&lt;div class=&quot;flex-container&quot;&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 1&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 2&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 3&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS:</strong></p><pre>.flex-container {<br>  display: flex;<br>  flex-wrap: wrap;               /* Allow items to wrap to new lines */<br>  justify-content: space-around; /* Even spacing around items */<br>  background-color: #f0f0f0;<br>}<br><br>.flex-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  font-size: 1.5rem;<br>  margin: 10px;<br>  border-radius: 8px;<br>  flex: 1 1 30%;                 /* Grow and shrink, basis 30% */<br>}<br>/* Responsive breakpoints */<br>@media (max-width: 768px) {<br>  .flex-item {<br>    flex: 1 1 45%;               /* Increase basis to 45% */<br>  }<br>}<br>@media (max-width: 480px) {<br>  .flex-item {<br>    flex: 1 1 100%;              /* Stack full width on small screens */<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppy7ioZSmwXFkEPY3hXrsw.jpeg" /><figcaption>Responsive Flexbox Layout</figcaption></figure><h3>🎯3. Aligning Items in Flexbox</h3><p>Precise alignment in Flexbox is controlled using three properties: justify-content, align-items, and align-self.</p><ul><li>justify-content: aligns items along the main axis (horizontal by default).</li><li>align-items: aligns items along the cross axis (vertical by default).</li><li>align-self: allows individual items to override the container’s align-items setting.</li></ul><p><strong>HTML:</strong></p><pre>&lt;div class=&quot;flex-container&quot;&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 1&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 2&lt;/div&gt;<br>  &lt;div class=&quot;flex-item&quot;&gt;Item 3&lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS:</strong></p><pre>.flex-container {<br>  display: flex;<br>  justify-content: center; /* Center items horizontally */<br>  align-items: center;     /* Center items vertically */<br>  height: 100vh;<br>  background-color: #f0f0f0;<br>}<br><br>.flex-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  font-size: 1.5rem;<br>  margin: 10px;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zv7i9uONeq861BXB-RCN_g.jpeg" /><figcaption>Aligning Items in Flexbox</figcaption></figure><h3>🧱4. Nested Flex Containers</h3><p>Flexbox supports nesting, allowing complex and flexible layouts by embedding flex containers inside others.</p><p><strong>HTML:</strong></p><pre>&lt;div class=&quot;outer-container&quot;&gt;<br>  &lt;div class=&quot;inner-container&quot;&gt;<br>    &lt;div class=&quot;flex-item&quot;&gt;Item 1&lt;/div&gt;<br>    &lt;div class=&quot;flex-item&quot;&gt;Item 2&lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>CSS:</strong></p><pre>.outer-container {<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  height: 100vh;<br>  background-color: #f0f0f0;<br>}<br>.inner-container {<br>  display: flex;<br>  justify-content: space-between;<br>  width: 50%;<br>}<br>.flex-item {<br>  background-color: #4CAF50;<br>  color: white;<br>  padding: 20px;<br>  font-size: 1.5rem;<br>  margin: 10px;<br>  border-radius: 8px;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6SwEjIdotzSKH5vbaKKcRw.jpeg" /><figcaption>Nested Flex Containers</figcaption></figure><h3>🧪 Real-World Example: Flexbox in Action</h3><p>To solidify your understanding, here’s a visual example of a simple webpage layout built entirely with Flexbox. It demonstrates how the concepts covered in this tutorial — such as flexible card layouts, alignment, and nested containers — can be used to create a responsive and well-structured user interface.</p><p>Take note of how the layout adjusts across different screen sizes, maintaining both clarity and usability. This example can serve as a great starting point or reference for applying Flexbox in your own projects.</p><p>BAGUS SEKARANG BUATKAN CONTOH gambarnya agar pembaca bisa melihat hasilnya dan bisa di tiru</p><p><strong>HTML :</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br> &lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>  &lt;title&gt;Flexbox Showcase Page&lt;/title&gt;<br>  &lt;style&gt;<br>   * {<br>    box-sizing: border-box;<br>    margin: 0;<br>    padding: 0;<br>   }<br>  <br>   body {<br>    font-family: Arial, sans-serif;<br>    line-height: 1.6;<br>    background-color: #f0f0f0;<br>    color: #333;<br>    padding: 20px;<br>   }<br>  <br>   header {<br>    display: flex;<br>    justify-content: space-between;<br>    align-items: center;<br>    background-color: #4CAF50;<br>    color: white;<br>    padding: 20px;<br>    border-radius: 8px;<br>    margin-bottom: 20px;<br>   }<br><br>   nav {<br>    display: flex;<br>    gap: 15px;<br>   }<br><br>   nav a {<br>    color: white;<br>    text-decoration: none;<br>    font-weight: bold;<br>   }<br><br>   .main-content {<br>    display: flex;<br>    flex-wrap: wrap;<br>    gap: 20px;<br>   }<br><br>   .card {<br>    background-color: white;<br>    border-radius: 8px;<br>    padding: 20px;<br>    flex: 1 1 30%;<br>    min-width: 250px;<br>    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);<br>   }<br><br>   .nested-section {<br>    display: flex;<br>    justify-content: space-between;<br>    background-color: white;<br>    padding: 20px;<br>    border-radius: 8px;<br>    margin-top: 20px;<br>   }<br><br>   .nested-box {<br>    background-color: #4CAF50;<br>    color: white;<br>    padding: 15px;<br>    border-radius: 6px;<br>    width: 45%;<br>    text-align: center;<br>   }<br><br>   footer {<br>    margin-top: 40px;<br>    text-align: center;<br>    padding: 20px;<br>    background-color: #4CAF50;<br>    color: white;<br>    border-radius: 8px;<br>   }<br><br>   @media (max-width: 768px) {<br>    .card {<br>     flex: 1 1 45%;<br>    }<br>    .nested-box {<br>     width: 100%;<br>     margin-bottom: 10px;<br>    }<br>    .nested-section {<br>     flex-direction: column;<br>    }<br>   }<br>   @media (max-width: 480px) {<br>    .card {<br>     flex: 1 1 100%;<br>    }<br>   }<br>  &lt;/style&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;header&gt;<br>   &lt;h1&gt;Home&lt;/h1&gt;<br>   &lt;nav&gt;<br>    &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;<br>    &lt;a href=&quot;#&quot;&gt;Tutorials&lt;/a&gt;<br>    &lt;a href=&quot;#&quot;&gt;Docs&lt;/a&gt;<br>   &lt;/nav&gt;<br>  &lt;/header&gt;<br>  &lt;section class=&quot;main-content&quot;&gt;<br>   &lt;div class=&quot;card&quot;&gt;<br>    &lt;h2&gt;Responsive Card 1&lt;/h2&gt;<br>    &lt;p&gt;This card adjusts its width based on screen size using Flexbox.&lt;/p&gt;<br>   &lt;/div&gt;<br>   &lt;div class=&quot;card&quot;&gt;<br>    &lt;h2&gt;Responsive Card 2&lt;/h2&gt;<br>    &lt;p&gt;Flex properties allow it to wrap and flow naturally.&lt;/p&gt;<br>   &lt;/div&gt;<br>   &lt;div class=&quot;card&quot;&gt;<br>    &lt;h2&gt;Responsive Card 3&lt;/h2&gt;<br>    &lt;p&gt;Try resizing the browser to see the layout adapt.&lt;/p&gt;<br>   &lt;/div&gt;<br>  &lt;/section&gt;<br>  &lt;section class=&quot;nested-section&quot;&gt;<br>   &lt;div class=&quot;nested-box&quot;&gt;Nested Flexbox 1&lt;/div&gt;<br>   &lt;div class=&quot;nested-box&quot;&gt;Nested Flexbox 2&lt;/div&gt;<br>  &lt;/section&gt;<br>  &lt;footer&gt;<br>   &amp;copy; 2025 Flexbox Mastery. Designed for learning.<br>  &lt;/footer&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;<br><br><br><br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdF8kPCT3Eokw3rqRo0rnQ.jpeg" /><figcaption><em>Showcase Layouting With Flexbox</em></figcaption></figure><h3>🔧 Page Features:</h3><ul><li>🧭 A header with navigation using justify-content: space-between</li><li>📦 Three responsive cards using flex-wrap and flex: 1 1 30%</li><li>🪢 A nested Flexbox section showing container-inside-container flexibility</li><li>📱 Fully responsive layout thanks to media queries</li><li>🦶 A simple footer that grounds the design</li></ul><blockquote><em>🧪 Open the HTML file in your browser and resize the window to see how the layout adapts across devices.</em></blockquote><h3>🧠 Conclusion</h3><p>Flexbox is an indispensable tool in modern CSS layout design — offering simplicity and immense power for both basic and complex arrangements. Its key strengths lie in responsive adaptability, easy alignment controls, and nested layout capabilities.</p><h3>🚀 Final Thought</h3><p>Experiment with Flexbox properties beyond the basics, combine it with <strong>CSS Grid</strong> when needed, and keep practicing. The modern web’s flexibility and responsiveness depend heavily on these powerful layout techniques!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35300d15bfee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>