본문 바로가기

소프트웨어/JavaScript

[CSS] text size property / text align property

오늘은 CSS text size property(글자 크기 조절), CSS text align property(정렬)을 배웠다.

 

 

CSS text size property

<style> 영역에 변경하고 싶은 부분 (h1) 선택자를 추가하여 font-size 속성을 이용해 글자 크기를 변경하면 된다. 

font-size:원하는크기(px, %...);

<!DOCTYPE HTML>
<html>
    <head>
        <title>WEB - CSS</title>
        <meta charset="utf-8">
        <style>
            a{
                color:black;
                text-decoration:none;
            }

            h1{
                font-size: 60px;
            }
        </style>
    </head>
    <body>
        <h1><a href="index.html">WEB</a></h1>

 

 

 

CSS text align property

가운데 정렬을 하고 싶을 경우

<style> 영역에 변경하고 싶은 부분 (h1) 선택자를 추가하여 text-align 속성을 이용해 텍스트를 가운데 정렬하면 된다. 

<!DOCTYPE HTML>
<html>
    <head>
        <title>WEB - CSS</title>
        <meta charset="utf-8">
        <style>
            a{
                color:black;
                text-decoration:none;
            }

            h1{
                font-size: 60px;
                text-align:center;
            }
        </style>
    </head>
    <body>
        <h1><a href="index.html">WEB</a></h1>

 

 

 

그 외 다른 정렬을 하고 싶을 경우에는 참고해서 사용하면된다.