Html tags


Published on

All basics tags of HTML and CSS.....

  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Html tags

  1. 1. Introduction of <br />CSS and HTML For the Web<br />By- <br />GauravJaiswal<br />M.Tech. (1st year)<br />S.R.M.S.C.E.T. Bareilly<br />
  2. 2. Contents<br />Introduction of HTML<br />HTML page format<br />Basics elements<br />Important tags<br />
  3. 3. HTML --- Hypertext Markup Language<br />
  4. 4. Introduction of HTML<br />An HTML document is simply a text file that contains the information you want to<br />publish and the appropriate markup instructions indicating how the browser should<br />structure or present the document.<br />A graphical overview of the HTML markup syntax shown so far is presented here :<br /> Tag Attribute Attribute<br /> name name value<br /> <h1 class = “primary”>Example Heading</h1><br /> Attribute<br /> start tag affected tag end tag<br /> HTML tag<br />Versions of HTML --<br />
  5. 5.
  6. 6. HTML Page Format<br /><HTML><br /> <HEAD><br /> <TITLE> Qi’s web! </TITLE><br /> </HEAD><br /> <BODY><br /> <H1> Hello World </H1><br /><! Rest of page goes here. This is a comment. ><br /> </BODY><br /></HTML><br />
  7. 7. 7<br />BODY Element<br /><BODY attribute name="attribute value"><br />Deprecated attributes (but still used)<br />BACKGROUND=“Sunset.jpg” (can be tiled)<br />BGCOLOR=color<br />TEXT=color<br />LINK=color (unvisited links)<br />VLINK=color (visited links)<br />ALINK=color (when selected)<br />The full syntax of the elements allowed in the body element<br />
  8. 8. Some HTML basics Elements<br />
  9. 9. 9<br />Headings<br /><H1 ...> text </H1> -- largest of the six<br /><H2 ...> text </H2><br /><H3 ...> text </H3><br /><H4 ...> text </H4><br /><H5 ...> text </H5><br /><H6 ...> text </H6> -- smallest of the six<br />ALIGN="position" --left (default), center or right<br />Examples-<br />
  10. 10. 10<br /><HTML><br /><HEAD><br /> <TITLE>Document Headings</TITLE><br /></HEAD><br /><BODY><br />Samples of the six heading types:<br /><H1>Level-1 (H1)</H1><br /><H2>Level-2 (H2)</H2><br /><H3><U>Level-3 (H3)</U></H3><br /><H4>Level-4 (H4)</H4><br /><H5>Level-5 (H5)</H5><br /><H6>Level-6 (H6)</H6><br /></BODY><br /></HTML><br />
  11. 11. 11<br /><P> Paragraph<br /><P> defines a paragraph<br />Add ALIGN="position" (left, center, right)<br />But </P> is optional<br />Example-<br /><BODY><br /><P>Here is some text </P><br /><P ALIGN="center"> Centered text </P> <P><P><P><br /><P ALIGN="right"> Right-justified text<br /></BODY><br />
  12. 12. 12<br />Fonts<br /><P><FONT COLOR="red" SIZE="2" FACE="Times Roman"><br />This is the text of line one </FONT><br /><FONT COLOR="green" SIZE="4" FACE="Arial"><br />Line two contains this text </FONT><br />Here is some text. Please read carefully. </P><br />
  13. 13. 13<br />Ordered (Numbered) Lists<br /><OL TYPE="1"><br /> <LI> Item one </LI><br /> <LI> Item two </LI><br /> <OL TYPE="I" ><br /> <LI> Sublist item one </LI><br /> <LI> Sublist item two </LI><br /> <OL TYPE="i"><br /> <LI> Sub-sublist item one </LI><br /> <LI> Sub-sublist item two </LI><br /> </OL><br /> </OL><br /></OL><br />
  14. 14. 14<br />Unordered (Bulleted) Lists<br /><UL TYPE="disc"><br /> <LI> One </LI><br /> <LI> Two </LI><br /> <UL TYPE="circle"><br /> <LI> Three </LI><br /> <LI> Four </LI><br /> <UL TYPE="square"><br /> <LI> Five </LI><br /> <LI> Six </LI><br /> </UL><br /> </UL><br /></UL><br />
  15. 15. 15<br /><A> Anchors (Hyperlinks)<br />Link to an absolute URL:<br />If you get spam, contact <A HREF=""><br />Microsoft </A> to report the problem.<br />Link to a relative URL:<br />See these <A HREF="#references"> references </A><br />concerning our fine products.<br />Link to a section within a URL: <br />Amazon provided a <A HREF=""><br />reference for our company. </A><br />
  16. 16. 16<br />Hyperlinks<br />Examples-<br /><BODY><br /><H3>Welcome to <A HREF=""><br /><STRONG>Computer Science</STRONG></A><br />at the <A HREF="">SRMSCET, Bareilly.</A><br /></H3><br /></BODY><br />
  17. 17. 17<br />Images<br />SRC is required<br />WIDTH, HEIGHT may be in units of pixels or percentage of page or frame<br />WIDTH="357"<br />HEIGHT="50%"<br />Images scale to fit the space allowed<br />Examples--<br />
  18. 18. 18<br />Images<br /><HTML><br /> <BODY><br /><imgsrc=“1.jpg" alt="Graham Allan" height="320" width="150"><br /><imgsrc=“2.jpg" lowsrc="loading.jpg" border="0" height="50%“ width="50%" alt="Picture of Olivia" longdesc="olivia-bio.html"><br /><a href="home.html"><imgsrc=“google.png" width="50" height="20"<br />alt="Link to Home Page" /></a><br /></BODY></HTML><br />
  19. 19. 19<br />Tables<br /><ul><li>Elements of tables in HTML are-</li></ul><TABLE> table tag<br /><CAPTION> optional table title<br /><TR> table row<br /><TH> table column header<br /><TD> table data element<br />
  20. 20. 20<br />Tables<br /><table bgcolor="white" border="2"><br /><tr><br /><td>Cell 1</td><br /><td>Cell 2</td><br /><td>Cell 3</td><br /><td>Cell 4</td> </tr><br /><tr><br /><td>Cell 5</td><br /><td>Cell 6</td> </tr> </table><br /><table bgcolor="yellow"><br /><caption>Widgets by Area</caption><br /><thead align="center" bgcolor="green" valign="middle"><br /><tr><br /><td>Region</td><br /><th>Regular Widget</th><br /><th>Super Widget</th> </tr><br /></thead><br /><tbody><br /><tr><br /><th>West Coast</th><br /><td>10</td><br /><td>12</td> </tr><br /><tr><br /><th>East Coast</th><br /><td>1</td><br /><td>20</td> </tr> </tbody><br /></table><br />
  21. 21. 21<br />cellspacing=10<br />cellpadding=10<br />
  22. 22. 22<br /><TR> Table Row Attributes<br />Valid for the table row:<br />ALIGN -- left, center, right<br />VALIGN -- top, middle, bottom<br />BGCOLOR -- background color <br />Example--<br /><TABLE ALIGN=“left" WIDTH="300" HEIGHT="200"><br /><TR ALIGN="left" VALIGN="top" BGCOLOR="red"><TD>One</TD><TD>Two</TD><br /><TR ALIGN="center" VALIGN="middle" BGCOLOR="lightblue"><TD>Three</TD><TD>Four</TD><br /><TR ALIGN="right" VALIGN="bottom" BGCOLOR="yellow"><TD>Five</TD><TD>Six</TD><br /></TABLE><br />
  23. 23. 23<br /><TD> Table Cell Attributes<br />Valid for the table cell:<br />colspan -- how many columns this cell occupies<br />rowspan – how many rows this cell occupies<br />Example--<br /><TABLE ALIGN="center" WIDTH="300" HEIGHT="200" <br />border="1"><br /><TR><br /><TD colspan="1" rowspan="2">a</TD><br /><TD colspan="1" rowspan="1">b</TD><br /></TR><br /><TR><br /><TD colspan="1" rowspan="1">c</TD><br /></TR><br /></TABLE><br />
  24. 24. 24<br />Frames<br />Frames help control navigation and display<br /><FRAME> attributes include<br />FRAMEBORDER – yes or 1 for borders<br />FRAMESPACING – width of border<br />BORDERCOLOR – color <br />SRC – location of HTML to display in frame<br />NAME – destination for TARGET attribute<br />
  25. 25. 25<br />Frames<br /><FRAMESET ROWS="75%,25%"><br /> <FRAMESET COLS="*,*,*"><br /> <FRAME SRC=""><br /> <FRAME SRC=""><br /> <FRAME SRC=""><br /> </FRAMESET><br /> <FRAMESET COLS="*,*"><br /> <FRAME SRC=""><br /> <FRAME SRC=""><br /> </FRAMESET><br /></FRAMESET><br />
  26. 26. Some Important HTML tags with example<br />
  27. 27. 1. <abbr> (Abbreviation)<br />Examples :<br /><p><abbr title="California">Calif</abbr></p><br />2. <acronym> (Acronym)<br />Examples :<br /><p><acronym title="Extensible Markup Language">XML</acronym><br /><acronymtitle="Soci&eacute;t&eacute; Nationale de Chemins de<br />Fer">SNCF</acronym></p><br />
  28. 28. 3. <area> (Image Map Area)<br />Examples :<br /><map id="primary" name="primary"><br /><area shape="circle" coords="200,250,25" href="another.html"><br /><area shape="default" nohref><br /></map><br />4. <applet> (Java Applet)<br />Example :<br /><applet code="atarigame.class" align="left" archive="” height="250" width="350"><br /><param name="difficulty" value="easy"><br /><strong>Sorry, you need Java to play this game.</strong> </applet><br />5. <address> (Address)<br />Example :<br /><address>PINT, Inc.<br><br />2105 Garnet Ave.<br><br />San Diego, CA 92109<br><br />U.S.A.</address><br />
  29. 29. 6. <base> (Base URL)<br />Examples :<br /><base href=""><br />7. <basefont> (Base Font)<br />Example :<br /><basefont color="#ff0000" face="Helvetica" size="+2"><br />8. <big> (Big Font)<br />Example :<br /><p>This text is regular size. <big>This text is larger.</big> Now back to regular size.</p><br />9. <blink> (Blinking Text)<br />Example :<br /><blink>Annoying, isn't it?</blink><br />10. <blockquote> (Block Quote)<br />Example :<br /><blockquote cite=""><br />We hold these truths to be self-evident, that all men are created equal,<br />that they are endowed by their Creator with certain unalienable rights,<br />that among these are life, liberty and the pursuit of happiness. </blockquote><br />
  30. 30. 11. <caption> (Table Caption)<br />Example :<br /><table border="1"><br /><caption align="top">Our High-Priced Menu</caption><br /><tr> <td>Escargot</td><br /> <td>Filet Mignon</td><br /> <td>Big Mac</td><br /></tr> </table><br />12. <cite> (Citation)<br />Example :<br /><p>This presentation is presented by <cite>GauravJaiswal,M.Tech student<br /></cite> batch 2011.</p><br />13. <code> (Code Listing)<br />Example :<br /><p>To increment a variable <var>count</var>, use<br /><code> count++ </code> or <code> count = count + 1 </code>.</p><br />14. <center> (Center Alignment)<br />Examples :<br /><center>This is in the center of the page.</center><br />
  31. 31. 15. <dir> (Directory List)<br />Example :<br /><dir> <li>Header Files</li><br /> <li>Code Files</li><br /> <li>Comment Files</li> </dir><br />16. <div> (Division)<br />Examples :<br /><div class="special" id="div1" style="background-color: yellow;"> Divs are useful for setting arbitrary style </div><br />17. <em> (Emphasis)<br />Example :<br /><p><em>This is the important point</em> to consider, not this other less exciting point.</p><br />18. <hr> (Horizontal Rule)<br />Examples :<br /><hr align="center" width="100%" size="3" color=“blue" /><br />19. <input> (Input Form Control)<br />Example :<br /><form><p>Enter your name: <input type="text" maxlength="35" size="20"><br><br />Enter your password: <input type="password" maxlength="35" size="20"><br /></p> </form><br />
  32. 32. 20. <isindex> (Index Prompt)<br />Examples :<br /><isindex action="cgi-bin/" prompt="Enter search terms"><br />21. <kbd> (Keyboard Input)<br />Example :<br /><p>On a Linux or Unix based system you can list files by typing<br /><kbd>ls</kbd> at a command prompt.</p><br />22. <map> (Client-Side Image Map)<br />Example :<br /><map name="mainmap" id="mainmap"><br /><area shape="circle" coords="200,250,25" href="file1.html" /> </map><br />23. <meta> (Meta-Information)<br />Example :<br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><br />
  33. 33. 24. <menu> (Menu List or Command Menu)<br />Example :<br /><menu><br /><li>Fish</li><br /><li>Beef</li><br /><li>Chicken</li> </menu><br />25. <option> (Option in Selection List)<br />Examples :<br /><p>Which is your favorite dog?:<br /><select><br /><option value="Australian Shepard">Sabrina</option><br /><option value="German Shepard">Lucky</option> </select> </p><br />26. <param> (Object Parameter)<br />Examples :<br /><applet code="plot.class"><br /><param name="min" value="5"><br /><param name="max" value="30"><br /><param name="line-style" value="dotted"><br /></applet><br />
  34. 34. 27. <pre> (Preformatted Text)<br />Examples :<br /><pre><br />Within PREFORMATTED text A L L formatting IS PRESERVED<br />NO m a t t e r how wild it is. </pre><br />28. <samp> (Sample Text)<br />Example :<br /><p>Use the following salutation in all e-mail messages to the boss:<br /><samp>Please excuse the interruption, oh exalted manager.</samp></p><br />29. <script> (Scripting)<br />Examples :<br /><script type="text/javascript"><br />alert("Hello World !!!"); </script><br />30. <select> (Selection List)<br />Examples :<br /><form action="#" method="get"><br /><p><label>Choose your favorite colors:</label><br /><select name="colors" multiple="multiple" size="2"><br /><option>Red</option><br /><option>Yellow</option> </select><br /></p> </form><br />
  35. 35. 31. <small> (Small Text)<br />Examples :<br /><p>Here is some <small>small text</small>.</p><br />32. <strike> (Strikeout Text)<br />Examples :<br /><p>This line contains a spelling <strike>mistake</strike> mistake</p>.<br />33. <strong> (Strong Emphasis)<br />Examples :<br /><p>It is really <strong>important</strong> to pay attention.</p><br />34. <style> (Style Information)<br />Examples :<br /><html> <head><br /><style type="text/css"><br />body {background: black; color: white; font: 12px Helvetica;}<br />h1 {color: red; font: 14px Impact;}<br /></style> </head> </html><br />
  36. 36. 35. <sup> (Superscript)<br />Examples :<br /><p>Here is some <sup>superscripted</sup> text.</p><br />36. <textarea> (Multiline Text Input)<br />Example :<br /><textarea id="CommentBox" cols="40" rows="8"><br />Default text in field </textarea> <br />37. <tt> (Teletype Text)<br />Examples :<br /><p>Here is some <tt>monospaced text</tt></p>.<br />38. <var> (Variable)<br />Examples :<br /><p>In Math the variable <var>x</var> holds the answer to many of life's most important questions. </p><br />39. <sub> (Subscript)<br />Examples :<br /><p>Here is some <sub>subscripted</sub> text.</p><br />
  37. 37. CSS---Cascading Style Sheet<br />
  38. 38. Cascading Style Sheet (CSS)<br />Introduction<br />CSS general form<br />Style rules<br />Advantages and disadvantages<br />4 Ways To Put CSS And HTML Together<br />
  39. 39. Introduction<br />CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. <br />Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector.<br />Style Sheets are templates, very similar to templates in desktop publishing applications, containing a collection of rules declared to various selectors (elements).<br />
  40. 40. 40<br />CSS<br />General form:<br /> Property name value Declaration separation<br />h1 {font-size: xx-large; color: red;}<br /> Selector <br /> Declaration Declaration Rule<br /> Declaration block<br />
  41. 41. Understanding Style Rules<br />A Style Rule is composed of two parts: a selector and a declaration.<br />TH {color: red;}.<br />The Selector indicates the element to which the rule is applied.<br />The Declaration determines the property values of a selector.<br />Declaration<br />Selector<br />
  42. 42. The Property specifies a characteristic, such as color, font-family, position, and is followed by a colon (:).<br />The Value expresses specification of a property, such as red for color, Arial for font family, 12 pt. for font-size, and is followed by a semicolon (;).<br />P {color: red;}<br />Property<br />Value<br />
  43. 43. Advantages of CSS<br />CSS saves timeWhen most of us first learn HTML, we get taught to set the font face, size, color, style etc. every time it occurs on a page. This means we find ourselves typing (or copying & pasting) the same thing over and over again. With CSS, you only have to specify these details once for any element. CSS will automatically apply the specified styles whenever that element occurs. <br />Pages load fasterLess code means faster download times. <br />Easy maintenanceTo change the style of an element, you only have to make an edit in one place. <br />Superior styles to HTMLCSS has a much wider array of attributes than HTML. <br />Disadvantages of CSS<br />Browser compatibilityBrowsers have varying levels of compliance with Style Sheets. This means that some Style Sheet features are supported and some aren't. To confuse things more, some browser manufacturers decide to come up with their own proprietary tags. <br />
  44. 44. 4 Ways To Put CSS And HTML Together<br /><ul><li>1. Defining a style sheet inside of the HTML document,
  45. 45. inside the <HTML> tag, known as “INLINE Style Sheet”.
  46. 46. 2. Using a <STYLE> tag inside the document body. Known as
  47. 47. “INTERNAL Style Sheet”.
  48. 48. 3. Referring to an external file which contains a style sheet,
  49. 49. by using the 'LINK' element, Known as “EXTERNAL Style Sheet”.
  50. 50. 4. Referring to an external file which contains a style sheet,
  51. 51. by using the '@import' notation.</li></li></ul><li>1.) Inline Styles<br /><p style="color:red;margin-left:20px">This is a paragraph.</p><br />Multiple Style Sheets<br />If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet. <br />For example, an external style sheet has these properties for the h3 selector:<br />h3{color:red;text-align:left;font-size:8pt;}<br />And an internal style sheet has these properties for the h3 selector:<br />h3{text-align:right;font-size:20pt;}<br />If the page with the internal style sheet also links to the external style sheet the properties for h3 will be:<br />color:red;text-align:right;font-size:20pt;<br />The color is inherited from the external style sheet and the text-alignment and the font-size is replaced by the internal style sheet.<br />
  52. 52. 2.) Internal Style Sheet<br />An internal style sheet should be used when a single document has a unique style.<br /> <head><Body><style type="text/css">hr {color:red;}p {margin-left:20px;}body {background-image:url("images/back40.gif");}</style><br /> </Body></head><br />
  53. 53. 3.) External Style Sheet<br /> An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section:<br /><head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head><br /> An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension. An example of a style sheet file is shown below:<br /> hr {color:red;}p {margin-left:20px;}body {background-image:url("images/back40.gif");}<br />
  54. 54. 4.) Import Style Sheet<br />Another way to use document-wide style rules rather than type the properties directly within a <style> tag is to import them.<br />The syntax for importing a style sheet is @import, followed by the keyword url and the actual URL of the style sheet to include, and terminated with a semicolon:<br />@import url(corerules.css);<br />Though not advisable stylistically or for ensured browser compatibility, the specification also allows us to set a string after @import of the URL, like so:<br />@import "corerules.css";<br />
  55. 55. <!DOCTYPE html><br /><html> <head><br /><title>Imported Styles</title><br /><style type="text/css“ media=“all”><br /><!--<br />@import url(corerules.css);<br />@import url(linkrules.css);<br />h1 {font-size: xx-large; font-family: Sans-Serif; color: black; text-align: center; border-bottom: solid 4px orange;}<br />p {text-indent: 1em; text-align: justify; line-height: 150%;}<br />--><br /></style><br /></head><br /><body><br /><div id="page"><br /><h1>HTML with Imported Style</h1><br /><p>Cascading Style Sheets 2.1 as defined by the<br /><a href="">W3C</a> Provides powerful page layout facilities. The technology depends on correct markup so make sure you get that right too!</p><br /></div><br /></body><br /></html><br />
  56. 56. Thank you<br />