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

CSS를 사용하여 텍스트 정렬 설정

<시간/>

CSS를 사용하여 텍스트 정렬을 설정하려면 text-align 속성을 사용하십시오. 다음은 가능한 속성 값입니다 -

text-align: left|right|center|justify|initial|inherit;

예시

텍스트 정렬을 설정하는 예를 살펴보겠습니다 -

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   -webkit-columns: auto auto; /* Chrome, Safari, Opera */
   -moz-columns: auto auto; /* Firefox */
   columns: auto auto;
   text-align: justify;
}
</style>
</head>
<body>
<h1>Machine Learning</h1>
<div class="demo">
Today’s Artificial Intelligence (AI) has far surpassed the hype of blockchain and quantum computing. This is due to the fact that huge computing resources are easily available to the common man. The developers now take advantage of this in creating new Machine Learning models and to re-train the existing models for better performance and results. The easy availability of High Performance Computing (HPC) has resulted in a sudden increased demand for IT professionals having Machine Learning skills.
</div>
</body>
</html>

출력

CSS를 사용하여 텍스트 정렬 설정

예시

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

<!DOCTYPE html>
<html>
<head>
<style>
body {
   background-image: linear-gradient(to right, yellow,orange,yellow,green,blue,indigo,violet);
}
.demo {
   text-decoration: overline;
   text-decoration-color: yellow;
   font-variant:normal;
   text-align: center;
}
</style>
</head>
<body>
<h1>Examination Details</h1>
<p class="demo">Exam on 20th December.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

출력

CSS를 사용하여 텍스트 정렬 설정