0
0

More than 3 years have passed since last update.

TechAcademyが無料公開している「HTML・CSS入門講座」を受講する~HTML第2-5回~

Last updated at Posted at 2020-06-08

アジェンダ

  • HTMLのタグ
    • code
    • pre
  • 実践

HTMLのタグ

code

文書がコンピュータ用語、ソースコードなどであることを示すタグ。

pre

HTMLファイルに記述された文書を「そのまま」表示させていることを示すタグ。
「そのまま」というのは、本来タグを使用しなければ変化しない書式などを、記載されているそのままに表示させる、ということである。

実践

上記のタグを用いて、以下のindex.htmlを作成した。

index.html
<!DOCTYPE html>

<html lang="ja">
  <head>
    <meta charset="UTF-8">
    <title>Lorem Ipsum</title>
  </head>
  <body>
    <h1>Lorem Ipsum</h1>
    <p>
      <code>Lorem ipsum</code> dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    </p>
    <pre>
      Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </pre>
  </body>
</html>

これをWebブラウザに表示させるとこんな感じ。
index.png

<code>を使用した箇所はフォントとサイズが変化している。
<pre>を使用した箇所は、タグを使用していないが、インデントと改行が反映され、フォントとサイズが変化している。

おわりに

今回は、文書を見やすく表示させる方法を学んだ。

内容に全く関係ないが、連日似たようなタイトルの記事を連投していたらスパムを疑われたので、投稿頻度を減し一度にまとめる内容を増やそうと思う。

次回 >> ここ

参考

2-5 コード、改行、プリフォーマット(HTMLのテキスト)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0