Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

One of the most common CSS issues people run into

54.3K views
•
October 31, 2023
by
Kevin Powell
YouTube video player
One of the most common CSS issues people run into

TL;DR

This video explains why setting a child element's height as a percentage doesn't work when the parent has a min-height set, and suggests alternative solutions.

Transcript

hello my front and friends the other day on this CSS subreddit I saw this question come up where someone was asking why a child element with a height as a percentage wasn't working when the Min height of the parent was set to 100 VH and this got me thinking about all the times I've seen this question come up from people asking me in my DMs to on my... Read More

Key Insights

  • 📏 If a child element with a percentage height is not working when the min-height of the parent is set to 100vh, it is because the parent's height is undefined, and a percentage height needs a defined height to work.
  • 👥 Browsers will not crash when there is a loop of undefined height, instead, they will treat the percentage height as nothing.
  • 📏 To make the child element's percentage height work, the parent's height should be defined, such as using a height value instead of min-height.
  • ❌ It is not recommended to use both min-height and height with a percentage value, as it can create potential overflow issues.
  • 🔀 Grid can introduce complications when trying to make a percentage height work, as the height will be based on the cell it's inside, not the parent element.
  • 💡 If a specific height is needed, it is possible to calculate the percentage value based on a known height, either by dividing it by 2 or using custom properties.
  • 📏 In general, it is often not necessary to specify heights, and using padding instead can be a simpler solution.
  • ❌ Declaring a width of 100% or 100vw without a specific reason can cause more problems than benefits, so it is best to avoid it unless necessary.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: Why doesn't setting a child element's height as a percentage work when the parent has a min-height set?

When the parent element has a min-height set, a loop is created where the child's percentage height cannot be calculated due to the undefined height of the parent.

Q: What is the recommended solution for setting the child element's height as a percentage?

The recommended solution is to give the parent element a definite height, either by setting a specific height or using custom properties, to allow the browser to calculate the percentage height accurately.

Q: Can CSS grid be used to solve the issue of percentage height not working?

CSS grid can be used as an alternative solution, but it can introduce complexity and potential overflow issues, especially when dealing with a single element.

Q: Are there any other issues related to setting widths in CSS?

Yes, setting widths like width: 100% or width: 100vw can also cause problems. It is often best not to declare a width unless absolutely necessary, to allow the elements to adjust naturally and avoid unnecessary complications.

Summary & Key Takeaways

  • When setting a child element's height as a percentage, it won't work if the parent element has a min-height set, creating a loop and causing the browser to ignore the percentage height.

  • Setting a specific height to the parent element solves the issue, as the browser can calculate the percentage based on the defined height.

  • An alternative solution is to use custom properties or CSS grid, but they can introduce potential overflow and complexity.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Kevin Powell 📚

HTML and CSS for Beginners Part 2: Building your first web page! thumbnail
HTML and CSS for Beginners Part 2: Building your first web page!
Kevin Powell
CSS gap is NOT a replacement for margins thumbnail
CSS gap is NOT a replacement for margins
Kevin Powell
5 CSS fouls that I see way too often thumbnail
5 CSS fouls that I see way too often
Kevin Powell
Stop over-engineering your CSS thumbnail
Stop over-engineering your CSS
Kevin Powell
HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments thumbnail
HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
Kevin Powell
Stop using @import with Sass | @use and @forward explained thumbnail
Stop using @import with Sass | @use and @forward explained
Kevin Powell

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.