<!-- 하나의 정보만을 나타내려면 -->
<base href="https://example.com"> <!-- href 속성만 사용할 경우 -->
<base target="_blank"> <!-- target 속성만 사용할 경우 -->

<!-- 두 정보를 모두 나타내려면  -->
<base href="https://example.com" target="_blank"> <!-- 먼저 작성해야 하는 속성의 우선순위는 없음 -->
<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>base 태그</title>
        <base href="https://codingeverybody.kr/category/html/" target="_blank">
    </head>
    <body>
        <a href="html-tag/">HTML 태그 소개</a>
        <!-- href="https://codingeverybody.kr/category/html/html-tag/"와 동일합니다.
             '복잡한 디렉토리 경로를 일일이 쓰지 않고도'
             문서 안에서 상대 경로를 '깔끔하고 간단'하게 사용할 수 있게 됩니다. -->
    </body>
</html>
실제 적용된 모습
복잡한 웹사이트의 디렉토리 구조의 예
<head>
    <base href="https://example.com/projects/2025/docs/html/">
</head>
<body>
    <a href="guide.html">Guide</a>
    <img src="images/logo.png" alt="Logo">
</body>
<head>
    <base href="https://example.com">
    <base target="_blank">
</head>
<head>
    <base href="https://example-1.com">
</head>
<body>
    ...
    <base href="https://example-2.com">
    ...
</body>
<head>
    <base href="https://example-1.com">
</head>
<body>
    ...
    <base target="_blank">
    ...
</body>
<head>
    <base href="https://example.com/dir/">
</head>
<body>
    <a href="#section-1">페이지 내에서의 이동</a> <!-- href="https://example.com/dir/#section-1"과 동일합니다. -->
    <section id="section-1">
        ...
    </section>
</body>
<head>
    <base href="https://example.com/dir/">
    <meta property="og:url" content="https://www.example.com/dir/example.html">
</head>