다연이네

[days01] html 링크 - 페이지 간에 이동, 다른 문서로 이동 본문

Web/HTML

[days01] html 링크 - 페이지 간에 이동, 다른 문서로 이동

 다연  2020. 11. 30. 20:27
반응형

<a href="링크"> 내용 </a>

<a href="링크" target ="_self" > 내용 </a>

<a href="링크" target="_blank"> 내용 </a> : 새 창 띄워 이동

 

그 외 target 종류 : _blank(새창),  _self(기본), _ parent(상위 프레임에 문서를 열겠다),  top(창 전체에 문서 열겠다)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>html 링크 - 페이지 간에 이동, 다른 문서로 이동할 수 있다. </h3>
<a href="http://www.naver.com">naver</a><br>
<a href="http://www.daum.net" target="_blank">daum</a><br>
<!--  href 속성 = "이동할 URL"-->
<!--  방문한 적이 있으면 보라색 없으면 파란색-->


<!-- target 종류 : _blank(새창), _self(기본), _parent(상위 프레임에 문서를 열겠다), top(창 전체에 문서 열겠다)-->

<hr>
상대경로(URL) 
절대경로(URL) == 전체 웹 주소 -->
<p> <a href="http://localhost/webPro/html/days01/ex05.html">ex05.html</a></p>
<!-- 위 href는 절대경로  -->
<!-- ex09.html과 ex05.html은 같은 폴더 내에 있는 파일이기에 파일명만 사용하면 경로 지정 가능  -->
<p> <a href="ex05.html">ex05.html</a></p>
<!-- 위 href는 상대경로  -->
<p> <a href="/ex05.html">ex05.html</a></p>
<!-- /를 붙히니 http://localhost/ex05.html  로 잡히고
		이러면 완전히 다른 경로,
		/붙히려면 /webPro/html/days01//까지 붙혀야함-->
<p> <a href=" /webPro/html/days01//ex05.html">ex05.html</a></p>

<!--1. 절대경로  -->
<p> <a href="http://localhost/webPro/index.html">1. index.html</a></p>
<!--2. /컨텍트패스/~  -->
<!-- ex09.html 기준으로 index.html 상대경로를 표시  -->
<p> <a href="/webPro/index.html">2. index.html</a></p>
<!--3. ex09.html  -->
<p> <a href=" ./../../index.html">3. index.html</a></p>

<!-- 주의사항 : 경로 표시할때 구분자는 슬래쉬(/)이고 역슬래쉬(\)하면 안됨 -->
</body>
</html>

 

반응형
Comments