📜  CSS |背景附件属性

📅  最后修改于: 2021-08-29 13:21:13             🧑  作者: Mango

CSS 中的属性 background-attachment 属性用于指定背景图像相对于其容器的附件类型。它可以设置为滚动或保持固定。它可以应用于所有 HTML 元素。

句法:

background-attachment: scroll|fixed|local|initial|inherit;

财产:
滚动:它将背景图像设置为固定在其相对于包含元素的位置并随页面滚动。它是默认值。

  • 句法:
    background-attachment: scroll;
  • 例子:
    
    
        
            
                background-attachment property
            
              
            
        
          
        
            

    GeeksforGeeks

            

    background-attachment: scroll;



                       
        

            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.     

        
        
        
           

          This course is especially designed for the       Java apprentices who want to hone their        skills in Java for Coding Interviews and       Competitive Programming. No matter if you        are a school student or college student,        if you have the zeal of programming, this        is the right time to start.     

        
        
        
           

            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     

        
        
        
           

          This course is especially designed for the       Java apprentices who want to hone their        skills in Java for Coding Interviews and       Competitive Programming. No matter if you        are a school student or college student,        if you have the zeal of programming, this        is the right time to start.       

        
        
        
           

            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     

        
                                         
  • 输出:

fixed:此属性用于将背景图像设置为固定在其相对于视口的位置。

  • 句法:
    background-attachment: fixed;
  • 例子:
    
    
        
            
                background-attachment property
            
              
            
        
          
        
            

    GeeksforGeeks

            

    background-attachment: fixed;



                       
             

                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.          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.          

             
             
             
                

                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          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.            

             
             
             
                         

                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          

            
                             
  • 输出:

local:此属性用于设置背景图像与其容器元素的内容而不是页面一起滚动。

  • 句法:
    background-attachment: local;
  • 例子:
    
    
        
            
                background-attachment property
            
              
            
        
          
        
            

    GeeksforGeeks

            

    background-attachment: local;



                       
             

                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.          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.          

             
             
             
                

                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          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.            

             
             
             
                         

                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:用于将背景附件属性设置为其默认值。

  • 句法:
    background-attachment: initial;
  • 例子:
    
    
        
            
                background-attachment property
            
              
            
        
          
        
            

    GeeksforGeeks

            

    background-attachment: initial;



                       
             

                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.          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.          

             
             
             
                

                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          

             
             
             
                

              This course is especially designed for the           Java apprentices who want to hone their            skills in Java for Coding Interviews and           Competitive Programming. No matter if you            are a school student or college student,            if you have the zeal of programming, this            is the right time to start.            

             
             
             
                         

                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          

            
                             
  • 输出:

继承:用于从其父元素设置属性。

支持的浏览器: background-attachment 属性支持的浏览器如下:

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