Window 객체는? 최상위 객체로 모든 객체가 소속된 객체이다.
html, css, JavsScript? 문서를 작성하고 문서를 꾸미고, 문서를 제어하는 그 과정의 이해가 필요하다. 문서에 들어가는 요소별 이름을 정해주어 그 요소별의 디자인과 기능을 정의할 수 있다.
인라인요소 : 자체 크기가 없음(줄바꿈 x, 크기조정 x) 예 : span
블록요소 : 자체 크기가 있음. (배치하기 까다로움) 예 : div
display: block;과 같은 함수로 강제로 블록으로 전환 가능
<style>
.rect{
display: block;
width: 150px;
height: 40px;
background-color: aqua;
}
.rect2{
/* display: block; 이런식으로 인라인을 강제로 블록으로 변경 가능 */
width: 150px;
height: 150px;
background-color: pink;
}
</style>
<body>
<!-- div 블록요소 -->
<div class="rect">1</div>
<div class="rect">2</div>
<div class="rect">3</div>
<!-- span.rect*3 emmet 키 -->
<span class="rect2">1</span>
<span class="rect2">2</span>
<span class="rect2">3</span>
</body>
- write() 함수 : 태그와 텍스트노드를 쓴다.
```html
document.write("<h1>뉴스제목</h>")
```
백틱(`)을 사용하면 ${}를 사용해서 문자열과 변수를 적절히 같이 사용할 수 있다.
const num1 = 10;
const num2 = 20;
console.log(num1 + ' + ' + num2 + ' = ' + (num1+num2) + " 입니다.");
const num1 = 10;
const num2 = 20;
console.log(`${num1} + ${num2} = ${num1+num2} 입니다.`);