દરેક એલિમેન્ટમાં ડિફોલ્ટ display વર્તન હોય છે જે લેઆઉટમાં તેનો પ્રવાહ નિયંત્રિત કરે છે.
<div>, <p>, <h1>, <section>, <ul>.<span>, <a>, <strong>, <em>.<p>This is a <strong>bold</strong> word inside a paragraph.</p>
<!-- <strong> stays inline; the two <div>s below stack vertically -->
<div>Block one</div>
<div>Block two</div>
span { width: 200px; height: 50px; } /* ❌ ignored — span is inline */
ઇનલાઇન એલિમેન્ટ પર width/height સેટ કરવું કંઈ નથી કરે. સુધારો તેના display બદલવો છે:
span { display: inline-block; width: 200px; } /* ✅ flows inline BUT respects size */
inline-block ટેક્સ્ટ ફ્લોમાં (બાજુમાં બાજુ) બેઠો છે અને width/height/margins ને સન્માન આપે છે — નેવ આઇટમ્સ, બેજ્ડ, અથવા સમૂહમાં રચાયેલા બટનો માટે પરફેક્ટ.
block → new line, full width, sizeable
inline → in-line, content width, NOT sizeable (vertically)
inline-block → in-line, content flow, sizeable
ડિફોલ્ટ display સમજવું સમજાવે છે કે આપનું <span> ઉચ્ચાઈ શા માટે લેશે નહીં, <div> કેમ સ્ટેક થાય છે, અને inline-block, flex, અથવા grid પર ક્યારે સ્વિચ કરવું.
તમે કોઈપણ લેઆઉટ સિસ્ટમ લાગુ કરો તે પહેલાં તે એલિમેન્ટ્સ કેવી રીતે ગોઠવાય તેનો આધાર છે.