📜  CSS | min-width 属性

📅  最后修改于: 2021-09-01 01:45:35             🧑  作者: Mango

CSS 中的 min-width 属性用于定义元素的最小宽度。 width 的值不能小于 min-width 的值。如果元素内指定的内容较小,则 min-width 保持指定的最小宽度。

句法:

min-width: length|initial|inherit;

属性值:

  • length:该属性用于设置min-width的长度。长度可以设置为px、cm等形式。

    句法:

    min-width: length;

    例子:

     
     
         
            min-width property 
              
            
             
         
          
         
            

                  GeeksforGeeks: A computer science portal          

                                 

    输出:

  • 百分比(%):用于设置最小宽度的百分比。

    句法:

    min-width: %;

    例子:

     
     
         
            min-width property 
              
            
             
         
          
         
            

                  GeeksforGeeks: A computer science portal          

                                 

    输出:

  • initial:用于将 min-width 属性设置为其默认值。

    句法:

    min-width: initial;

    例子:

     
     
         
            min-width property 
              
            
             
         
          
         
            

                  GeeksforGeeks: A computer science portal          

                                 

    输出:

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

    句法:

    min-width: inherit;

    例子:

     
     
         
            min-width property 
              
            
             
         
          
         
            
                

                      GeeksforGeeks: A computer science portal              

                  
                      GeeksforGeeks: A computer science portal              
              
                                                

    输出:

支持的浏览器: min-width属性支持的浏览器如下:

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