CSS | letter-spacing Свойство

Опубликовано: 28 Февраля, 2022

Свойство letter-spacing в CSS используется для установки поведения интервала между текстовыми символами, т. Е. Увеличения или уменьшения расстояния между символами в тексте.

Синтаксис:

 межбуквенный интервал: нормальный | длина | начальный | наследование;

Property values:

  • normal: The normal letter spacing for the current font i.e no extra space between characters. This is the default value.
    Syntax:
    letter-spacing: normal;

    Example:

    <!DOCTYPE html>
    <html>
        <head>
            <title>CSS letter-spacing Property</title>
            <style>
                p {
                  letter-spacing: normal;
                }
            </style>
        </head>
        <body style = "text-align: center;">
            <h1 style = "color:green;">
                GeeksforGeeks
            </h1>
      
            <h2>
                CSS letter-spacing Property
            </h2>
      
            <p>
                This paragraph has letter-spacing: normal;
            </p>
        </body>
    </html>

    Output:

  • length: This mode specifies extra inter-character space in addition to the default space between characters. Negative values are also allowed.

    Syntax:

    letter-spacing: length;

    Example:

    <!DOCTYPE html>
    <html>
        <head>
            <title>CSS letter-spacing Property</title>
            <style>
                p {
                  letter-spacing: 5px;
      
                }
            </style>
        </head>
        <body style = "text-align: center;">
            <h1 style = "color:green;">
                GeeksforGeeks
            </h1>
      
            <h2>
                CSS letter-spacing Property
            </h2>
      
            <p>
                This paragraph has letter-spacing: 5px;
            </p>
        </body>
    </html>

    Output:

  • initial: This mode sets this property to its default value.
    Syntax:
    letter-spacing: initial;

Supported Browsers: The browser supported by letter-spacing property are listed below:

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 3.5
  • Apple Safari 1.0