본문으로 건너뛰기

Text Alignment (text-align), Text Decoration (text-decoration)

Text Alignment (text-align), Text Decoration (text-decoration)

text-align

text-align is a property that specifies the horizontal alignment of content (mainly text) within an HTML element.

Examples:

  • Left align:

    CSS
    .left-align {
    text-align: left;
    }
  • Center align:

    CSS
    .center-align {
    text-align: center;
    }
  • Right align:

    CSS
    .right-align {
    text-align: right;
    }
  • Justify align:

    CSS
    .justify-align {
    text-align: justify;
    }

text-decoration

text-decoration is a property that adds or removes decorations to text.

Examples:

  • Underline:

    CSS
    .underline {
    text-decoration: underline;
    }
  • Overline:

    CSS
    .overline {
    text-decoration: overline;
    }
  • Line-through:

    CSS
    .line-through {
    text-decoration: line-through;
    }
  • No decoration:

    CSS
    .no-decoration {
    text-decoration: none;
    }

Please follow the asterisk-emphasized parts of the code as you input.