Text Decoration

Text Decoration అంటే ఏమిటి?

CSSలో text-decoration propertyని textకు underline, overline, లేదా line-through వంటి decorationలు ఇవ్వడానికి ఉపయోగిస్తాము. Textను చదవడానికి, ప్రత్యేకంగా చూపించడానికి లేదా తొలగించిన textలా చూపించడానికి ఇది ఉపయోగపడుతుంది.

ప్రధాన Text Decoration values

  • underline – text కింద గీతను చూపిస్తుంది.
  • overline – text పైన గీతను చూపిస్తుంది.
  • line-through – text మధ్యలో గీతను చూపిస్తుంది.
  • none – decorationను తొలగిస్తుంది. Linksలో default underline తొలగించడానికి ఇది ఉపయోగపడుతుంది.

ఒకే declarationలో text-decoration: underline; వంటి shorthand రాయవచ్చు. మరింత నియంత్రణ కోసం text-decoration-line, text-decoration-color, text-decoration-style, మరియు text-decoration-thickness properties ఉపయోగించవచ్చు.

Syntax

selector {
  text-decoration: value;
}

Browser HTML textను చదివి, selectorకు సరిపోయే elementపై decorationను చూపిస్తుంది. Text decoration text యొక్క layoutను సాధారణంగా మార్చదు; textపై అదనపు గీతను చూపిస్తుంది.

గమనించాల్సిన విషయం

Linksకు browser సాధారణంగా underline ఇస్తుంది. అవసరమైతే a { text-decoration: none; }తో దాన్ని తొలగించవచ్చు. కానీ linksను underline లేకుండా ఉంచితే అవి link అని ఇతర visual cuesతో కూడా స్పష్టంగా ఉండేలా చూడండి.

Simple Explanation

Text Decoration అంటే textపై లేదా text చుట్టూ కనిపించే గీత. ఉదాహరణకు, ముఖ్యమైన headingకు underline, పూర్తి చేసిన పనికి line-through, లేదా link underline తొలగించడానికి text-decoration ఉపయోగిస్తాము.

ఉదాహరణ: text-decoration: underline; text కింద గీతను ఇస్తుంది. text-decoration: line-through; text మధ్యలో గీతను ఇస్తుంది.

Real-Life Example

ఒక shopping listను ఊహించండి. ఇంకా కొనాల్సిన itemకు underline ఇవ్వవచ్చు. కొనుగోలు చేసిన itemకు line-through ఇస్తే అది పూర్తయిందని తెలుస్తుంది. ఇదే విధంగా CSSలో text decorationను ఉపయోగిస్తాము.

Code Examples

Underline, Overline మరియు Line-through

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Text Decoration</title>
  <style>
    .underline {
      text-decoration: underline;
      text-decoration-color: #1d4ed8;
      text-decoration-thickness: 2px;
    }

    .overline {
      text-decoration: overline;
    }

    .completed {
      text-decoration: line-through;
      text-decoration-color: #b91c1c;
    }
  </style>
</head>
<body>
  <h1 class="underline">Important Notice</h1>
  <p class="overline">This text has an overline.</p>
  <p class="completed">This task is completed.</p>
</body>
</html>

ఈ complete HTML pageలో మూడు paragraphs లేదా headingsకు మూడు రకాల text decorationలు ఇచ్చాము. underline text కింద గీతను, overline text పైన గీతను, line-through text మధ్యలో గీతను చూపిస్తుంది. text-decoration-color మరియు text-decoration-thicknessతో underline యొక్క రంగు మరియు మందాన్ని మార్చాము.

The page shows an Important Notice heading with a blue underline, a paragraph with a line above the text, and a completed task with a red line through the text.

Line-by-Line Explanation

.underline {
.underline classను ఉపయోగించే HTML elementలను select చేయడానికి ఈ CSS rule ప్రారంభమవుతుంది.
text-decoration: underline;
ఈ declaration text కింద underline గీతను చూపిస్తుంది.
text-decoration-color: #1d4ed8;
Underline గీతకు నీలం రంగును ఇస్తుంది.
text-decoration-thickness: 2px;
Underline గీత మందం 2 pixelsగా ఉంటుంది.
.overline {
.overline class ఉన్న elementను select చేస్తుంది.
text-decoration: overline;
Text పైన ఒక గీతను చూపిస్తుంది.
.completed {
పూర్తయిన task text కోసం .completed class ruleను ప్రారంభిస్తుంది.
text-decoration: line-through;
Text మధ్యలో గీతను చూపిస్తుంది. ఇది completed లేదా తొలగించిన itemలా కనిపిస్తుంది.

Important Notice


<h1> elementకు underline classను జతచేశారు. అందువల్ల headingకు blue underline కనిపిస్తుంది.

This text has an overline.


<p> elementకు overline class ఉన్నందున paragraph text పైన గీత కనిపిస్తుంది.

This task is completed.


ఈ paragraphకు completed class ఉంది. అందువల్ల text మధ్యలో ఎరుపు గీత కనిపిస్తుంది.

Try It

Try this CSS code:

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Try Text Decoration</title>
  <style>
    h1 {
      text-decoration: underline;
    }

    .done {
      text-decoration: line-through;
    }
  </style>
</head>
<body>
  <h1>My Tasks</h1>
  <p class="done">Read a CSS lesson</p>
  <p>Practice text decoration</p>
</body>
</html>

Try It Yourself »

Practice

Practice: పై practice_codeలో Important Task headingకు underline ఇవ్వండి. Submit the assignment textకు line-through ఇవ్వండి.

Hint: .important ruleలో text-decoration: underline; మరియు .finished ruleలో text-decoration: line-through; రాయండి.

Common Mistakes

text-decoration-line: underlined; అని valueను తప్పుగా రాయడం.
సరైన value underline. ఉదాహరణ: text-decoration-line: underline;.
text-decoration: underline అని semicolon లేకుండా declaration రాయడం.
Declaration చివర semicolon పెట్టండి: text-decoration: underline;.
line-through బదులు line through అని spaceతో రాయడం.
ఇది hyphenతో ఉండే ఒకే CSS value: text-decoration: line-through;.
Class selectorలో dot మర్చిపోవడం, ఉదాహరణకు important { … } అని రాయడం.
Classను select చేయడానికి selector ముందు dot పెట్టాలి: .important { … }.

Interview Questions

CSSలో text-decoration property ఎందుకు ఉపయోగిస్తారు?

Answer: Textకు underline, overline, line-through లేదా none వంటి decoration ఇవ్వడానికి text-decoration propertyని ఉపయోగిస్తారు.

Text నుంచి underline తొలగించడానికి ఏ value ఉపయోగిస్తారు?

Answer: Underline తొలగించడానికి text-decoration: none; ఉపయోగిస్తారు. Linksలో default underline తొలగించడానికి ఇది ఉపయోగపడుతుంది.

underline మరియు line-through మధ్య తేడా ఏమిటి?

Answer: underline text కింద గీతను చూపిస్తుంది. line-through text మధ్యలో గీతను చూపిస్తుంది.

Text decoration రంగును మార్చడానికి ఏ property ఉపయోగిస్తారు?

Answer: Text decoration గీత రంగును మార్చడానికి text-decoration-color propertyని ఉపయోగిస్తారు.

Exam Questions

Textకు పైన గీత ఇవ్వడానికి సరైన CSS declaration ఏది?

Answer:

text-decoration: overline;

Completed textను line-throughగా చూపించే CSS declaration రాయండి.

Answer:

text-decoration: line-through;

Link underline తొలగించడానికి ఏ declaration ఉపయోగిస్తారు?

Answer:

text-decoration: none;

Quick Revision

  • text-decoration textపై underline, overline లేదా line-through వంటి గీతలను చూపిస్తుంది.
  • underline text కింద గీతను చూపిస్తుంది.
  • overline text పైన గీతను చూపిస్తుంది.
  • line-through text మధ్యలో గీతను చూపిస్తుంది.
  • none decorationను తొలగిస్తుంది.
  • text-decoration-color మరియు text-decoration-thicknessతో decoration గీత రంగు మరియు మందాన్ని మార్చవచ్చు.
  • Class selectorను ఉపయోగించేటప్పుడు class name ముందు dot పెట్టాలి.

Test Your Knowledge

Take a short quiz based on this lesson.

10 Questions • Results
Scroll to Top