📜  HTML | DOM 样式清除属性

📅  最后修改于: 2021-10-28 03:03:10             🧑  作者: Mango

HTML 中的DOM Style clear属性用于设置获取特定元素相对于浮动对象的位置。

句法

  • 要获得明确的财产:
    object.style.clear
    
  • 设置清除属性:
    object.style.clear = "none|left|right|both|initial|inherit"
    

属性值:

value description
left Does not allow floating entities on the left of the element
right Does not allow floating entities on the right of the element
both Does not allow floating entities on the left or right of the element
none Allows floating entities on the left of the element as well as on the right of the element.This is default
initial Sets the value of the property to its default value.
inherit Inherits the value of this property i.e sets the value same as that of the parent

返回值:它返回一个字符串,表示元素相对于浮动对象的位置。

示例 1:



  

    
        HTML | DOM Style clear Property
    
    

  

  
    
  
    

      GEEKSFORGEEKS PARAGRAPH HERE GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE     

                     

输出:

  • 点击前:
  • 点击后:

    示例 2:

    
    
      
    
        
            HTML | DOM Style clear Property
        
        
    
      
    
      
        
      
        

          GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE        GEEKSFORGEEKS PARAGRAPH HERE     

                         

    输出:

    • 点击前:
    • 点击后:

      示例 3:

      
      
        
      
          
              HTML | DOM Style clear Property
          
          
      
        
      
        
          
          
        
          

            GEEKSFORGEEKS PARAGRAPH HERE       GEEKSFORGEEKS PARAGRAPH HERE      

                           

      输出:

      • 点击前:
      • 点击后:

        支持的浏览器: HTML支持的浏览器| DOM 样式清除属性
        下面列出:

        • 谷歌浏览器
        • 边缘
        • 火狐浏览器
        • 歌剧
        • 苹果浏览器