📜  基础 CSS 平滑滚动

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

基础 CSS 平滑滚动

Foundation CSS是由 ZURB 基金会于 2011 年 9 月构建的开源和响应式前端框架,可以轻松设计美观的响应式网站、应用程序和电子邮件,这些网站、应用程序和电子邮件看起来很棒并且可以在任何设备上访问。它被许多公司使用,例如 Facebook、eBay、Mozilla、Adobe,甚至迪士尼。该框架建立在类似 Saas 的引导程序上。它更加复杂、灵活且易于定制。它还带有 CLI,因此很容易与模块捆绑器一起使用。它提供了 Fastclick.js 工具,用于在移动设备上更快地呈现。

平滑滚动可以滚动到网页中的特定部分而无需刷新。我们可以在内部链接上启用平滑滚动,只需将data-smooth-scroll属性添加到父容器。每个组件都需要一个唯一的 ID。

基础 CSS 平滑滚动属性:

  • data-smooth-scroll:这个属性 必须添加到父容器,才能启用平滑滚动到所需的链接

基础 CSS 平滑滚动类:

  • menu:该类用于创建包含指向重要页面的链接的导航菜单。

句法:


Section 1 Content 
Section 2 Content 

示例 1 :此示例描述了 Foundation CSS 中带有粘性导航的平滑滚动。

HTML


  

    Foundation CSS Smooth Scroll
    
    
    

  

    
        
            
                             
            
                             
        
    
    
        
            

Smooth Scroll tutorial

            
                
                    

tutorials

                    
  • Practice DS & Algo.
  •                     
  • Algorithms
  •                     
  • Data Structures>
  •                     
  • Interview Corner
  •                     
  • Languages
  •                     
  • CS Subjects
  •                     
  • GATE
  •                     
  • Web Technologies
  •                     
  • Software Designs
  •                     
  • School Learning
  •                     
  • CS Exams/PSUs
  •                     
  • Student
  •                 
                    
                        

    jobs

                        

                              GeeksforGeeks has built a                          gigantic network of geeks from                         all over the globe, through various                          online and offline courses.                          We are offering IT companies                         to hire talented engineers with us                         at no cost of acquisition.                      

                    
                    
                        

    events

                    
                
            
        


    HTML
    
    
      
    
        Foundation CSS Smooth Scroll
        
        
        
    
      
    
        
            

    GeeksforGeeks

            

    Foundation css smooth scroll

        
        
            
                  Foundation CSS          
        
        
            
                
                    
                        

    Introduction

                        

                            A Foundation is an open-source and responsive front-end framework                         created by ZURB in September 2011 that makes it simple to create                         stunning responsive websites, apps, and emails that operate on any                         device. Many companies, like Facebook, eBay, Mozilla, Adobe, and                         even Disney, use it. The framework is based on bootstrap, which is                         similar to SaaS. It’s more complex, versatile, and configurable.                         It also comes with a command-line interface, making it simple to                         use with module bundlers. Email framework provides you with                         responsive HTML emails, which can be read on any device.                         Foundation for Apps allows you to build fully responsive web                         applications.                     

                    
                
            
        
        
            
                
                    
                        

    Foundation CSS native meter

                            

                                parameters: value: The numeric value that is currently in use. If                             the lowest and maximum values (min and max attributes) are                             defined, this must be between them. The value is 0 if the value is                             undefined or faulty. The value is equal to the nearest end of the                             range if supplied but not within the range defined by the min and                             max attributes. Note on usage: Unless the value attribute's value                             is between 0 and 1 (inclusive), the min and max attributes should                             be used to specify the range such that the value attribute's value                             is contained within it. min: The measured range's bottom numeric                             bound. If the maximum value (max attribute) is supplied, this must                             be smaller. The minimum value is 0 if none is given. low: The                             lower numeric bound of the measured range's bottom end. If any are                             supplied, this must be larger than the lowest value (min                             attribute) and less than the high and maximum values (high                             attribute and max attribute, respectively). The low value is equal                             to the minimum value if it is undefined or less than the minimum                             value. high: The lower numeric bound of the measured range's high                             end. If any are supplied, this must be less than the maximum value                             (max attribute) and larger than the low value and lowest value                             (low attribute and min attribute, respectively). If the high value                             is undefined or more than the maximum value, the high value equals                             the maximum value. optimum: The ideal numeric value is indicated                             by this characteristic. It has to be in the acceptable range (as                             defined by the min attribute and max attribute). It indicates                             where along the range is regarded ideal when combined with the low                             and high attributes. For example, if the min attribute and the low                             attribute are both available, the lower range is selected. max:                             The measured range's top numeric bound. If a minimum value (min                             attribute) is provided, this must be larger. The maximum value is                             1 if no value is supplied.                         

                    
                
            
        


    输出

    示例 2 :此示例描述了直接使用单个链接设置平滑滚动。

    HTML

    
    
      
    
        Foundation CSS Smooth Scroll
        
        
        
    
      
    
        
            

    GeeksforGeeks

            

    Foundation css smooth scroll

        
        
            
                  Foundation CSS          
        
        
            
                
                    
                        

    Introduction

                        

                            A Foundation is an open-source and responsive front-end framework                         created by ZURB in September 2011 that makes it simple to create                         stunning responsive websites, apps, and emails that operate on any                         device. Many companies, like Facebook, eBay, Mozilla, Adobe, and                         even Disney, use it. The framework is based on bootstrap, which is                         similar to SaaS. It’s more complex, versatile, and configurable.                         It also comes with a command-line interface, making it simple to                         use with module bundlers. Email framework provides you with                         responsive HTML emails, which can be read on any device.                         Foundation for Apps allows you to build fully responsive web                         applications.                     

                    
                
            
        
        
            
                
                    
                        

    Foundation CSS native meter

                            

                                parameters: value: The numeric value that is currently in use. If                             the lowest and maximum values (min and max attributes) are                             defined, this must be between them. The value is 0 if the value is                             undefined or faulty. The value is equal to the nearest end of the                             range if supplied but not within the range defined by the min and                             max attributes. Note on usage: Unless the value attribute's value                             is between 0 and 1 (inclusive), the min and max attributes should                             be used to specify the range such that the value attribute's value                             is contained within it. min: The measured range's bottom numeric                             bound. If the maximum value (max attribute) is supplied, this must                             be smaller. The minimum value is 0 if none is given. low: The                             lower numeric bound of the measured range's bottom end. If any are                             supplied, this must be larger than the lowest value (min                             attribute) and less than the high and maximum values (high                             attribute and max attribute, respectively). The low value is equal                             to the minimum value if it is undefined or less than the minimum                             value. high: The lower numeric bound of the measured range's high                             end. If any are supplied, this must be less than the maximum value                             (max attribute) and larger than the low value and lowest value                             (low attribute and min attribute, respectively). If the high value                             is undefined or more than the maximum value, the high value equals                             the maximum value. optimum: The ideal numeric value is indicated                             by this characteristic. It has to be in the acceptable range (as                             defined by the min attribute and max attribute). It indicates                             where along the range is regarded ideal when combined with the low                             and high attributes. For example, if the min attribute and the low                             attribute are both available, the lower range is selected. max:                             The measured range's top numeric bound. If a minimum value (min                             attribute) is provided, this must be larger. The maximum value is                             1 if no value is supplied.                         

                    
                
            
        

    输出:

    参考: https://get.foundation/sites/docs/smooth-scroll.html