280 likes | 585 Views
HTML 5. 2017, Fall Pusan National University Ki-Joune Li. Making HTML documents. Editing Tools Notepad++: https://notepad-plus-plus.org atom: https://atom.io Sublime Text: https://www.sublimetext.com Validator https://validator.w3.org/#validator-by-upload. First HTML5.
E N D
HTML 5 2017, Fall Pusan National University Ki-Joune Li
Making HTML documents • Editing Tools • Notepad++: https://notepad-plus-plus.org • atom: https://atom.io • Sublime Text: https://www.sublimetext.com • Validator • https://validator.w3.org/#validator-by-upload
First HTML5 First HTML5 Example https://www.w3schools.com/html/html_intro.asp • <!DOCTYPE html> declaration defines this document to be HTML5 • <html> element is the root element of an HTML page • <head> element contains meta information about the document • <title> element specifies a title for the document • <body> element contains the visible page content • <h1> element defines a large heading • <p> element defines a paragraph • <!-- xxxx --> comments
Basic Examples Attributes • https://www.w3schools.com/html/html_basic.asp • Headings • From <h1> … </h1> to <h6> … </h6> • HTML Links – point to a URL <a href="https://www.w3schools.com">This is a link</a> <a href=“mailto:lik@pnu.kr”> mail to prof. Li</a> • HTML Images – to include image <img src="w3schools.jpg" alt="W3Schools.com" width="104"height="142" >
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“ • https://www.w3schools.com/html/html_attributes.asp • Lang Attribute - <html lang=“en-US”> • Title Attribute • href Attribute - <a href="https://www.w3schools.com">This is a link</a> • Size Attribute - <img src="w3schools.jpg" width="104" height="142“> • Alt Attribute • Void Elements – element with only attributes without markup text <img src="w3schools.jpg" width="104" height="142“/>
HTML Attributes • Images as a link (hypertext) https://cdn.pixabay.com/photo/2014/11/05/20/43/brown-518324_960_720.jpg https://www.w3schools.com/html/tryit.asp?filename=tryhtml_images_w3schools
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. • <head> element is placed between the <html> tag and the <body> tag • In head element, • <title>, <style>, <meta>, <link>, <script>, and <base> • <title> • defines a title in the browser tab • provides a title for the page when it is added to favorites • displays a title for the page in search engine results • <style> - used to define style information for a single HTML page: • <link> - used to link to external style sheets
HTML head element • <meta>- used to specify which character set is used, page description, keywords, author, and other metadata. • Character set: <meta charset="UTF-8"> • web page description: <meta name="description" content="Free Web tutorials"> • keywords for search engines: <meta name="keywords" content="HTML, CSS, XML, JavaScript"> • the author of a page: <meta name="author" content="John Doe"> • Refresh document every 30 seconds<meta http-equiv="refresh" content="30">
Special Characters • Reserved Characters in HTML • Example: instead of the less than (<) sign, we must write < or < • Non-breaking space ( ): enforces real spaces • Special Characters
Other Symbols Currency: https://www.w3schools.com/charsets/ref_utf_currency.asp Arrows: https://www.w3schools.com/charsets/ref_utf_arrows.asp All Symbols: https://www.w3schools.com/charsets/ref_utf_symbols.asp
Formatting Elements • Formatting elements • <b> - Bold text • <strong> - Important text • <i> - Italic text • <em> - Emphasized text • <mark> • <small> - Small text • <del> - Deleted text: • <ins> - Inserted text • <sub> - Subscript text • <sup> - Superscript text • <abbr> - abbreviations
Lists • Ordered vs. Unordered Lists https://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_intro • With CSS list-style-type property https://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_unordered_circle • With type attribute for ordered list
Lists - Others • Description List • The <dl> tag defines the description list, • the <dt> tag defines the term (name), and • the <dd> tag describes each termhttps://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_description • Nested List - https://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_nested
Tables • HTML provides <table> tag. • table row is defined with the <tr> tag. • A table header is defined with the <th> tag. By default, table headings are bold and centered. • A table data/cell is defined with the <td> tag. https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table • Border • Border line - https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_borderor https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_collapse • Alignments • Spanning many rows or columns • Captions
Forms • The HTML <form> element defines a form that is used to collect user input • Example - https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit • <input> element • with type attribute, for example • with name attributehttps://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit_id
Form – More Elements • <select> element – drop-down element • selected attribute • <textarea> element – multi-line input field • <datalist> element – specifies predefined options for input element
Form – Action Attribute • Action Attribute • action attribute defines the action to be performed when the form is submitted. • Normally the form data is sent to the web server when user clicks on submit button • Server is specified by action attribute e.g. /action_page.php (server side script) that handles the form data • GET/POST HTTP method • GET (default) – submitted data is in the page address field (visible) • POST – submitted data is in a separate field (not in the page address field, invisible)
Input Types Input Restrictions • HTML allows several input types • text (default) • radio • checkbox • reset • alert • More input types • color • date, month • email • number • range • search • tel • time • url • week
Links • Allows to jump to another document or a specific part • HTML links – (absolute URL)<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a> • Local Links – <a href="html_images.asp">HTML Images</a> (relative URL) • Target Attributes • _blank - Opens the linked document in a new window or tab • _self - Opens the linked document in the same window/tab as it was clicked (this is default) • _parent - Opens the linked document in the parent frame • _top - Opens the linked document in the full body of the window • framename - Opens the linked document in a named frame • Bookmark - HTML bookmarks are used to allow readers to jump to specific parts of a Web page. • <h2 id="C4">Chapter 4</h2> <a href="#C4">Jump to Chapter 4</a> • example
Blocks • block level elements vs. inline elements • Block Level Elements: <div>, <h1> - <h6>, <p>, and <form> • Starts on a new line • Takes up the full width available • Inline Elements: <span>, <a>, <img> • Does not start on a new line and Takes as much width as necessary • div with class – define equal styles for elements with the same class name • examples
Responsive Web Design tablet smart phones desktop • Responsive Web Design makes your web page look good on all devices (desktops, tablets, and phones). • Responsive Web Design is about using CSS and HTML to resize, hide, shrink, enlarge, or move the content to make it look good on any screen: • Using W3.CSS - example
HTML Layout • <header> - Defines a header for a document or a section • <nav> - Defines a container for navigation links • <section> - Defines a section in a document • <article> - Defines an independent self-contained article • <aside> - Defines content aside from the content • <footer> - Defines a footer for a document or a section • <details> - Defines additional details • <summary> - Defines a heading for the <details> element • Websites often display content in multiple columns (like a magazine) • HTML5 offers new semantic elements that define the different parts of a web page • A Common Layout • Four Ways to create HTML Layout • HTML tables – DO NOT USE • CSS float property • CSS framework • CSS flexbox