【CSS】font-styleプロパティで文字のスタイルを指定して変更する

プログラミング

font-styleプロパティ

CSS(スタイルシート)のfont-styleは、文字のスタイルを指定して変更するプロパティです。
normal(通常体)、italic(筆記体)、oblique(斜体)のどのスタイルにするか指定します。

font-styleプロパティの値

normal通常体
italic筆記体
oblique斜体

font-styleの書き方

@charset "utf-8";

body {
    font-family: serif;
}

.normal {
    font-style: normal;
    font-size: 200%;
}
.italic {
    font-style: italic;
    font-size: 200%;
}

.oblique {
    font-style: oblique;
    font-size: 200%;
}
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css" type="text/css">
    <title>テストページ</title>
</head>
<body>
    <p class="normal">フォントのスタイルを変更</p>
    <p class="italic">フォントのスタイルを変更</p>
    <p class="oblique">フォントのスタイルを変更</p>
</body>
</html>

タイトルとURLをコピーしました