강사님은 div 태그 사용을 스타일 적용 용도로만 사용할 것을 권장하였다.
<body>
<h1>HTML DIV Example</h1>
Lorem Ipsum <div>I am a div</div> dolor sit amet.
<p>The yellow background is added to demonstrate the footprint of the DIV element.</p>
</body>
<html>
<body>
<h1>The span element</h1>
<p>My mother has <span style="color:blue;font-weight:bold">blue</span> eyes and my father has <span style="color:darkolivegreen;font-weight:bold">dark green</span> eyes.</p>
</body>
</html>
head
태그와 혼동 주의, 실제 웹에서 보이는 부분여기서 푸터는 웹 최하단에 해당 웹사이트를 작성한 작성자, 저작권 정보 등의 정보가 적혀있는 태그를 뜻함
<body>
<article>
<header>
<h1>A heading here</h1>
<p>Posted by John Doe</p>
<p>Some additional information here</p>
</header>
<p>Lorem Ipsum dolor set amet....</p>
</article>
</body>
<body>
<h1>The nav element</h1>
<p>The nav element defines a set of navigation links:</p>
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/python/">Python</a>
</nav>
</body>
<body>
<h1>The main element</h1>
<main>
<h1>Most Popular Browsers</h1>
<p>Chrome, Firefox, and Edge are the most used browsers today.</p>
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p>
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article>
</main>
</body>
<body>
<h1>The article element</h1>
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p>
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article>
</body>
제목 요소를 자식으로 포함하여야 한다!
이쯤되면 article과 section을 언제 써야할지 헷갈리는데 일단 독립적으로 사용한다면 article을 사용하고 웹의 앞뒤 문맥이 연결성이 필요하거나, 더 적합한 의미의 요소가 없을 때 사용하라고 한다.
단순 스타일링은 div 요소를 쓰자.
<body>
<h1>The section element</h1>
<section>
<h2>WWF History</h2>
<p>The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the conservation, research and restoration of the environment, formerly named the World Wildlife Fund. WWF was founded in 1961.</p>
</section>
<section>
<h2>WWF's Symbol</h2>
<p>The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the London Zoo in the same year of the establishment of WWF.</p>
</section>
</body>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
<p><b>Tip:</b> Use h1 to h6 elements only for headings. Do not use them just to make text bold or big. Use other tags for that.</p>
</body>
<body>
<h1>The a element</h1>
<a href="https://www.w3schools.com">Visit W3Schools.com!</a>
</body>
href 속성과 id를 사용하여 페이지 내에서 이동하는 해시 링크를 만들 수 있다.
<body>
<h1>The p element</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
<body>
<h1>The strong element</h1>
<p>This text is normal.</p>
<p><strong>This text is important!</strong></p>
</body>
<body>
<h1>The br element</h1>
<p>To force<br> line breaks<br> in a text,<br> use the br<br> element.</p>
</body>
<p>
태그 내의 사용은 하지 않는다!<body>
<h1>The Main Languages of the Web</h1>
<p>HTML is the standard markup language for creating Web pages. HTML describes the structure of a Web page, and consists of a series of elements. HTML elements tell the browser how to display the content.</p>
<hr>
<p>CSS is a language that describes how HTML elements are to be displayed on screen, paper, or in other media. CSS saves a lot of work, because it can control the layout of multiple web pages all at once.</p>
</body>
<body>
<h1>The code element</h1>
<p>The HTML <code>button</code> tag defines a clickable button.</p>
<p>The CSS <code>background-color</code> property defines the background color of an element.</p>
</body>
<body>
<h1>The pre element</h1>
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</pre>
</body>
<ol type="i">
<li>Introduction</li>
<li>List of Grievances</li>
<li>Conclusion</li>
</ol>
여기서 type은 항목을 셀 때 사용할 카운터 유형이다.
<body>
<h1>The ol element</h1>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ol start="50">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
start는 아라비아 숫자로 세고 시작할 숫자를 지정한다.
<body>
<h1>The ul element</h1>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
ol
, ul
의 자식요소로만 사용할 수 있다!<body>
<h1>The ol and ul elements</h1>
<p>The ol element defines an ordered list:</p>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<p>The ul element defines an unordered list:</p>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
<body>
<h1>The img element</h1>
<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">
</body>
여기서 src는 이미지의 경로이고, alt는 이미지에 대한 설명 부분이다. alt는 빈값이더라도 필수로 들어가야 한다.
추가적으로 이미지는 문서에 추가하면 하단에 빈 공간이 생기는데 이를 css로 없애줄 수 있다.
img{
vertical-align:top;
}
라는 초기값을 넣어두자.
백엔드 개발자도 프론트엔드를 알아야 하기 때문에 맛만 보는 느낌으로 배우고 있다. 옛날 얘기, 비하인드 스토리 이런거는 재밌는데 실습을 안하고 이론만 계속 보니까 재미없다. 다음주부터는 실습도 한다고 하니까 기대해 봐야겠다.