Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS에서 텍스트에 사용되는 장식 종류 설정

<시간/>

텍스트에 사용할 장식의 종류를 설정하려면 text-decoration-line 속성을 사용하십시오. CSS에는 다음과 같은 텍스트 장식 옵션이 있습니다.

text-decoration-line: none|underline|overline|line-through|initial|inherit;

예시

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline underline;
   text-decoration-color: blue;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

출력

CSS에서 텍스트에 사용되는 장식 종류 설정

예시

이제 다른 예를 살펴보겠습니다 -

<!DOCTYPE html>
<html>
<head>
<style>
span {
   text-decoration: line-through;
   text-decoration-color: blue;
}
.demo2 {
   text-decoration: underline;
   text-decoration-color: yellow;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near <span>XYZ College</span> ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>

출력

CSS에서 텍스트에 사용되는 장식 종류 설정