📜  CSS | text-indent 属性

📅  最后修改于: 2021-08-29 12:48:19             🧑  作者: Mango

CSS 中的 text-indent 属性用于定义每个文本块中第一行的缩进。它也取负值。这意味着如果值为负,则第一行将向左缩进。

句法:

text-indent: length|initial|inherit; 

属性值

  • length:用于设置固定缩进,单位px、pt、cm、em等,length默认值为0。

    句法:

    text-indent: length;

    例子:

    
    
        
            
                CSS text-indent Property
            
              
            
            
        
          
        
            

    GeeksforGeeks

            

    text-indent Property

                       

    text-indent: 70px:

            
                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.         
                       

    text-indent: -5em:

            
                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.         
                       

    text-indent: 40%:

            
                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.         
                                    

    输出:

  • 百分比 (%):用于定义与元素宽度相比以 % 为单位的缩进。

    句法:

    text-indent: %;

    例子:

    
    
        
            
                CSS text-indent Property
            
              
            
            
        
          
        
            

    GeeksforGeeks

            

    text-indent Property

                       

    text-indent: 40%:

            
                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:用于将 text-indent 属性设置为其默认值。

    句法:

    text:indent: initial;

    例子:

    
    
        
            
                CSS text-indent Property
            
              
            
            
        
          
        
            

    GeeksforGeeks

            

    text-indent Property

                       

    text-indent: 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.         
                                    

    输出:

支持的浏览器: CSS text-indent 属性支持的浏览器如下:

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