SlideShare uma empresa Scribd logo
1 de 41
More HTML Elements Colin Gourlay & Kevin Vanderbeken
Today: Tables Forms Block Quotes
tables
the good tables
when tables are bad
the base table elements <table border="1" cellpadding="1" 	    cellspacing="0">    <tr>        <th>Month</th>        <th>Savings</th>    </tr>    <tr>        <td>January</td>        <td>$100</td>    </tr></table>
<table>           <th> <tr><td>
column & row spans <td rowspan="3"> <td colspan="4"> <thcolspan="4">
<td colspan="4">
<td rowspan="3">
special table elements <thead>, <tfooter> and <tbody> <colgroup> and <col>
so how do we actually make tables look good?
markup     <tr>       <td>Josephin Tan</td>       <td>$150</td>       <td>-</td>       <td>Annie</td>     </tr>     <tr>       <td>Joyce Ming</td>       <td>$200</td>       <td>$35</td>       <td>Andy</td>     </tr>     <tr>       <td>James A. Pentel</td>       <td>$175</td>       <td>$25</td>       <td>Annie</td>     </tr>   </tbody> </table> <table id="hor-minimalist-b"         summary="Employee Pay Sheet">   <thead>     <tr>       <th scope="col">Employee</th>       <th scope="col">Salary</th>       <th scope="col">Bonus</th>       <th scope="col">Supervisor</th>     </tr>   </thead>   <tbody>     <tr>        <td>Stephen C. Cox</td>        <td>$300</td>        <td>$50</td>        <td>Bob</td>      </tr> ...
style #hor-minimalist-b { font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;   font-size: 12px;   background-color: #fff;   margin: 45px;   width: 480px;   border-collapse: collapse;   text-align: left; } #hor-minimalist-b th {   font-size: 14px;   font-weight: normal;   color: #039;   padding: 10px 8px;   border-bottom: 2px solid #6678b1; } #hor-minimalist-b td {   border-bottom: 1px solid #ccc;   color: #669;   padding: 6px 8px; } #hor-minimalist-b tbodytr:hover td {   color: #009; }
the result (Table design attributed to Smashing Magazine)
forms
<form action="form.html" method="post">    <fieldset>       <legend>Join our email list</legend>       <p>Get news about us sent to your email.</p>       <ol>          <li>             <label for="name">Name:</label>             <input type="text" name="name" id="name" />          </li>          <li>             <label for="name">Email:</label>             <input type="text" name="email" id="email" />          </li>         </ol>       <input type="submit" value="Submit" />    </fieldset> </form>
<form> This element is a container for all the content of the form and can contain many types of other elements, except another <form>
<form action="/register.html" method="post">
<fieldset> and <legend> The fieldset element is used to indicate a logical group of form controls. A fieldset may also include a legend element that provides a caption for the fields it wraps.
<label> This element is used to link up descriptive text with a form field like an input element. It's fundamental to making your forms accessible.
<label for="age">Age: </label>
<input type="text" /> One of the most simple types of form control is the text entry field used for entering a single word or line of text.
<input type="text" name="username" value="" />
<input type="submit" /> By using the type of submit, this control looks like a button. When clicked, the submit button immediately sends the collected form data to the server for processing.
<input type="submit" value="Submit" /> <input type="image" src="button.png"/>
other common input
<textarea>...</textarea> This one is a multi-line, scrollable text entry box. You see it many places - like our competition forms for example.
<input type="radio" /> By giving them the same "name" attribute in groups, you can have a group of radio buttons restricted to a single choice.  <input type="radio" name="vote" value="a" /> <input type="radio" name="vote" value="b" /> <input type="radio" name="vote" value="c" />
<input type="checkbox" /> For single or multiple selections. We commonly use these to get visitors to indicate that they have read our terms and conditions.  <input type="checkbox" name="t-and-c"checked="checked" />
<select><option>... The select element, which contains option elements, displays as a pull-down menu by default when no size is specified or if the size attribute is set to 1. In pull-down menus, only one item may be selected
block quotes
<p> Renowned type designer, Matthew Carter, has this to say    about his profession: </p> <blockquote>   <p> Our alphabet hasn't changed in eons; there isn't      much latitude in what a designer can do with the      individual letters. </p>   <p> Much like a piece of classical music, the score is      written down – it’s not something that is tampered      with – and yet, each conductor interprets that score      differently. There is tension in      the interpretation. </p> </blockquote>
preformatted text We told you browsers ignore white space between elements in html right? What if we wanted to keep the whitespace, like tabs and spaces... intact?
Wrap it in the <pre> ... </pre> tags,and you let the browser know that it's preformatted!
the syntax glossary http://apnwebdev.pbworks.com/Syntax-Glossary
more references http://www.htmldog.com/guides/    -  Guides on best practice web stuff. http://www.w3schools.com/tags/default.asp   -  The XHTML tag references. http://www.w3schools.com/css/css_reference.asp   - The CSS property references.
next week...
The CSS Box Model

Mais conteúdo relacionado

Mais procurados (18)

Html ppt
Html pptHtml ppt
Html ppt
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 
Chapter 3 class presentation
Chapter 3 class presentationChapter 3 class presentation
Chapter 3 class presentation
 
Understanding THML
Understanding THMLUnderstanding THML
Understanding THML
 
Prabu html
Prabu htmlPrabu html
Prabu html
 
Intro Html
Intro HtmlIntro Html
Intro Html
 
Html basic tags
Html basic tagsHtml basic tags
Html basic tags
 
Html tag
Html tagHtml tag
Html tag
 
Working with External CSS
Working with External CSSWorking with External CSS
Working with External CSS
 
YL basic tag
YL basic tagYL basic tag
YL basic tag
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
YL Intro html
YL Intro htmlYL Intro html
YL Intro html
 
Cheat codes
Cheat codesCheat codes
Cheat codes
 
HTML to FTP
HTML to FTPHTML to FTP
HTML to FTP
 
Html Unit B
Html   Unit BHtml   Unit B
Html Unit B
 
Html part2 (1)
Html part2 (1)Html part2 (1)
Html part2 (1)
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
 

Destaque

Apuntes bd1
Apuntes bd1Apuntes bd1
Apuntes bd1mgsaya
 
Codigoeticodesarrollo
CodigoeticodesarrolloCodigoeticodesarrollo
CodigoeticodesarrolloRosa Bermejo
 
Introducción infantil
Introducción infantil Introducción infantil
Introducción infantil pepinete
 
Embarazo en la adolescencia (1)
Embarazo en la adolescencia (1)Embarazo en la adolescencia (1)
Embarazo en la adolescencia (1)Chanel Mendez
 
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report Rates
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report RatesUniversal and Clergy Mandated Reporting Laws and Child Maltreatment Report Rates
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report RatesBASPCAN
 
New Features of HTML 5.1 to Create More Flexible Web Experiences
New Features of HTML 5.1 to Create More Flexible Web ExperiencesNew Features of HTML 5.1 to Create More Flexible Web Experiences
New Features of HTML 5.1 to Create More Flexible Web ExperiencesRasin Bekkevold
 
Working with flash
Working with flashWorking with flash
Working with flashvirnelba
 
Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Matteo Wyllyamz
 
Excel 2010 Unit D PPT
Excel 2010 Unit D PPTExcel 2010 Unit D PPT
Excel 2010 Unit D PPTokmomwalking
 

Destaque (14)

More On Html 5
More On Html 5More On Html 5
More On Html 5
 
Apuntes bd1
Apuntes bd1Apuntes bd1
Apuntes bd1
 
Apuntes bd1
Apuntes bd1Apuntes bd1
Apuntes bd1
 
Codigoeticodesarrollo
CodigoeticodesarrolloCodigoeticodesarrollo
Codigoeticodesarrollo
 
Apuntes bd1
Apuntes bd1Apuntes bd1
Apuntes bd1
 
Cuestiones de repaso
Cuestiones de  repasoCuestiones de  repaso
Cuestiones de repaso
 
Introducción infantil
Introducción infantil Introducción infantil
Introducción infantil
 
Embarazo en la adolescencia (1)
Embarazo en la adolescencia (1)Embarazo en la adolescencia (1)
Embarazo en la adolescencia (1)
 
Base de datos
Base de datosBase de datos
Base de datos
 
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report Rates
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report RatesUniversal and Clergy Mandated Reporting Laws and Child Maltreatment Report Rates
Universal and Clergy Mandated Reporting Laws and Child Maltreatment Report Rates
 
New Features of HTML 5.1 to Create More Flexible Web Experiences
New Features of HTML 5.1 to Create More Flexible Web ExperiencesNew Features of HTML 5.1 to Create More Flexible Web Experiences
New Features of HTML 5.1 to Create More Flexible Web Experiences
 
Working with flash
Working with flashWorking with flash
Working with flash
 
Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)Intro to Flash 8 welcome & course outline (2008)
Intro to Flash 8 welcome & course outline (2008)
 
Excel 2010 Unit D PPT
Excel 2010 Unit D PPTExcel 2010 Unit D PPT
Excel 2010 Unit D PPT
 

Semelhante a 1-06: More HTML Elements

Semelhante a 1-06: More HTML Elements (20)

Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
Html intro
Html introHtml intro
Html intro
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 
Lecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITPLecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITP
 
Html tutorial
Html tutorialHtml tutorial
Html tutorial
 
Html TAGS
Html TAGSHtml TAGS
Html TAGS
 
We9 Struts 2.0
We9 Struts 2.0We9 Struts 2.0
We9 Struts 2.0
 
Html tags
Html tagsHtml tags
Html tags
 
Using Forms in Share
Using Forms in ShareUsing Forms in Share
Using Forms in Share
 
Html Intro2
Html Intro2Html Intro2
Html Intro2
 
HTML & CSS
HTML & CSSHTML & CSS
HTML & CSS
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Kml Basics Chpt 2 Placemarks
Kml Basics Chpt  2   PlacemarksKml Basics Chpt  2   Placemarks
Kml Basics Chpt 2 Placemarks
 
AK html
AK  htmlAK  html
AK html
 
Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?
 

Mais de apnwebdev

1 07-the box-model
1 07-the box-model1 07-the box-model
1 07-the box-modelapnwebdev
 
1 07-2-css floats-and_positioning
1 07-2-css floats-and_positioning1 07-2-css floats-and_positioning
1 07-2-css floats-and_positioningapnwebdev
 
1 06-more html-elements
1 06-more html-elements1 06-more html-elements
1 06-more html-elementsapnwebdev
 
1 05-css for-text_and_backgrounds
1 05-css for-text_and_backgrounds1 05-css for-text_and_backgrounds
1 05-css for-text_and_backgroundsapnwebdev
 
1 04-html elements
1 04-html elements1 04-html elements
1 04-html elementsapnwebdev
 
1-07: The Box Model
1-07: The Box Model1-07: The Box Model
1-07: The Box Modelapnwebdev
 
1-05: CSS for Text and Backgrounds
1-05: CSS for Text and Backgrounds1-05: CSS for Text and Backgrounds
1-05: CSS for Text and Backgroundsapnwebdev
 
1-04: HTML Elements
1-04: HTML Elements1-04: HTML Elements
1-04: HTML Elementsapnwebdev
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introductionapnwebdev
 
1-02: HTML Markup Introduction
1-02: HTML Markup Introduction1-02: HTML Markup Introduction
1-02: HTML Markup Introductionapnwebdev
 
1-01: Introduction To Web Development
1-01: Introduction To  Web  Development1-01: Introduction To  Web  Development
1-01: Introduction To Web Developmentapnwebdev
 

Mais de apnwebdev (11)

1 07-the box-model
1 07-the box-model1 07-the box-model
1 07-the box-model
 
1 07-2-css floats-and_positioning
1 07-2-css floats-and_positioning1 07-2-css floats-and_positioning
1 07-2-css floats-and_positioning
 
1 06-more html-elements
1 06-more html-elements1 06-more html-elements
1 06-more html-elements
 
1 05-css for-text_and_backgrounds
1 05-css for-text_and_backgrounds1 05-css for-text_and_backgrounds
1 05-css for-text_and_backgrounds
 
1 04-html elements
1 04-html elements1 04-html elements
1 04-html elements
 
1-07: The Box Model
1-07: The Box Model1-07: The Box Model
1-07: The Box Model
 
1-05: CSS for Text and Backgrounds
1-05: CSS for Text and Backgrounds1-05: CSS for Text and Backgrounds
1-05: CSS for Text and Backgrounds
 
1-04: HTML Elements
1-04: HTML Elements1-04: HTML Elements
1-04: HTML Elements
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
1-02: HTML Markup Introduction
1-02: HTML Markup Introduction1-02: HTML Markup Introduction
1-02: HTML Markup Introduction
 
1-01: Introduction To Web Development
1-01: Introduction To  Web  Development1-01: Introduction To  Web  Development
1-01: Introduction To Web Development
 

1-06: More HTML Elements

  • 1. More HTML Elements Colin Gourlay & Kevin Vanderbeken
  • 2. Today: Tables Forms Block Quotes
  • 6. the base table elements <table border="1" cellpadding="1" cellspacing="0">    <tr>        <th>Month</th>        <th>Savings</th>    </tr>    <tr>        <td>January</td>        <td>$100</td>    </tr></table>
  • 7.
  • 8. <table> <th> <tr><td>
  • 9. column & row spans <td rowspan="3"> <td colspan="4"> <thcolspan="4">
  • 12. special table elements <thead>, <tfooter> and <tbody> <colgroup> and <col>
  • 13. so how do we actually make tables look good?
  • 14. markup <tr> <td>Josephin Tan</td>       <td>$150</td>       <td>-</td>       <td>Annie</td>     </tr>     <tr>       <td>Joyce Ming</td>       <td>$200</td>       <td>$35</td>       <td>Andy</td>     </tr>     <tr>       <td>James A. Pentel</td>       <td>$175</td>       <td>$25</td>       <td>Annie</td>     </tr>   </tbody> </table> <table id="hor-minimalist-b" summary="Employee Pay Sheet"> <thead>    <tr>      <th scope="col">Employee</th>       <th scope="col">Salary</th>       <th scope="col">Bonus</th>       <th scope="col">Supervisor</th>     </tr>   </thead>   <tbody>     <tr>        <td>Stephen C. Cox</td>        <td>$300</td>        <td>$50</td>        <td>Bob</td>      </tr> ...
  • 15. style #hor-minimalist-b { font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;   font-size: 12px;   background-color: #fff;   margin: 45px;   width: 480px;   border-collapse: collapse;   text-align: left; } #hor-minimalist-b th {   font-size: 14px;   font-weight: normal;   color: #039;   padding: 10px 8px;   border-bottom: 2px solid #6678b1; } #hor-minimalist-b td {   border-bottom: 1px solid #ccc;   color: #669;   padding: 6px 8px; } #hor-minimalist-b tbodytr:hover td {   color: #009; }
  • 16. the result (Table design attributed to Smashing Magazine)
  • 17. forms
  • 18. <form action="form.html" method="post">    <fieldset>       <legend>Join our email list</legend>       <p>Get news about us sent to your email.</p>       <ol>          <li>             <label for="name">Name:</label>             <input type="text" name="name" id="name" />          </li>          <li>             <label for="name">Email:</label>             <input type="text" name="email" id="email" />          </li>         </ol>       <input type="submit" value="Submit" />    </fieldset> </form>
  • 19.
  • 20. <form> This element is a container for all the content of the form and can contain many types of other elements, except another <form>
  • 22. <fieldset> and <legend> The fieldset element is used to indicate a logical group of form controls. A fieldset may also include a legend element that provides a caption for the fields it wraps.
  • 23. <label> This element is used to link up descriptive text with a form field like an input element. It's fundamental to making your forms accessible.
  • 25. <input type="text" /> One of the most simple types of form control is the text entry field used for entering a single word or line of text.
  • 27. <input type="submit" /> By using the type of submit, this control looks like a button. When clicked, the submit button immediately sends the collected form data to the server for processing.
  • 28. <input type="submit" value="Submit" /> <input type="image" src="button.png"/>
  • 30. <textarea>...</textarea> This one is a multi-line, scrollable text entry box. You see it many places - like our competition forms for example.
  • 31. <input type="radio" /> By giving them the same "name" attribute in groups, you can have a group of radio buttons restricted to a single choice. <input type="radio" name="vote" value="a" /> <input type="radio" name="vote" value="b" /> <input type="radio" name="vote" value="c" />
  • 32. <input type="checkbox" /> For single or multiple selections. We commonly use these to get visitors to indicate that they have read our terms and conditions. <input type="checkbox" name="t-and-c"checked="checked" />
  • 33. <select><option>... The select element, which contains option elements, displays as a pull-down menu by default when no size is specified or if the size attribute is set to 1. In pull-down menus, only one item may be selected
  • 35. <p> Renowned type designer, Matthew Carter, has this to say about his profession: </p> <blockquote>   <p> Our alphabet hasn't changed in eons; there isn't much latitude in what a designer can do with the individual letters. </p>   <p> Much like a piece of classical music, the score is written down – it’s not something that is tampered with – and yet, each conductor interprets that score differently. There is tension in the interpretation. </p> </blockquote>
  • 36. preformatted text We told you browsers ignore white space between elements in html right? What if we wanted to keep the whitespace, like tabs and spaces... intact?
  • 37. Wrap it in the <pre> ... </pre> tags,and you let the browser know that it's preformatted!
  • 38. the syntax glossary http://apnwebdev.pbworks.com/Syntax-Glossary
  • 39. more references http://www.htmldog.com/guides/  - Guides on best practice web stuff. http://www.w3schools.com/tags/default.asp - The XHTML tag references. http://www.w3schools.com/css/css_reference.asp - The CSS property references.
  • 41. The CSS Box Model

Notas do Editor

  1. During your travels in the world of HTML/XHTML and CSS - you&apos;ll encounter lots more tags than you&apos;ll probably care to know about. Because we&apos;re pretty nice, we&apos;ll show you what some of the more common ones are, so you know what they do, and how to handle them when you make edits.
  2. Tables are very useful to markup because the data suddenly gets structure and meaning rather than being listed out. We can organise data into rows of columns, and add in headings and captions to make columns have marked up sense. If you understand the purpose of a spreadsheet - you&apos;ve already been sold on tables! 
  3. In the old days, there wasn&apos;t a good reliable way to do layout on the web - If you wanted some columns under a header for example, you would have to create a table with fixed dimensions for the cells, and then hide the borders or backgrounds so the table itself is invisible. IT&apos;S HORRIBLE. NEVER DO THIS IF YOU CAN AVOID IT. Tables imply a semantic relationship just like other elements. Putting things in them, makes them tablular data, and distorts the meaning of your content if you use it for layout purposes.
  4. This is a fully defined table. It has two rows (&lt;tr&gt;) - the first containing two headings (&lt;th&gt;), and the second containing two cells (&lt;td&gt;).That gives us...
  5. But remember the way it looks......is controlled by the stylesheet!!Lets have a look at how these elements create a table structure:
  6. &lt;tr&gt; elements are row containers. All they exist for, is to contain &lt;td&gt; elements, much like the &lt;ul&gt; or &lt;ol&gt;list elements do. They still have semantic purpose of course, as they group rows of those &lt;td&gt; cell elements. &lt;th&gt; elements are heading cells and &lt;td&gt; elements are regular cells.With both of these, you can specify the alignment of the content inside of them with some of their attributes,align=&quot;&quot; for horizontal alignment of contents, and valign=&quot;&quot; for vertical alignment. There are many intricate ways of referencing and nesting cells.
  7. Want a row or column to be one cell, spanning over the space where normally other cells would be? You need the colspan and rowspan attributes for &lt;td&gt; elements! &lt;td rowspan=&quot;3&quot;&gt; - this cellwill eat up a cell one row down to become one larger cell. Remove 3 extra &lt;td&gt;(cells) from other &lt;tr&gt; (rows).&lt;td colspan=&quot;4&quot;&gt; - this cell will eat up 4 cells across to become one larger cell. Remove 3 &lt;th&gt; (cells) on this &lt;tr&gt; (row).&lt;th colspan=&quot;4&quot;&gt; - this heading cell will eat up 4 cells across to become one larger cell. Remove 3 &lt;th&gt;(heading cells) on this &lt;tr&gt; (row).Let’s look at these in action:
  8. More detail on these is in the article on the Wiki
  9. If it ever comes to this point though, you&apos;re best to get the front-end developers to help sort this out for you! :-)
  10. Forms are quite out of the scope of this initial course, but you should be able to understand and identify them in markup.There are two parts to normal forms. The first part is the form that you see on the page itself - buttons, text fields, and pull-down menus (together known as form controls) used to collect info from the user, but can also some regular html text elements. The other part of a web form is the programming or script on the server that processes the info in the form and returns a useful reply. That will handle all the logic. In other words, you can&apos;t just put up an (X)HTML page with form elements - we need progamming know-how of backend developers.
  11. Awesomely becomes:
  12. It is current best practice to wrap form controls in lists, most commonly ordered lists as shown in this example. Not only is it semantically correct, it also makes it easier to format the form with style sheets later.Some of the elements can be explained as:
  13. A type of &quot;password&quot; masks the input text with dots. It&apos;s multipurpose!
  14. You could also use the type of &quot;reset&quot; and it would be a button that sets all the form controls to the state they were in when the form loaded.
  15. We&apos;ve used it in the previous workshop... so we should probably make a mention of what it&apos;s used for. If you have a long quotation, a testimonial, or a section of copy from another source, particularly one that spans four lines or morae, you should mark it up as a blockquote element. It is recommended that content within blockquotes be contained in other elements, such as paragraphs, headings, or lists.
  16. It&apos;s appropriate when only one option from the group is allowed (such as Yes or No, or Male or Female).
  17. You can create groups of checkboxes by assigning them the same &quot;name&quot; attribute value, but unlike the radio input, all the on or off states for each checkbox are sent to the server, not just one!
  18. To allow for multiple selections and make the element display as a scrolling list instead, set a size attribute value of higher than 1, and you can also set the attribute multiple=&quot;multiple&quot;.After we cover the box model in a future lesson, we&apos;ll show you how using form elements inside list elements, can help us semantically and help styling.
  19. We&apos;ve used it in the previous workshop... so we should probably make a mention of what it&apos;s used for. If you have a long quotation, a testimonial, or a section of copy from another source, particularly one that spans four lines or morae, you should mark it up as a blockquote element. It is recommended that content within blockquotes be contained in other elements, such as paragraphs, headings, or lists.
  20. With default styling - it will become indented, and on some browsers can even become italicized.