본문 바로가기

HTML

Id

Id

<!DOCTYPE html>
<html>
  <head>
    <style>
      /* Style the element with the id "myHeader" */
      #myHeader {
        background-color: lightblue;
        color: black;
        padding: 40px;
        text-align: center;
      }
    </style>
  </head>
  <body>
    <!-- An element with a unique id -->
    <h1 id="myHeader">My Cities</h1>
    <p><a href="#C3">Jump to Chapter 3</a></p>
    <p><a href="#C5">Jump to Chapter 5</a></p>

    <h2 id="C1">Chapter 1</h2>
    <p>This chapter explains</p>

    <h2 id="C2">Chapter 2</h2>
    <p>This chapter explains</p>

    <h2 id="C3">Chapter 3</h2>
    <p>This chapter explains</p>

    <h2 id="C4">Chapter 4</h2>
    <p>This chapter explains</p>

    <h2 id="C5">Chapter 5</h2>
    <p>This chapter explains</p>
  </body>
</html>

'HTML' 카테고리의 다른 글

FilePath  (0) 2023.02.01
iframe  (0) 2023.02.01
Class  (0) 2023.02.01
Block&Inline  (0) 2023.02.01
Lists  (0) 2023.02.01