WEB/HTML

[HTML] <p></p>, <a href=""> </a>, <img src="" alt="">

bay07 2024. 3. 10. 01:21
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>My page</title>
</head>
<body>
  <p>My page</p>
  <a href="https://www.google.co.kr/">Google</a>
  <img src="images/sample.png" alt="sample imge">
</body>
</html>

 

Paragraph element

<p>Hi I am a watermelon</p>

 

 

문단이 들어가는 부분

 

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p

 

<p>: The Paragraph element - HTML: HyperText Markup Language | MDN

The <p> HTML element represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related con

developer.mozilla.org

 


Anchor (하이퍼텍스트)

<a href="https://www.naver.com">Bear</a>

 

Bear을 클릭하면 url 페이지로 이동하겠다. 

 


 

image tag

<img src="./images/bear.jpg" alt="It doesn't work">

 

이미지 태그는 닫는 태그가 없다. 

중간에 내용이 없다는 뜻 

(여는 태그와 닫는 태그가 있다는 것은, 중간에 내용이 있다는 뜻이다)

 

src는 source의 약자이다.

우리가 가져오는 이미지의 소스 자체가 contents이기 때문에

따로 contents가 필요하지 않다.

 

alt는 대체 텍스트이다.

이미지의 경로가 잘못 되었거나, 이미지 파일이 누락되었을 때