Understanding THML


Published on

This presentation was given to PGD students during my teaching tenure to UBIT

Published in: Education, Technology, Design
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Understanding THML

  1. 1. Basic HTML 1
  2. 2. <ul><li>What is HTML? </li></ul><ul><li>Tags </li></ul><ul><li>Attributes </li></ul><ul><li>Colors </li></ul><ul><li>text formatting </li></ul><ul><li>Links </li></ul><ul><li>Images </li></ul><ul><li>Lists </li></ul><ul><li>Tables </li></ul><ul><li>Frames </li></ul><ul><li>forms </li></ul>
  3. 3. <ul><li>HTML is a language that helps you to create websites </li></ul><ul><li>HTML stands for Hyper Text Markup Language </li></ul><ul><li>HTML is the predominant markup language for web pages </li></ul><ul><li>The language uses TAGS to describe web pages       Using HTML you can develop not very demanding web pages but this can be the beginning for achieving professional sites. There are many programs with which writing HTML is no longer necessary, these programs write it for you. But these programs do not offer complete control on designing your web pages and to build a web page requires at least some basic knowledge of HTML. </li></ul>
  4. 4. <ul><li><HTML> </li></ul><ul><li><HEAD> </li></ul><ul><li><TITLE>My web page</TITLE> </li></ul><ul><li></HEAD> </li></ul><ul><li><BODY> </li></ul><ul><li>Hello!<BR> </li></ul><ul><li>This is my first web page!<BR> </li></ul><ul><li></BODY> </li></ul><ul><li></HTML> </li></ul>
  5. 5. <ul><li>single tags (no closing tag) Examples: </li></ul><ul><ul><li><HR> </li></ul></ul><ul><ul><li><BR> </li></ul></ul>
  6. 6. <ul><li>They available only in the starting tag and can be defined as properties of tags. If a tag has no attributes, then the browser will take into account the default value </li></ul><ul><li><BODY BGCOLOR=&quot;#A8A8A8&quot; > - will give gray color to the background </li></ul><ul><li><FONT COLOR=&quot;#FF0000&quot; > - will color the text in red </li></ul><ul><li><FONT SIZE=&quot;6&quot; > - will scale the text with the largest size </li></ul>
  7. 7. Tag Name Attribute name Attribute value Details <A> Anchor Href URL Address to which we want to be connected Target _self _parent _top Display bgcolor color code color name Background color Leftmargin percentage from page width in pixels The distance between the left margin of window browser and the left edge of the page Topmargin percent from page height in pixels The distance between the top edge of window browser and top of page <CENTER> Display in the center of the page Frameborder 1 or 0 Frame has/not border Marginheight number of pixels Space above/under a frame Marginwidth number of pixels Space to the left/right of a frame
  8. 8. <ul><li>We can define the HTML colors by using hexadecimal notation (HEX) or the RGB notation that means a combination of Red, Green and Blue color </li></ul><ul><li><BODY BGCOLOR=&quot;#A8A8A8&quot; > </li></ul><ul><li><FONT COLOR=&quot;#000000&quot; >Your text here</FONT> </li></ul>
  9. 9. <ul><li>HTML uses tags for text formatting. </li></ul><ul><li>Examples of tags are: </li></ul><ul><ul><li><B> for bold text </li></ul></ul><ul><ul><li><I> for italic text </li></ul></ul><ul><ul><li>In order to choose the characteristics of a text we use <FONT> tag. This tag has several attributes like color, face, size. </li></ul></ul><ul><ul><li>Color attribute refers to color of the text that will be surrounded by tags <FONT> and </FONT> </li></ul></ul><ul><ul><li><FACE> attribute shows the font type and <SIZE> attribute shows the font size. Example: </li></ul></ul><ul><ul><li><FONT SIZE=&quot;4&quot; FACE=&quot;ARIAL&quot; COLOR=&quot;BLUE&quot;> Your text here </FONT> </li></ul></ul><ul><ul><li><FONT SIZE=&quot;3&quot; FACE=&quot;VERANDA&quot; COLOR=&quot;RED&quot;> Your text here </FONT> </li></ul></ul>
  10. 10. <ul><li>A HTML link is a sequence of commands that perform links to a new document, an image or another HTML page. The link is made between <A> tag. The name of these tag comes from anchor and the tag will be use with HREF attribute. The line of code to insert a link in a web page will have the following form: </li></ul><ul><li><A HREF=&quot;url&quot;>Link text</A> </li></ul><ul><li><HTML> <HEAD> <TITLE>Links</TITLE> </HEAD> <BODY> <CENTER><B>Links</B> <BR> <A HREF=&quot;images.html&quot;>Text link</A></CENTER> </BODY> </HTML> </li></ul>
  11. 11. <ul><li>Specifies where to open the linked document. It can be opened in a new browser window or in the same window. The example bellow will open the linked document in a new tab. Example: </li></ul><ul><li><A HREF=&quot;url&quot; target=&quot;_blank&quot;>Link text</A> </li></ul>
  12. 12. <ul><li>Internal - to specific places on the page. Example: href=&quot;#anchorname“ </li></ul><ul><li>Local - to the other pages but on the same field. Example: href=&quot;../images/html.png“ </li></ul><ul><li>Global - to other domains. Example: href=&quot;http://www.htmlbasic.com&quot; </li></ul>
  13. 13. <ul><li>If we want to get some opinions from users, then the page should have a link to an e-mail address. The general form of a link to an e-mail address is: </li></ul><ul><li><A HREF=&quot;mailto: e-mail address&quot;>Send me an e-mail</A> </li></ul>
  14. 14. <ul><li>Each link of a web page has three colors: a color for unvisited links </li></ul><ul><li>a color for visited links </li></ul><ul><li>a color for active links (when the mouse is over them) </li></ul><ul><li>For each color, of the links above, is one attribute of the tag <BODY> with which we can change the default color: <LINK> for unvisited links </li></ul><ul><li><VLINK> for visited links </li></ul><ul><li><ALINK> for active connections       If we want that links in our page to be red when they aren't visited, black when they are visited and yellow when the mouse passes over them, we must use the following line code: </li></ul><ul><li><BODY LINK=&quot;#FF0000&quot; VLINK=&quot;#000000&quot; ALINK=&quot;#FFFF00&quot;> </li></ul>
  15. 15. <ul><li>Images are defined with the <IMG> tag, accompanied by SRC (source) indicating the address or path to the image you want to use. The general form of this tag will be: </li></ul><ul><li><IMG SRC=&quot;imagename.extension&quot;> </li></ul><ul><li><HTML> <HEAD> <TITLE>Images</TITLE> </HEAD> <BODY> <CENTER><B>Images</B> <BR> <IMG SRC=&quot;html.png&quot;></CENTER> </BODY> </HTML> </li></ul>
  16. 16. <ul><li>Specifies an alternate text for an image, if the image cannot be displayed. The value of the ALT attribute is given by the author. It also provides information for an image if the user cannot view it from different reasons. If you move the mouse cursor over the image, will appear the text written in the ALT attribute like in the following example: </li></ul><ul><li><IMG SRC=&quot;html.png&quot; alt=&quot;logohtml&quot;> </li></ul>
  17. 17. <ul><li>To specify the dimension of an image we use the height and width attributes. The attribute values are specified in pixels by default but they also can be represented as a percentage. Example: </li></ul><ul><li><IMG SRC=&quot;html.png&quot; alt=&quot;logohtml&quot; width=&quot;320&quot; height=&quot;240&quot;> </li></ul>
  18. 18. <ul><li>For align an image we are using ALIGN and VALIGN attributes. Functionality of these attributes are: Align (horizontal alignment): right </li></ul><ul><li>left </li></ul><ul><li>center </li></ul><ul><li>Valign (vertical alignment): top </li></ul><ul><li>bottom </li></ul><ul><li>center </li></ul>
  19. 19. <ul><li>To create an unordered list we should use tags like <UL> and </UL> (names of these tags comes from &quot;unordered list&quot;). Each list item should be inserted by the tag <LI> (list item). For a better understanding let's see how HTML code for the list above looks like: <HTML> <HEAD> <TITLE>Lists</TITLE> </HEAD> <BODY> <UL>Unordered list <LI>List element 1 <LI>List element 2 <LI>List element 3 </UL> </HTML> </li></ul><ul><li>HTML lists can be ordered or unordered: </li></ul><ul><li>List element 1 </li></ul><ul><li>List element 3 </li></ul><ul><li>List element 2 </li></ul>
  20. 20. <ul><li>To create an ordered list we should use tags like <OL> and </OL>. Instead of numbers you can replace them with Roman numbers or letters, both capital and lower-case. Use the TYPE attribute to change the numbering like in the following example: <OL TYPE=&quot;a&quot;> <OL TYPE=&quot;A&quot;> <OL TYPE=&quot;i&quot;> <OL TYPE=&quot;I&quot;> </li></ul>
  21. 21. <ul><li>START is another attribute of the ordered lists and this specifies the number or letter with which the list would start. </li></ul><ul><li><OL TYPE=&quot;1&quot; START=&quot;3&quot;> <LI>List element 1 <LI>List element 2 <LI>List element 3 </OL> </li></ul><ul><li><OL TYPE=&quot;a&quot; START=&quot;5&quot;> <LI>List element 1 <LI>List element 2 <LI>List element 3 </OL> </li></ul>
  22. 22. <ul><li>HTML tables can be defined by using <TABLE> tag. A table in HTML contains rows, defined by the <TR> tag, and cells, defined by the <TD> tag. <TR> tag comes from &quot;table row&quot; while <TD> comes from &quot;table data&quot;. A <TD> tag can contain text, images, links, lists, forms and other tables. Let's see an example for a simple table: <TABLE BORDER=&quot;1&quot;> <TR> <TD>Cell 1</TD> <TD>Cell 2</TD> </TR> </TABLE> </li></ul><ul><li>The BORDER attribute will specify how thick the border will be. If we don't specify a border attribute, the table will be displayed without borders. The color border can be set by using BORDERCOLOR attribute. </li></ul>
  23. 23. <ul><li>Can be defined by: Table HEIGHT - is a table attribute that defines the height of the table. The value of this attribute can be expressed in pixels or percentage of the page; </li></ul><ul><li><TABLE HEIGHT=&quot;50&quot;> </li></ul><ul><li>Table WIDTH - is a table attribute that defines the width of the table. The value of this attribute can be expressed in pixels or percentage of the page; </li></ul><ul><li><TABLE WIDTH=&quot;100&quot;> </li></ul>
  24. 24. <ul><li>CELLPADDING - offers opportunities of adjusting the white space of the table, that means the distance between cell borders and the content within; </li></ul><ul><li>CELLSPACING - defines the width of the border; </li></ul>
  25. 25. <ul><li>ROWSPAN - it is used to span multiple rows; </li></ul><ul><li><TABLE BORDER=&quot;1&quot;> <TR><TD ROWSPAN=&quot;2&quot;>Cell 1</TD> <TD>Cell 2</TD></TR> <TR><TD>Cell 3</TD></TR> </TABLE> </li></ul><ul><li>COLSPAN - it is used to span multiple columns; <TABLE BORDER=&quot;1&quot;> <TR><TD>Cell 1</TD> <TD>Cell 2</TD></TR> <TR><TD COLSPAN=&quot;2&quot;>Cell 3</TD></TR> </TABLE> </li></ul>
  26. 26. <ul><li>HTML frames help us to display multiple html documents in a web page. This frames are independent one of the other. A frameset is a file that specifies how the screen is divided into frames or specifies the WebPages to display in each frame of the main web page. Here we have an example that divides the page into two horizontal frames, one having 30% of the page and other 70%. </li></ul><ul><ul><li><FRAMESET ROWS=&quot;30%,*&quot;> </FRAMESET> </li></ul></ul><ul><ul><li>FRAMESET ROWS - defines the height that each frame will have; </li></ul></ul><ul><ul><li>FRAMESET COLS - defines the width that each frame will have; </li></ul></ul><ul><ul><li>FRAME SRC - defines the location of the web page that will be loaded into the frame; </li></ul></ul>
  27. 27. <ul><li>FRAMEBORDER - shows the frame border. A zero value hides the border; BORDER - gives the border width; FRAMESPACING - modifies the border width (attribute used on Internet Explorer); </li></ul><ul><ul><li>Example Frames: <HTML> <HEAD> <TITLE> HTML frames </TITLE> </HEAD> <FRAMESET ROWS=&quot;30%,*&quot; FRAMEBORDER=&quot;2&quot; BORDER=&quot;2&quot;> <FRAME SRC=&quot;title.php&quot;> <FRAMESET COLS=&quot;20%,*&quot; FRAMEBORDER=&quot;2&quot; BORDER=&quot;2&quot;> <FRAME SRC=&quot;menu.php&quot;> <FRAME SRC=&quot;pagecontent.php&quot;> </FRAMESET> </HTML> </li></ul></ul>
  28. 28. <ul><li>HTML forms are used to obtain useful information about users such as name, address, e-mail or phone. By these forms users are transferring information to the server. This information is entered by elements like text fields, checkboxes, submit buttons, radio buttons, lists, textarea. </li></ul><ul><ul><li>To create a form we will use <FORM> tag like in the following example: <FORM> form elements </FORM> </li></ul></ul><ul><li>One of the most important form element is TYPE attribute of the <INPUT> tag. The attributes of this tag are: TYPE - determine the type of text field. Example: text, textarea or password field; </li></ul><ul><ul><li>NAME - assign a name field to refer to it later; </li></ul></ul><ul><ul><li>SIZE - set the field size; </li></ul></ul><ul><ul><li>MAXLENGHT - maximum number of characters that can be introduced. </li></ul></ul>
  29. 29. <ul><li>1-Text fields </li></ul><ul><li>Defined by: TYPE=&quot;text&quot;. Example: <FORM> Full name: <INPUT TYPE=&quot;text&quot; NAME=&quot;fullname&quot;> </li></ul><ul><li>Address: <INPUT TYPE=&quot;text&quot; NAME=&quot;address&quot;> </FORM> </li></ul><ul><li>2-Password field Defined by: TYPE=&quot;password&quot;. Example: <FORM> Password: <INPUT TYPE=&quot;password&quot; NAME=&quot;password&quot;> </FORM> </li></ul><ul><li>3-Radio buttons Defined by: TYPE=&quot;radio&quot;. Example: <FORM> <INPUT TYPE=&quot;radio&quot; NAME=&quot;choice&quot; VALUE=&quot;yes&quot;> Yes <INPUT TYPE=&quot;radio&quot; NAME=&quot;choice&quot; VALUE=&quot;no&quot;>No </FORM> </li></ul><ul><li>4-Check boxes Defined by: TYPE=&quot;checkbox&quot;. Example: <FORM> <INPUT TYPE=&quot;checkbox&quot; NAME=&quot;colors&quot; VALUE=&quot;black&quot;> Black <INPUT TYPE=&quot;checkbox&quot; NAME=&quot;colors&quot; VALUE=&quot;white&quot;>White </FORM </li></ul>
  30. 30. <ul><li>5-Submit button Defined by: TYPE=&quot;submit&quot;. Example: <FORM NAME=&quot;input&quot; ACTION=&quot;mailto:youremail@email.com&quot; METHOD=&quot;get&quot;> NAME: <INPUT TYPE=&quot;text&quot; NAME=&quot;username&quot;> <INPUT TYPE=&quot;submit&quot; VALUE=&quot;submit&quot;> </FORM> </li></ul><ul><li>6-Text area T ext area is used as a text edit field where the user can enter comments that will be sent later to the server. The attributes that has to be specified of text area are <ROWS> and <COLUMNS>. Let's see an example: <FORM ACTION=&quot;mailto:youremail@email.com&quot; METHOD=&quot;get&quot;> <TEXTAREA ROWS=&quot;5&quot; COLS=&quot;10&quot; NAME=&quot;textarea&quot;> Your text here </TEXTAREA> </FORM> </li></ul><ul><li>7-Drop down lists  To create a drop down list we will use SELECT tag followed by OPTION tags. The OPTION tags represents the available choices for the user. Let's see how to do it: </li></ul><ul><li><FORM ACTION=&quot;mailto:youremail@email.com&quot; METHOD=&quot;get&quot;> Which continent you belong? <SELECT NAME=&quot;continent&quot;> <OPTION> Select continent </OPTION> <OPTION> Asia </OPTION> <OPTION> Africa </OPTION> <OPTION> North America </OPTION> <OPTION> South America </OPTION> <OPTION> Antartica </OPTION> <OPTION> Europe </OPTION> <OPTION> Australia </OPTION> </SELECT> </FOR </li></ul>