📜  如何使用 Google AMP amp-accordion 创建自动折叠手风琴?

📅  最后修改于: 2022-05-13 01:56:30.618000             🧑  作者: Mango

如何使用 Google AMP amp-accordion 创建自动折叠手风琴?

有时我们有很多内容要显示,为了使网站看起来漂亮而简短,我们会使用可折叠的文本框。可折叠文本框是标题和内容相结合的划分,一般只有标题可见,点击时显示内容。

设置:

您必须在标头中导入 amp-accordion 组件才能使用此标签。

HTML


HTML

   


HTML


  

    
    Google AMP amp-accordion
  
    
      
    
      
    
  
    
  
    
  
    
  
    
    

  

    

        Geeks For Geeks     

                
            

Section 1

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
           
            

Section 2

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
        
            

Section 3

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
    
  


要制作自动折叠手风琴,请使用下面提到的代码。 expand-single-section 属性可帮助您一次只允许展开一个部分。

HTML


   

例子:

HTML



  

    
    Google AMP amp-accordion
  
    
      
    
      
    
  
    
  
    
  
    
  
    
    

  

    

        Geeks For Geeks     

                
            

Section 1

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
           
            

Section 2

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
        
            

Section 3

              

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well                  explained computer science and                  programming articles, quizzes etc.             

           
    
  

输出: