[TIL]왕초보탈출기#12 querySelector 기초

BINGBING🐨·2021년 5월 4일
0

Javascript

목록 보기
13/21
post-thumbnail

querySelector

querySelector를 이용해 DOM의 요소를 선택해보는 실습

<!doctype html>
<html>
<head>
  <title>WEB1 - html</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.html">WEB</a></h1>
  <input type="button" value="night" onclick="
 document.querySelector('body').style.backgroundColor = 'black';
 document.querySelector('body').style.color = 'white';
  ">
  <input type="button" value="day" onclick="
  document.querySelector('body').style.backgroundColor = 'white';
  document.querySelector('body').style.color = 'black';
   ">
  <ol>
    <li><a href="1.html">HTML</a></li>
    <li><a href="1.html">CSS</a></li>
    <li><a href="1.html">JavaScript</a></li>
  </ol>
  <h2>HTML</h2>
  <p><a href="https://www.w3.org/TR/html5/" target="_blank" title="html5 speicification">Hypertext Markup Language (HTML)</a> is the standard markup language for <strong>creating <u>web</u> pages</strong> and web applications.Web browsers receive HTML documents from a web server or from local storage and render them into multimedia web pages. HTML describes the structure of a web page semantically and originally included cues for the appearance of the document.
  </p><p style="margin-top:45px;">HTML elements are the building blocks of HTML pages. With HTML constructs, images and other objects, such as interactive forms, may be embedded into the rendered page. It provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. HTML elements are delineated by tags, written using angle brackets.
  </p>
</body>
</html>

DOM의 'body'태그와 전체 글의 색깔을 선택하고 색깔을 바꾸는 연습을 했다.

profile
iOS Developer

0개의 댓글