(1) 'id' attribute 사용 <h2id="C4">Chapter 4</h2> (2) 북마크 링크 추가 <ahref="#C4">Jump to Chapter 4</a> (3) 다른 페이지에서 북마크된 링크 추가 <a href="html_demo.html#C4">Jump to Chapter 4</a>
2. HTML Images
(1) <img> 태그를 사용하며, 2개의 어트리뷰트가 필요. - src : 사진 경로 - alt : 이미지의 설명글 <imgsrc="url"alt="alternatetext">
(2) Width and Height - style 어트리뷰트를 사용해서 사진의 너비, 높이 책정 <imgsrc="img_girl.jpg"alt="Girl in a jacket"style="width:500px;height:600px;"> - width, height 어트리뷰트로도 가능 <imgsrc="img_girl.jpg"alt="Girl in a jacket"width="500"height="600">
style 어트리뷰트 사용을 추천한다. 시트가 바뀔때 이미지 사이즈가 바뀜을 방지함.
(3) 사진의 위치에 따라 src 어트리뷰트 활용 - 하위 폴더에 있을 경우 <imgsrc="/images/html5.gif"alt="HTML5 Icon"style="width:128px;height:128px;"> - 다른 서버나 웹페이지에 있을 경우 <imgsrc="https://www.w3schools.com/images/w3schools_green.jpg"alt="W3Schools.com">
(4) HTML 에서는 gif도 바로 업로드 가능하다. (5) 이미지를 링크로 활용할 수 있다. <ahref="default.asp"> <imgsrc="smiley.gif"alt="HTML tutorial"style="width:42px;height:42px;"> </a>
(6) Image Floating - CSS 'float' 특성으로 글의 왼쪽, 오른쪽에 이미지 삽입 가능 <p><imgsrc="smiley.gif"alt="Smiley face"style="float:right;width:42px;height:42px;"> The image will float to the right of the text.</p>
<p><imgsrc="smiley.gif"alt="Smiley face"style="float:left;width:42px;height:42px;"> The image will float to the left of the text.</p>
3. HTML Image Maps
<map> 태그는 이미지 맵으로, 클릭가능한 영역이다.
사진에서 컴퓨터, 핸드폰, 커피 클릭시 각각 다른 해당 페이지로 이동한다.
(1) <img> 태그에 'usemap' 어트리뷰트 추가하기. <imgsrc="workplace.jpg"alt="Workplace"usemap="#workmap"> 해시태그 #를 통해 이미지맵으로 이동 가능
(2) 이미지맵 생성 <map> 엘리먼트 추가하기. 이미지맵을 만들기 위한 엘리먼트로, name 어트리뷰트를 필요로 함. <mapname="workmap"> 이때 name은 앞선 <img> 에서의 usemap과 이름이 같아야 한다.
(3) Area, 클릭 가능한 영역을 설정한다. <area> 엘리먼트를 사용하며, 영역의 모양을 아래의 values 에서 선택해야 한다.
default- defines the entire region
rect- defines a rectangular region / shape="rect" / 꼭지점 끝 값 입력 (x,y) <areashape="rect"coords="34, 44, 270, 350"href="computer.htm"> - (x,y) = (34,44) ~ (270,350) 위치 지
circle- defines a circular region / shape="circle" / 원의 중심 위치 + 반지름(radius) 지정 <areashape="circle"coords="337, 300, 44"href="coffee.htm"> - (x,y,z) = (x좌표, y좌표, 반지름)
poly- defines a polygonal region / shape="poly" / 다각형, <areashape="poly"coords="140,121,181,116,204,160,204,222,191,270,140,329,85,355,58,352,37,322,40,259,103,161,128,147"href="croissant.htm"> - 점이 되는 여러 포인트들 지정. (140,121), (181,116), ...., (128, 147)
(4) Image Map and JavaScript 자바스크립트 기능으로도 구현 가능하다. <area> 엘리먼트에 click 이벤트 기능을 넣기. <mapname="workmap"> <areashape="circle"coords="337,300,44"href="coffee.htm"onclick="myFunction()"> </map>
(3) <style> + <body> element <style> body{ background-image:url('img_girl.jpg'); } </style>
(4) 이미지가 작으면 화면에 반복되는데, background-repeat: no-repeat 로 조절 가능 <style> body{ background-image:url('example_img_girl.jpg'); background-repeat:no-repeat; } </style>
CSS는 다중 웹 페이지의 레이아웃을 한번에 컨트롤 할 수 있다. CSS는 총 3 방법으로 HTML documents에 추가될 수 있다.
1. Inline - 'style' attribute inside HTML elements (엘리먼트 내에서 정의) 2. Internal - <style> element in the <head> section ( 헤더에서 정의, 일괄적 적용) 3. External - <link> element to link to an external CSS file (CSS 파일 불러오기)
Inline CSS <h1style="color:blue;">A Blue Heading</h1> <pstyle="color:red;">A red paragraph.</p>
Internal CSS
External CSS
CSS Colors, Fonts, and Sizes (properties)
color, font-family, font-size
CSS Border
CSS Padding
CSS Margin
Link to External CSS ( full URL, style_sheet ( html folder, same folder))
<p>This is a paragraph.</p> <!-- <p>Look at this cool image:</p> <img border="0" src="pic_trulli.jpg" alt="Trulli"> --> <p>This is a paragraph too.</p>
2. HTML Color - HTML은 140개의 standard 색상 이름을 갖는다.
(1) Background Color style="background-color" - 배경색
(2) Text Color
style="color:"
(3) Border Color
style="border" (글상자)
(4) Color Value
색상은 RGB값 ( Red, Green, Blue ), 또는 HEX, HSL value가 있고, 배경색으로는 RGBA, HSLA 가 있다.
<tagname style="property:value;"> - CSS property and value
Background Color - background-color <bodystyle="background-color:powderblue;"> <h1style="background-color:powderblue;">This is a heading</h1> <pstyle="background-color:tomato;">This is a paragraph.</p> </body>
Text Color - color <h1style="color:blue;">This is a heading</h1> <pstyle="color:red;">This is a paragraph.</p>
Font - fond-family <h1style="font-family:verdana;">This is a heading</h1> <pstyle="font-family:courier;">This is a paragraph.</p>
Text Size - font-size <h1style="font-size:300%;">This is a heading</h1> <pstyle="font-size:160%;">This is a paragraph.</p>
Text Alignment - text-align <h1style="text-align:center;">Centered Heading</h1> <pstyle="text-align:center;">Centered paragraph.</p>
웹페이지를 만드는 표준 마크업 언어로, 프론트엔드 개발의 가장 기본이 되는 언어 중 하나이다. 보통 HTML, CSS, javascript 세 언어와 함께 페이지를 코딩한다.
다른 언어들의 "Hello C world" 처럼, 가장 기본이 되는 문법은 아래와 같다. ------------------------------------------------------ <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body>
<h1>My First Heading</h1> <p>My first paragraph.</p>
The<!DOCTYPE html>declaration defines that this document is an HTML5 document : 이 문서는 HTML 문서다 라고 정의하는 선언문. 반드시 최상단에 위치해야 함.
The <html> element is the root element of an HTML page HTML 페이지의 지붕이라고 할 수 있는 엘리먼트.
The<head> element contains meta information about the HTML page HTML 페이지의 메타 정보를 포함하는 엘리먼트
The<title>element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab) HTML의 제목으로, 브라우저의 타이틀바 또는 페이지탭으로 표시됨.
The<body>element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc. HTML의 모든 시각적 요소들을 포함하는 부분으로, 웹페이지의 몸체 엘리먼트
The<h1>element defines a large heading 큰 헤드라인을 정의하는 엘리먼트 (My First Heading), h1~h6 갈수록 글자 작아진다.
The<p> element defines a paragraph 문단을 정의하는 엘리먼트 (My First paragraph)
- 코딩하면서 실습하는 방법
별도의 Running 프로그램 없이, 메모장(notepad)로 페이지를 확인할 수 있다. 색표시나 컬러감이 없어 밋밋하지만 그래도 별도 프로그램 없이 실행 가능한게 메리트. "CTRL + U" : 원하는 페이지의 HTML 페이지를 볼 수 있다.
2. HTML Basic Attributes ( 기본 어트리뷰트 )
<a> : HTML 링크를 선언할때 사용하는 태그. href 어트리뷰트로 링크를 구체화한다. 어트리뷰트는 HTML 요소 중 추가적인 정보를 포함함. <ahref="https://www.w3schools.com">This is a link</a>
<img> : 이미지를 정의하는 태그. - Source file (src), alternative text (alt), 'width', 'height' 어트리뷰트 포함. - src : Absolute URL 또는 Relative URL. <imgsrc="w3schools.jpg"alt="W3Schools.com"width="104"height="142"> - art : <img>의 태그.
<br> : line break, 엔터라 보면 된다 <p>This is a<br>paragraph with a line break.</p>