CSS | Propiedad de sangría de texto

La propiedad text-indent en CSS se usa para definir la sangría de la primera línea en cada bloque de texto. También toma valores negativos. Significa que si el valor es negativo, la primera línea se sangrará a la izquierda.

Sintaxis:

text-indent: length|initial|inherit; 

Valores de propiedad

  • longitud: se utiliza para establecer una sangría fija en términos de px, pt, cm, em, etc. El valor predeterminado de longitud es 0.

    Sintaxis:

    text-indent: length;

    Ejemplo:

    <!DOCTYPE html>
    <html>
        <head>
            <title>
                CSS text-indent Property
            </title>
              
            <!-- CSS text-indent property -->
            <style>
                .sudo {
                    text-indent: 70px;
                }
                  
                .geeks {
                    text-indent: -5em;
                }
                  
                .gfg {
                    text-indent: 40%;
                }
            </style>
        </head>
          
        <body>
            <h1 style = "">GeeksforGeeks</h1>
            <h2> text-indent Property</h2>
              
            <h2>text-indent: 70px:</h2>
            <div class = "sudo">
                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.
            </div>
              
            <h2>text-indent: -5em:</h2>
            <div class = "geeks">
                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.
            </div>
              
            <h2>text-indent: 40%:</h2>
            <div class = "gfg">
                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.
            </div>
          
        </body>
    </html>                    

    Producción:

  • porcentaje (%): Se utiliza para definir la sangría en % con respecto al ancho del elemento.

    Sintaxis:

    text-indent: %;

    Ejemplo:

    <!DOCTYPE html>
    <html>
        <head>
            <title>
                CSS text-indent Property
            </title>
              
            <!-- CSS text-indent property -->
            <style>
                .gfg {
                    text-indent: 40%;
                }
            </style>
        </head>
          
        <body>
            <h1 style = "">GeeksforGeeks</h1>
            <h2> text-indent Property</h2>
              
            <h2>text-indent: 40%:</h2>
            <div class = "gfg">
                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.
            </div>
          
        </body>
    </html>                    

    Producción:

  • inicial: se utiliza para establecer la propiedad de sangría de texto en su valor predeterminado.

    Sintaxis:

    text:indent: initial;

    Ejemplo:

    <!DOCTYPE html>
    <html>
        <head>
            <title>
                CSS text-indent Property
            </title>
              
            <!-- CSS text-indent property -->
            <style>
                .gfg {
                    text-indent: initial;
                }
            </style>
        </head>
          
        <body>
            <h1 style = "">GeeksforGeeks</h1>
            <h2> text-indent Property</h2>
              
            <h2>text-indent: initial:</h2>
            <div class = "gfg">
                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.
            </div>
          
        </body>
    </html>                    

    Producción:

Navegadores compatibles: los navegadores compatibles con la propiedad de sangría de texto CSS se enumeran a continuación:

  • Google Chrome 1.0
  • Internet Explorer 3.0
  • Firefox 1.0
  • Safari 1.0
  • Ópera 3.5

Publicación traducida automáticamente

Artículo escrito por ManasChhabra2 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *