본문 바로가기
[Front-End] 프론트엔드/[html5]

[html5] a 하이퍼링크 태그 새 창 새 탭에서 열기 소스 코드 예제

by codeomni 2018. 8. 23.
반응형

 

안녕하세요.

 

<a>~</a> 태그로 하이퍼링크를 사용할 수 있습니다.

하이퍼링크를 클릭 했을 경우 기본창에서 링크됩니다.

 

다른 웹 페이지나 파일을 열 경우에는 <a>~</a> 태그의 속성을 사용합니다.

target 속성에서는 다양한 링크 열기를 할 수 있습니다.

 

-_blank: 새 탭, 창

-_self: 현재 탭, 창

-_parent: 부모 탭, 창
-_top: 최상위 탭, 창

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
    <head>
        <title>codeomni.tistory.com html5 a 하이퍼링크 태그 새 창 새 탭에서 열기 소스 코드 예제</title>
        <style>
            body {
                background-color: #9adaca;
            }
        </style>
    </head>
    <body>
        <div>
            <h1>codeomni.tistory</h1>
            <a href="http://codeomni.tistory.com/" target="_blank">새 창, 탭 열기</a>
            <a href="http://codeomni.tistory.com/" target="_self">현재 창, 탭 열기</a>
            <a href="http://codeomni.tistory.com/" target="_parent">부모 탭, 창</a>
            <a href="http://codeomni.tistory.com/" target="_top">최상위 탭, 창</a>
        </div>
    </body>
</html>

cs

 

 

 

 

실행 화면입니다.

 

 

 

댓글