Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
CSS

CSS: Master Font Sizing for Responsive Typography

- 18.07.26 - ErcanOPAK

📝 Font Sizing = Responsive Typography

Font sizing affects readability. Master font sizing for responsive, accessible typography.

📝 Font Size Units

/* px - Absolute */
font-size: 16px;

/* em - Relative to parent */
font-size: 1.2em;

/* rem - Relative to root */
font-size: 1.2rem;

/* % - Percentage of parent */
font-size: 120%;

/* Viewport units */
font-size: 2vw;
font-size: 3vh;

/* clamp() - Responsive */
font-size: clamp(1rem, 2.5vw, 2rem);
font-size: clamp(14px, 2vw, 24px);

/* Responsive typography */
html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
}

/* Fluid typography */
h1 {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

p {
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
}

🎯 Typography Scale

/* Modular scale */
/* 1.25 scale */
h1 { font-size: 2.441rem; }
h2 { font-size: 1.953rem; }
h3 { font-size: 1.563rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.8rem; }
p  { font-size: 1rem; }

/* Small text */
.small { font-size: 0.8rem; }
.extra-small { font-size: 0.6rem; }

/* Large text */
.large { font-size: 1.2rem; }
.extra-large { font-size: 1.5rem; }

/* Responsive headings */
h1 {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
}
h2 {
    font-size: clamp(1.25rem, 4vw, 2.5rem);
}

/* Font sizing best practices */
body {
    font-size: 16px; /* Base */
    line-height: 1.6;
}

/* Accessibility */
/* Minimum font size: 16px for body text */
/* Use rem for accessibility */

💡 Font Sizing Tips

  • Use rem for accessibility
  • Use clamp() for responsive
  • Maintain hierarchy
  • Keep body text 16px+
  • Use modular scale

“Font sizing affects readability. Master it for responsive typography. Essential for UX.”

— UI Designer

Related posts:

CSS opacity Breaks Child Elements — Use RGBA Instead

CSS: Fix a Hover Effect That Flickers Repeatedly Instead of Staying Stable

CSS: Fix Elements That Ignore max-width Because of a Missing box-sizing Reset

Post Views: 2

Post navigation

Windows 11: Secure Your PC with Windows Security
HTML: Use Output Element for Form Results

Leave a Reply Cancel reply

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

October 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Sep    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (973)
  • How to make theater mode the default for Youtube (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (939)
  • Get the First and Last Word from a String or Sentence in SQL (847)
  • How to select distinct rows in a datatable in C# (837)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (624)
  • Add Constraint to SQL Table to ensure email contains @ (590)
  • Average of all values in a column that are not zero in SQL (553)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (526)
  • Find numbers with more than two decimal places in SQL (468)

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps
  • Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen
  • WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago
  • Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore
  • ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In
  • JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (973)
  • How to make theater mode the default for Youtube (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (939)
  • Get the First and Last Word from a String or Sentence in SQL (847)
  • How to select distinct rows in a datatable in C# (837)

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com