Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTML, Text, Images, Tables Nikolay Kostov Telerik Corporation www.telerik.com.

Similar presentations


Presentation on theme: "HTML, Text, Images, Tables Nikolay Kostov Telerik Corporation www.telerik.com."— Presentation transcript:

1 HTML, Text, Images, Tables Nikolay Kostov Telerik Corporation www.telerik.com

2 1. Introduction to HTML  How the Web Works?  What is a Web Page?  My First HTML Page  Basic Tags: Hyperlinks, Images, Formatting  Headings and Paragraphs 2. HTML in Details  The Declaration  The Section: Title, Meta, Script, Style 2

3 2. HTML in Details  The Section  Text Styling and Formatting Tags  Hyperlinks:, Hyperlinks and Sections  Images:  Images:  Lists:, and  Lists:, and 3. The and elements 4. HTML Tables 5. HTML Forms 3

4  WWW use classical client / server architecture  HTTP is text-based request-response protocol 4 Page request Client running a Web Browser Server running Web Server Software (IIS, Apache, etc.) Server response HTTP HTTP

5  Web pages are text files containing HTML  HTML – H yper T ext M arkup L anguage  A notation for describing  document structure (semantic markup)  formatting (presentation markup)  Looks (looked?) like:  A Microsoft Word document  The markup tags provide information about the page content structure 5

6  An HTML file must have an.htm or.html file extension  HTML files can be created with text editors:  NotePad, NotePad ++, PSPad  Or HTML editors (WYSIWYG Editors):  Microsoft FrontPage  Macromedia Dreamweaver  Netscape Composer  Microsoft Word  Visual Studio 6

7 Text, Images, Tables, Forms

8  HTML is comprised of “elements” and “tags”  Begins with and ends with  Begins with and ends with  Elements (tags) are nested one inside another:  Tags have attributes:  HTML describes structure using two main sections: and  HTML describes structure using two main sections: and 8

9  The HTML source code should be formatted to increase readability and facilitate debugging.  Every block element should start on a new line.  Every nested (block) element should be indented.  Browsers ignore multiple whitespaces in the page source, so formatting is harmless.  For performance reasons, formatting can be sacrificed 9

10 10 My First HTML Page My First HTML Page This is some text... This is some text... test.html

11 My First HTML Page My First HTML Page This is some text... This is some text... 11 Opening tag Closing tag An HTML element consists of an opening tag, a closing tag and the content inside.

12 My First HTML Page My First HTML Page This is some text... This is some text... 12 HTML header

13 My First HTML Page My First HTML Page This is some text... This is some text... 13 HTML body

14  Hyperlink Tags  Image Tags  Text formatting tags 14 Link to Telerik Web site title="Telerik">Link to Telerik Web site This text is emphasized. This text is emphasized. new line new line This one is more emphasized. This one is more emphasized.

15 15 Simple Tags Demo Simple Tags Demo This is a link. "Telerik site">This is a link. Bold and italic text. Bold and italic text. some-tags.html

16 16 Simple Tags Demo Simple Tags Demo This is a link. "Telerik site">This is a link. Bold and italic text. Bold and italic text. some-tags.html

17  Tags can have attributes  Attributes specify properties and behavior  Example:  Few attributes can apply to every element:  id, style, class, title  The id is unique in the document  Content of title attribute is displayed as hint when the element is hovered with the mouse  Some elements have obligatory attributes 17 Attribute alt with value " logo "

18  Heading Tags (h1 – h6)  Paragraph Tags  Sections: div and span 18 This is my first paragraph This is my first paragraph This is my second paragraph This is my second paragraph Heading 1 Heading 1 Sub heading 2 Sub heading 2 Sub heading 3 Sub heading 3 This is a div This is a div

19 19 Headings and paragraphs Headings and paragraphs Heading 1 Heading 1 Sub heading 2 Sub heading 2 Sub heading 3 Sub heading 3 This is my first paragraph This is my first paragraph This is my second paragraph This is my second paragraph This is a div This is a div headings.html

20 Headings and paragraphs Headings and paragraphs Heading 1 Heading 1 Sub heading 2 Sub heading 2 Sub heading 3 Sub heading 3 This is my first paragraph This is my first paragraph This is my second paragraph This is my second paragraph This is a div This is a div 20 headings.html

21 HTML Document Structure in Depth

22  It is important to have the correct vision and attitude towards HTML  HTML is only about structure, not appearance  Browsers tolerate invalid HTML code and parse errors – you should not. 22

23  HTML documents must start with a document type definition (DTD)  It tells web browsers what type is the served code  Possible versions: HTML 4.01, XHTML 1.0 (Transitional or Strict), XHTML 1.1, HTML 5  Example:  See http://w3.org/QA/2002/04/valid-dtd-list.html for a list of possible doctypes http://w3.org/QA/2002/04/valid-dtd-list.html 23

24  XHTML is more strict than HTML  Tags and attribute names must be in lowercase  All tags must be closed (, ) while HTML allows and and implies missing closing tags ( par1 par2 )  XHTML allows only one root element (HTML allows more than one) 24

25  Many element attributes are deprecated in XHTML, most are moved to CSS  Attribute minimization is forbidden, e.g.  Note: Web browsers load XHTML faster than HTML and valid code faster than invalid! 25

26  Contains information that doesn’t show directly on the viewable page  Starts after the declaration  Begins with and ends with  Begins with and ends with  Contains mandatory single tag  Can contain some other tags, e.g.   26

27  Title should be placed between and tags  Used to specify a title in the window title bar  Search engines and people rely on titles 27 Telerik Academy – Winter Season 2009/2010 Telerik Academy – Winter Season 2009/2010

28  Meta tags additionally describe the content contained within the page 28

29  The element is used to embed scripts into an HTML document  Script are executed in the client's Web browser  Scripts can live in the and in the sections  Supported client-side scripting languages:  JavaScript (it is not Java!)  VBScript  JScript 29

30 30 JavaScript Example JavaScript Example function sayHello() { function sayHello() { document.write(" Hello World! "); document.write(" Hello World! "); }

31  The element embeds formatting information (CSS styles) into an HTML page 31 p { font-size: 12pt; line-height: 12pt; } p { font-size: 12pt; line-height: 12pt; } p:first-letter { font-size: 200%; } p:first-letter { font-size: 200%; } span { text-transform: uppercase; } span { text-transform: uppercase; } Styles demo. Styles demo. Test uppercase. Test uppercase. style-example.html

32  Comments can exist anywhere between the tags  Comments start with  Comments start with 32 Telerik Telerik...

33  The section describes the viewable portion of the page  Starts after the section  Begins with and ends with  Begins with and ends with 33 Test page Test page

34  Text formatting tags modify the text between the opening tag and the closing tag  Ex. Hello makes “Hello” bold bold italicized underlined Sample superscript Sample subscript strong emphasized Preformatted text Quoted text block Deleted text – strike through 34

35 35 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Page Title Page Title Notice Notice This is a sample Web page. This is a sample Web page. Next paragraph: Next paragraph: preformatted. preformatted. More Info More Info Specifically, we’re using XHMTL 1.0 transitional. Specifically, we’re using XHMTL 1.0 transitional. Next line. Next line. text-formatting.html

36 36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Page Title Page Title Notice Notice This is a sample Web page. This is a sample Web page. Next paragraph: Next paragraph: preformatted. preformatted. More Info More Info Specifically, we’re using XHMTL 1.0 transitional. Specifically, we’re using XHMTL 1.0 transitional. Next line. Next line. text-formatting.html

37  Link to a document called form.html on the same server in the same directory:  Link to a document called parent.html on the same server in the parent directory:  Link to a document called cat.html on the same server in the subdirectory stuff : 37 Fill Our Form Fill Our Form Parent Parent Catalog Catalog

38  Link to an external Web site:  Always use a full URL, including " http:// ", not just " www.somesite.com "  Using the target="_blank" attribute opens the link in a new window  Link to an e-mail address: 38 BASD BASD Please report bugs here (by e-mail only) Please report bugs here (by e-mail only)

39  Link to a document called apply-now.html  On the same server, in same directory  Using an image as a link button:  Link to a document called index.html  On the same server, in the subdirectory english of the parent directory: 39 src="apply-now-button.jpg" /> Switch to English version Switch to English version

40  Link to another location in the same document:  Link to a specific location in another document: 40 Go to Introduction Go to Introduction... Introduction Introduction Go to Section 3.1.1 Go to Section 3.1.1... 3.1.1. Technical Background 3.1.1. Technical Background


41 41 Fill Our Form Fill Our Form Parent Parent Catalog Catalog BASD BASD Please report bugs here (by e-mail only) Please report bugs here (by e-mail only) Switch to English version Switch to English version hyperlinks.html

42 Fill Our Form Fill Our Form Parent Parent Catalog Catalog BASD BASD Please report bugs here (by e-mail only) Please report bugs here (by e-mail only) Switch to English version Switch to English version hyperlinks.html 42

43 43 Table of Contents Table of Contents Introduction Introduction Some background Some background Project History Project History...the rest of the table of contents... Introduction Introduction... Section 1 follows here... Some background Some background... Section 2 follows here... Project History Project History... Section 2.1 follows here... links-to-same-document.html

44 44 Table of Contents Table of Contents Introduction Introduction Some background Some background Project History Project History...the rest of the table of contents... Introduction Introduction... Section 1 follows here... Some background Some background... Section 2 follows here... Project History Project History... Section 2.1 follows here... links-to-same-document.html

45  Inserting an image with tag:  Image attributes:  Example: src Location of image file (relative or absolute) alt Substitute text for display (e.g. in text mode) height Number of pixels of the height width Number of pixels of the width border Size of border, 0 for no border 45

46  : Draws a horizontal rule (line):  : Deprecated! 46 Hello World! Hello World! Font3 Font3 Font+4 Font+4

47 47 Miscellaneous Tags Example Miscellaneous Tags Example Hello World! Hello World! Font3 Font3 Font+4 Font+4 misc.html

48 a.Apple b.Orange c.Grapefruit  Create an Ordered List using :  Attribute values for type are 1, A, a, I, or i 48 1.Apple 2.Orange 3.Grapefruit A.Apple B.Orange C.Grapefruit I.Apple II.Orange III.Grapefruit i.Apple ii.Orange iii.Grapefruit Apple Apple Orange Orange Grapefruit Grapefruit

49  Create an Unordered List using :  Attribute values for type are:  disc, circle or square 49 Apple Orange Pear o Apple o Orange o Pear  Apple  Orange  Pear Apple Apple Orange Orange Grapefruit Grapefruit

50  Create definition lists using  Create definition lists using  Pairs of text and associated definition; text is in tag, definition in tag  Renders without bullets  Definition is indented 50

HTML
A markup language … A markup language …
CSS
Language used to … Language used to …

51 51 Apple Apple Orange Orange Grapefruit Grapefruit Apple Apple Orange Orange Grapefruit Grapefruit

HTML HTML A markup lang… A markup lang…
lists.html

52 ££ British Pound €€Euro "" Quotation Mark ¥¥ Japanese Yen —— Em Dash Non-breaking Space &&Ampersand >> Greater Than << Less Than ™™ Trademark Sign ®® Registered Trademark Sign ©© Copyright Sign Symbol HTML Entity Symbol Name 52

53 53

[>> Welcome <<] <<] ►I have following cards: ►I have following cards: A♣, K♦ and 9♥. A♣, K♦ and 9♥. ►I prefer hard rock ♫ ►I prefer hard rock ♫ music ♫ music ♫ © 2006 by Svetlin Nakov & his team © 2006 by Svetlin Nakov & his team Telerik Academy™ Telerik Academy™ special-chars.html

54 54

[>> Welcome <<] <<] ►I have following cards: ►I have following cards: A♣, K♦ and 9♥. A♣, K♦ and 9♥. ►I prefer hard rock ♫ ►I prefer hard rock ♫ music ♫ music ♫ © 2006 by Svetlin Nakov & his team © 2006 by Svetlin Nakov & his team Telerik Academy™ Telerik Academy™ special-chars.html

55

56  Block elements add a line break before and after them  is a block element  Other block elements are,, headings, lists, and etc.  Inline elements don’t break the text before and after them  is an inline element  Most HTML elements are inline, e.g.  Most HTML elements are inline, e.g. 56

57  creates logical divisions within a page  Block style element  Used with CSS  Example: 57 DIV example DIV example This one is only a test. This one is only a test. div-and-span.html

58  Inline style element  Useful for modifying a specific portion of text  Don't create a separate area (paragraph) in the document  Very useful with CSS 58 This one is only a test. This one is only a test. This one is another TEST. This one is another TEST. span.html

59

60  Tables represent tabular data  A table consists of one or several rows  Each row has one or more columns  Tables comprised of several core tags: : begin / end the table : create a table row : create tabular data (cell)  Tables should not be used for layout. Use CSS floats and positioning styles instead 60

61  Start and end of a table  Start and end of a row  Start and end of a cell in a row 61......

62 62 Lecture 1 Lecture 1 Lecture 2 Lecture 2 Lecture 2 - Demos Lecture 2 - Demos

63 Lecture 1 Lecture 1 Lecture 2 Lecture 2 Lecture 2 - Demos Lecture 2 - Demos 63

64  Table rows split into three semantic sections: header, body and footer  denotes table header and contains elements, instead of elements  denotes collection of table rows that contain the very data  denotes table footer but comes BEFORE the tag  and define columns (most often used to set column widths) 64

65 65

Column 1 Column 2 Column 1 Column 2 Footer 1 Footer 2 Footer 1 Footer 2 Cell 1.1 Cell 1.2 Cell 1.1 Cell 1.2 Cell 2.1 Cell 2.2 Cell 2.1 Cell 2.2
header footer Last comes the body (data) th columns

66

Column 1 Column 2 Column 1 Column 2 Footer 1 Footer 2 Footer 1 Footer 2 Cell 1.1 Cell 1.2 Cell 1.1 Cell 1.2 Cell 2.1 Cell 2.2 Cell 2.1 Cell 2.2
66 table-full.html Although the footer is before the data in the code, it is displayed last By default, header text is bold and centered.

67  Table data “cells” ( ) can contain nested tables (tables within tables): 67

Contact: Contact: First Name First Name Last Name Last Name
nested-tables.html

68  cellpadding  Defines the empty space around the cell content  cellspacing  Defines the empty space between cells  Tables have two important attributes: 68 cellcell cellcell cell cell cell cell

69 69 Table Cells Table Cells First First Second Second First Second First Second table-cells.html

70 70 Table Cells Table Cells First First Second Second First Second First Second table-cells.html

71  rowspan  Defines how many rows the cell occupies  colspan  Defines how many columns the cell occupies  Table cells have two important attributes: 71 cell[1,1]cell[1,2] cell[2,1] colspan="1"colspan="1" colspan="2" cell[1,1]cell[1,2] cell[2,1] rowspan="2"rowspan="1" rowspan="1"

72 72 Cell[1,1] Cell[1,1] Cell[2,1] Cell[2,1] Cell[1,2] Cell[1,2] Cell[2,2] Cell[2,2] Cell[3,2] Cell[3,2] Cell[1,3] Cell[1,3] Cell[2,3] Cell[2,3] table-colspan-rowspan.html

73 Cell[1,1] Cell[1,1] Cell[2,1] Cell[2,1] Cell[1,2] Cell[1,2] Cell[2,2] Cell[2,2] Cell[3,2] Cell[3,2] Cell[1,3] Cell[1,3] Cell[2,3] Cell[2,3] 73 table-colspan-rowspan.html Cell[2,3]Cell[1,3] Cell[3,2] Cell[2,2] Cell[1,2] Cell[2,1]Cell[1,1]

74 Entering User Data from a Web Page

75  Forms are the primary method for gathering data from site visitors  Create a form block with  Example: 75

...... The "action" attribute tells where the form data should be sent The “method" attribute tells how the form data should be sent – via GET or POST request

76  Single-line text input fields:  Multi-line textarea fields:  Hidden fields contain data not shown to the user:  Often used by JavaScript code 76 This is a multi-line text field This is a multi-line text field

77  Fieldsets are used to enclose a group of related form fields:  The is the fieldset's title. 77 Client Details Client Details Order Details Order Details

78  Checkboxes:  Radio buttons:  Radio buttons can be grouped, allowing only one to be selected from a group: 78

79  Dropdown menus:  Submit button: 79

80  Reset button – brings the form to its initial state  Image button – acts like submit but image is displayed and click coordinates are sent  Ordinary button – used for Javascript, no default action 80

81  Password input – a text field which masks the entered text with * signs  Multiple select field – displays the list of items in multiple lines, instead of one 81

82  File input – a field used for uploading files  When used, it requires the form element to have a specific attribute: 82......

83  Form labels are used to associate an explanatory text to a form field using the field's ID.  Clicking on a label focuses its associated field (checkboxes are toggled, radio buttons are checked)  Labels are both a usability and accessibility feature and are required in order to pass accessibility validation. 83 First Name First Name

84 84 Academic information Academic information Degree Degree Bachelor of Art Bachelor of Art Bachelor of Science Bachelor of Science Master of Master of Business Administration Business Administration Student ID Student ID Personal Details Personal Details First Name First Name Last Name Last Name form.html

85 85 Gender: Gender: Male Male Female Female Email Email