What is the min-height and max-height property in CSS?

LAST READ: APR 11 2024 | Q. BY: SUNEETA SHUKLA

M

MEENA KUMAR SINGH

Min-Height Property In CSS


  • The min-height property in CSS is used to set the minimum height of an HTML element OR We can also say that sets the minimum height for an element by using min-height CSS property.
  • min-height value fixed for all devices like desktop, laptop, tablet, and mobile phones, etc.
  • And the most important thing, the min-height property has no effect if the content of an element is larger then the min-height.
  • The min-height CSS property overrides both the height & the max-height property if any of them is specified below the min-height value.

Syntax of min-height CSS Property

  • min-height: none | <length> | <percentage> | inherit
  • min-height: length;
  • min-height: percentage;
  • min-height: initial;
  • min-height: auto;
  • min-height: calc;
  • min-height: fill-available;
  • min-height: fit-content;
  •  min-height: max-content;
  • min-height: min-content;


Max-Height Property In CSS

  • The max-height property in CSS is used to set the maximum height of an HTML element OR We can also say that sets the maximum height for an element by using max-height CSS property.
  • The max-height overrides height, BUT the min-height overrides max-height.
  • If the content of the element is larger than the specified max-height then the content will overflow otherwise it has no effect.

Syntax of max-height CSS Property

  • max-height: none | <length> | <percentage> | inherit [Basic syntax]
  • max-height: length;
  • max-height: percentage;
  • max-height: initial;
  • max-height: auto;
  • max-height: calc;
  • max-height: fill-available;
  • max-height: fit-content;
  • max-height: max-content;
  • max-height: min-content;

1 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)