📜  CSS | max-height 属性

📅  最后修改于: 2021-08-30 10:10:40             🧑  作者: Mango

CSS 中的 max-height 属性用于设置元素的最大高度。如果元素的内容大于指定的最大高度,则内容将溢出,否则无效。如果元素的内容更小,则没有效果。 height 属性值可以被 max-height 属性覆盖。

句法:

max-height: none|length|initial|inherit; 

属性值:

  • none:默认值,不包含max-height。它与没有最大高度规范是同义词。

    句法:

    max-height: none;

    例子:

    
    
        
            max-height property
              
            
        
      
        
            

                Prepare for the Recruitment drive of             product based companies like Microsoft,              Amazon, Adobe etc with a free online              placement preparation course. The course             focuses on various MCQ's & Coding question             likely to be asked in the interviews & make             your upcoming placement season efficient             and successful.         

        

    输出:
    最大高度

  • length:此属性用于定义长度的最大高度。可以使用 px、em 等设置长度。

    句法:

    max-height: length;

    例子:

    
    
        
            max-height property
              
            
        
      
        
            

                Prepare for the Recruitment drive of             product based companies like Microsoft,              Amazon, Adobe etc with a free online              placement preparation course. The course             focuses on various MCQ's & Coding question             likely to be asked in the interviews & make             your upcoming placement season efficient             and successful.         

        

    输出:
    最大高度

  • initial:该属性用于将 max_height 的值设置为其默认值。

    句法:

    max-height: initial;

    例子:

    
    
        
            max-height property
              
            
        
      
        
            

                Prepare for the Recruitment drive of             product based companies like Microsoft,              Amazon, Adobe etc with a free online              placement preparation course. The course             focuses on various MCQ's & Coding question             likely to be asked in the interviews & make             your upcoming placement season efficient             and successful.         

        

    输出:
    最大高度

  • 继承:此属性是从其父级继承的。

支持的浏览器: max-height属性支持的浏览器如下:

  • 谷歌浏览器 1.0
  • 浏览器 7.0
  • 火狐 1.0
  • 歌剧7.0
  • Safari 2.0.2