지구 위에서 중심잡기
ID:  PW: 
 new open

[웹디자인] Web Design


 doubleo7 ( 2018-07-03 07:39:57 , Hit : 19
 HTML Basic

What is HTML?
HTML is the standard markup language for creating Web pages.
•HTML stands for Hyper Text Markup Language
•HTML describes the structure of Web pages using markup
•HTML elements are the building blocks of HTML pages
•HTML elements are represented by tags
•HTML tags label pieces of content such as "heading", "paragraph", "table", and so on
•Browsers do not display the HTML tags, but use them to render the content of the page


A Simple HTML Document
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
•The <!DOCTYPE html> declaration defines this document to be HTML5
•The <html> element is the root element of an HTML page
•The <head> element contains meta information about the document
•The <title> element specifies a title for the document
•The <body> element contains the visible page content
•The <h1> element defines a large heading
•The <p> element defines a paragraph


The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is:


HTML Versions
Since the early days of the web, there have been many versions of HTML:
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML5 2014


Write HTML Using Notepad or TextEdit
Web pages can be created and modified by using professional HTML editors.
However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac).
We believe using a simple text editor is a good way to learn HTML.
Follow the four steps below to create your first web page with Notepad or TextEdit.


HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>


HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading:
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>


HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>


HTML Tags
HTML tags are element names surrounded by angle brackets:
<tagname>content goes here...</tagname>
•HTML tags normally come in pairs like <p> and </p>
•The first tag in a pair is the  start tag, the second tag is the  end tag
•The end tag is written like the start tag, but with a forward slash inserted before the tag name
Tip: The start tag is also called the opening tag, and the end tag the closing tag.


HTML Links
HTML links are defined with the <a> tag:
<a href="https://www.w3schools.com">This is a link</a>
The link's destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
You will learn more about attributes in a later chapter.


HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">


HTML Buttons
HTML buttons are defined with the <button> tag:
<button>Click me</button>


HTML Lists
HTML lists are defined with the <ul> (unordered/bullet list) or the <ol> (ordered/numbered list) tag, followed by <li> tags (list items):
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>


HTML Elements
An HTML element usually consists of a start tag and end tag, with the content inserted in between:
<tagname>Content goes here...</tagname>
The HTML element is everything from the start tag to the end tag:
<p>My first paragraph.</p>

Start tag          Element content          End tag
<h1>              My First Heading         </h1>
<p>                My first paragraph.       </p>
<br>    
HTML elements with no content are called empty elements. Empty elements do not have an end tag, such as the <br> element (which indicates a line break).


Nested HTML Elements
HTML elements can be nested (elements can contain elements).
All HTML documents consist of nested HTML elements.
This example contains four HTML elements:
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>


Example Explained
The <html> element defines the whole document.
It has a start tag <html> and an end tag </html>.
The element content is another HTML element (the <body> element).
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

The <body> element defines the document body.
It has a start tag <body> and an end tag </body>.
The element content is two other HTML elements (<h1> and  <p>).
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>

The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>.
The element content is: My First Heading.
<h1>My First Heading</h1>

The <p> element defines a paragraph.
It has a start tag <p> and an end tag </p>.
The element content is: My first paragraph.
<p>My first paragraph.</p>

Do Not Forget the End Tag
Some HTML elements will display correctly, even if you forget the end tag:
<html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>


Empty HTML Elements
HTML elements with no content are called empty elements.
<br> is an empty element without a closing tag (the <br> tag defines a line break).
Empty elements can be "closed" in the opening tag like this: <br />.
HTML5 does not require empty elements to be closed. But if you want stricter validation, or if you need to make your document readable by XML parsers, you must close all HTML elements properly.


Use Lowercase Tags
HTML tags are not case sensitive: <P> means the same as <p>.
The HTML5 standard does not require lowercase tags, but W3C recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.
At W3Schools we always use lowercase tags.


Attributes provide additional information about HTML elements.
HTML Attributes
•All HTML elements can have attributes
•Attributes provide additional information about an element
•Attributes are always specified in the start tag
•Attributes usually come in name/value pairs like: name="value"


The href Attribute
HTML links are defined with the <a> tag. The link address is specified in the href attribute:
<a href="https://www.w3schools.com">This is a link</a>


The src Attribute
HTML images are defined with the <img> tag.
The filename of the image source is specified in the src attribute:
<img src="img_girl.jpg">


The width and height Attributes
Images in HTML have a set of size attributes, which specifies the width and height of the image:
<img src="img_girl.jpg" width="500" height="600">
The image size is specified in pixels: width="500" means 500 pixels wide.
You will learn more about images in our HTML Images chapter.


The alt Attribute
The alt attribute specifies an alternative text to be used, when an image cannot be displayed.
The value of the attribute can be read by screen readers. This way, someone "listening" to the webpage, e.g. a blind person, can "hear" the element.
<img src="img_girl.jpg" alt="Girl with a jacket">
The alt attribute is also useful if the image does not exist:
See what happens if we try to display an image that does not exist:
<img src="img_typo.jpg" alt="Girl with a jacket">


The style Attribute
The style attribute is used to specify the styling of an element, like color, font, size etc.
<p style="color:red">I am a paragraph</p>
You will learn more about styling later in this tutorial, and in our CSS Tutorial.


The lang Attribute
The language of the document can be declared in the <html> tag.
The language is declared with the lang attribute.
Declaring a language is important for accessibility applications (screen readers) and search engines:
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The first two letters specify the language (en). If there is a dialect, use two more letters (US).



The title Attribute
Here, a title attribute is added to the <p> element. The value of the title attribute will be displayed as a tooltip when you mouse over the paragraph:
<p title="I'm a tooltip">
This is a paragraph.
</p>


We Suggest: Use Lowercase Attributes
The HTML5 standard does not require lowercase attribute names.
The title attribute can be written with uppercase or lowercase like title or TITLE.
W3C recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.
At W3Schools we always use lowercase attribute names.


We Suggest: Quote Attribute Values
The HTML5 standard does not require quotes around attribute values.
The href attribute, demonstrated above, can be written without quotes:
Bad  <a href=https://www.w3schools.com>
Good<a href="https://www.w3schools.com">
W3C recommends quotes in HTML, and demands quotes for stricter document types like XHTML.
Sometimes it is necessary to use quotes. This example will not display the title attribute correctly, because it contains a space:
<p title=About W3Schools>


Single or Double Quotes?
Double quotes around attribute values are the most common in HTML, but single quotes can also be used.
In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:
<p title='John "ShotGun" Nelson'>

Or vice versa:
<p title="John 'ShotGun' Nelson">


Chapter Summary
•All HTML elements can have attributes
•The title attribute provides additional "tool-tip" information
•The href attribute provides address information for links
•The width and height attributes provide size information for images
•The alt attribute provides text for screen readers
•At W3Schools we always use lowercase attribute names
•At W3Schools we always quote attribute values with double quotes



HTML Attributes

Below is an alphabetical list of some attributes often used in HTML:


Attribute      Description
alt              Specifies an alternative text for an image, when the image cannot be displayed
disabled      Specifies that an input element should be disabled
href             Specifies the URL (web address) for a link
id                Specifies a unique id for an element
src              Specifies the URL (web address) for an image
style            Specifies an inline CSS style for an element
title              Specifies extra information about an element (displayed as a tool tip)
A complete list of all attributes for each HTML element, is listed in our: HTML Attribute Reference.


HTML Headings
Headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading.
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Try it Yourself »
Note: Browsers automatically add some white space (a margin) before and after a heading.


Headings Are Important
Search engines use the headings to index the structure and content of your web pages.
Users skim your pages by its headings. It is important to use headings to show the document structure.
<h1> headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on.
Note: Use HTML headings for headings only. Don't use headings to make text BIG or bold.


Bigger Headings
Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute, using the CSS font-size property:
<h1 style="font-size:60px;">Heading 1</h1>


HTML Horizontal Rules
The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.
The <hr> element is used to separate content (or define a change) in an HTML page:
<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>
  

The HTML <head> Element
The HTML <head> element has nothing to do with HTML headings.
The <head> element is a container for metadata. HTML metadata is data about the HTML document. Metadata is not displayed.
The <head> element is placed between the <html> tag and the <body> tag:
<!DOCTYPE html>
<html>
<head>
  <title>My First HTML</title>
  <meta charset="UTF-8">
</head>
<body>
.
.
.
Note: Metadata typically define the document title, character set, styles, links, scripts, and other meta information.


How to View HTML Source?
Have you ever seen a Web page and wondered "Hey! How did they do that?"

View HTML Source Code:
Right-click in an HTML page and select "View Page Source" (in Chrome) or "View Source" (in IE), or similar in other browsers. This will open a window containing the HTML source code of the page.

Inspect an HTML Element:
Right-click on an element (or a blank area), and choose "Inspect" or "Inspect Element" to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.


HTML Tag Reference
W3Schools' tag reference contains additional information about these tags and their attributes.
You will learn more about HTML tags and attributes in the next chapters of this tutorial.


Tag                  Description
<html>              Defines the root of an HTML document
<body>             Defines the document's body
<head>             A container for all the head elements (title, scripts, styles, meta information, and more)
<h1> to <h6>     Defines HTML headings
<hr>                 Defines a thematic change in the content





HTML Elements


Copyright 1999-2018 Zeroboard / skin by ROBIN

[화제] [史記] [三國志] [Wow] [Iliad] [Odyssey] [로마] [코드] [우리말] [역사] [漢文] [故事成語] [속담] [道德經] [음악] [게임] [걸작] [통찰] [의견] [가정교육] [지역] [English] [영어표현] [영어연설] [웹디자인] [영화] [007] [논어] [철학] [세계사] [심리학] [미학] [미술] [과학] [일본어] [자녀키우기] [그리스신화] [스포츠] [존 그리샴] [맛집&명소] [책] [기념일]     [Others] [soyeonrhie.com] [joonsoo.com] [날씨] [홈HOME]