Card Set Information

2014-02-17 09:51:04

Show Answers:

  1. declaration doctype for HTML5 is
    < !DOCTYPE html >
  2. The text between < html > and < /html >
    describes the web page
  3. The text between and
    is the visible page content
  4. The text between < h1 > and < /h1 >
    is displayed as a heading
  5. The text between < p > and < /p >
    is displayed as a paragraph
  6. what are tags
    • they describe document content
    • are keywords (tag names) surrounded by angle brackets like < html >
    • they normally come in pairs like < b > and < /b >
    • The first tag in a pair is the start/opening tag, the second tag is the end/closing tag
    • The browser does not display the HTML tags, but uses the tags to determine how the content of the HTML page is to be presented/displayed to the user
    • always use lower case letters (although html5 accepts upper case)
  7. < p >
    • paragraphs are defined with the < p > tag
    • The < p > element defines a paragraph in the HTML document
    • has a start and end tag
    • < p >This is a paragraph.< /p >
  8. < br >
    Use the < br > tag if you want a line break (a new line) without starting a new paragraph
  9. The < br > element is an empty HTML element. It has no end tag

    This is
    a para
    graph with line breaks

  10. < a >
    • links are defined with the < a > tag
    • < a > tag defines a hyperlink
    • A hyperlink (or link) is a word, group of words, or image that you can click on to jump to another document.When you move the cursor over a link in a Web page, the arrow will turn into a little hand
    • The most important attribute of the < a > element is the href attribute, which indicates the link's destination
    • The link address is specified in the href attribute.
    • has a start and end tag
    • < a href=“http://www.w3schools.com" >This is a link< /a >
    • < a href="url">Link text(what will show on the browser)< /a >
    • The "Link text" doesn't have to be text. It can be an image or any other HTML element
  11. By default, links will appear in all browsers as:
    • An unvisited link is underlined and blue
    • A visited link is underlined and purple
    • An active link is underlined and red
  12. target attribute
    • specifies where to open the linked document
    • < a href="http://www.w3schools.com/" target=“_blank" >Visit W3Schools!< /a >
    • or < a target=“_blank” >
  13. what are the 5 different values for the target attribute, and their meanings
    • _blank opens the linked doc in a new window or tab
    • _self opens the linked doc in the same frame as it was clicked (default)
    • _parent opens the linked doc in the parent frame
    • _top opens the linked doc in the full body of the window
    • framename opens the linked doc in a named frame
  14. id attribute used to create a bookmark
    • Bookmarks are not displayed in any special way. They are invisible to the reader
    • An anchor with an id inside an HTML document:
    • < a id=“tips" >Useful Tips Section< /a >
    • Create a link to the "Useful Tips Section" inside the same document:
    • < a href=“#tips" >Visit the Useful Tips Section< /a >
    • Or, create a link to the "Useful Tips Section" from another page:
    • < a href=“http://www.w3schools.com/html_links.htm#tips" >
    • Visit the Useful Tips Section< /a >
    • Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html", you will generate two requests to the server, the server will first add a slash to the address, and then create a new request like this: href="http://www.w3schools.com/html/"
  15. < title >
    • Define a title for an HTML document
Use the < title > tag to define a title for a document
    • must be placed within the < head >< /head> tags
    • < title >this is the title of the HTML doc< /title >
  16. < base >
    Default URL and target for all links
Use the < base > tag to specify a default URL and a default target for all links on a page
  17. < meta >
    Provide metadata for an HTML document
Use < meta > elements to specify a description, keywords, author, and character set of a document
  18. < img >
    • images are defined with the < img > tag.
    • The filename and the size of the image are provided as attributes
    • < img src="w3schools.jpg" alt="W3Schools.com" width=“104" height=“142" >
  19. HTML
    • Hyper Text Markup Language
    • is a markup language
    • markup language is a set of markup tags
  20. < html >
    • is an element that defines the whole HTML document
    • has a start and end tag
  21. Element
    • represents some kind of structure or semantics
    • HTML tags" and "HTML elements" are often used to describe the same thing.But strictly speaking, an HTML element is everything between the start tag and the end tag, including the tags:< p >This is a paragraph.< /p >
    • The “element content’ is everything between the start and the end tag
    • Some HTML elements have empty content
    • Empty elements are closed in the start tag
    • Most HTML elements can have attributes
    • Most HTML elements can be nested (can contain other HTML elements)
    • HTML documents consist of nested HTML elements, including “< html >”(which is an element itself) which consists of both start and end tags< html >< /html >
  22. Empty Elements
    elements with no content are called empty elements
  23. < body >
    • is an element that defines the body of the HTML document
    • has a start and end tag
    • The text between < body > and < /body > is the visible page content
  24. < head >
    • is an element that is a container for all the head elements
    • Elements inside < head > can include scripts, instruct the browser where to find style sheets, provide meta information, and more
  25. what tags can be added to the < head > section
    < title >, < style >, < meta >, < link >, < script >, < noscript >, and < base >
  26. < title >
    • is a tag that defines the title of the document
    • is placed within the < head > element
    • The < title > element is required in all HTML/XHTML documents
    • defines a title in the browser toolbar
    • provides a title for the page when it is added to favorites
    • displays a title for the page in search-engine results
  27. < base >
    • a tag that specifies the base URL/target for all relative URLs in a page
    • placed within the < head > element
    • < base href="http://www.w3schools.com/images/" target=“_blank" >
  28. < link >
    • a tag that defines the relationship between a document and an external resource
    • mostly used to link to style sheets
    • found within the element
    • < link rel="stylesheet" type="text/css" href=“mystyle.css" >
  29. < style >
    • tag is used to define style information for an HTML document
    • Inside the < style > element you specify how HTML elements should render in a browser
    • < style type=“text/css" >
    • body {background-color:yellow;}
    • p {color:blue;}
    • < /style >
  30. < meta >
    • Metadata is data (information) about data
    • The < meta > tag provides metadata about the HTML document
    • Metadata will not be displayed on the page, but will be machine parsable
    • Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata
    • The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services
    • always placed within the < head > element
    • Define keywords for search engines:
    • < meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript” >
    • Define a description of your web page:
    • meta name="description" content="Free Web tutorials on HTML and CSS” >
    • Define the author of a page:
    • < meta name="author" content="Hege Refsnes” >
    • Refresh document every 30 seconds:
    • < meta http-equiv="refresh" content=“30” >
  31. < script >
    • is a tag used to define a client-side script, such as a JavaScript
  32. Attributes
    • defines a property for an element
    • appears within the elements start tag
    • provide additional information about an element
    • Attributes are always specified in the start tag
    • Attributes come in name/value pairs like name=“value”
    • Attribute values should always be enclosed in quotes.
    • Double style quotes are the most common, but single style quotes are also allowed
    • In some rare situations, when the attribute value itself contains quotes, it is necessary to use single quotes: name='John "ShotGun" Nelson’
    • should use lowercase attribute names and values (although they are case insensitive)
  33. class
    Specifies one or more classnames for an element (refers to a class in a style sheet)
  34. The class attribute is mostly used to point to a class in a style sheet. However, it can also be used by a JavaScript (via the HTML DOM) to make changes to HTML elements with a specified class

    Note that this is an important paragraph.

  35. id
    The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
  36. The id attribute is mostly used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id.
    < p id=“makeaname” >
  37. style
    Specifies an inline CSS style for an element
  38. title
    Specifies extra information about an element (displayed as a tool tip)
  39. headings
    • Headings are defined with the < h1 > to < h6 > tags
    • < h1 > defines the most important heading. < h6 > defines the least important heading
    • Browsers automatically add some empty space (a margin) before and after each heading
    • Use HTML headings for headings only. Don't use headings to make text BIG or bold
    • Search engines use your headings to index the structure and content of your web pages
    • Since users may skim your pages by its headings, it is important to use headings to show the document structure
    • H1 headings should be used as main headings, followed by H2 headings, then the less important H3 headings, and so on.
  40. < hr >
    • a tag that creates a horizontal line in an HTML page
    • The hr element can be used to separate content
    • < p >This is a paragraph.< /p >
    • < hr >
    • < p >This is a paragraph.< /p >
    • < hr >
    • < p >This is a paragraph.< /p >
  41. < !-- This is a comment — >
    There is an exclamation point after the opening bracket, but not before the closing bracket
  42. Comments can be inserted into the HTML code to make it more readable and understandable. Comments are ignored by the browser and are not displayed
  43. global attributes
    Any attributes permitted globally.
  44. DOM
    Document Object Model
  45. Semantics
    allowing you to describe more precisely what your content is.
  46. < section >
    is an element that represents a section of a document, typically with a title or heading
  47. < section >
    • < h1>Heading< /h1 >
    • < p>Bunch of awesome content< /p >
    • < /section >
  48. How to View HTML Source
    Have you ever seen a Web page and wondered "Hey! How did they do that?"
  49. To find out, right-click in the page and select "View Source" (IE) or "View Page Source" (Firefox), or similar for other browsers. This will open a window containing the HTML code of the page
  50. < b >
    Defines bold text
  51. < em >
    Defines emphasized text, rendered in browser as italics
  52. < i >
    Defines a part of text in an alternate voice or mood
  53. < small >
    Defines smaller text
  54. < strong >
    Defines important text, rendered in browsers as bold
  55. < sub >
    Defines subscripted text
  56. < sup >
    Defines superscripted text
  57. < ins >
    Defines inserted text
  58. < del >
    Defines deleted text
  59. < mark >
    Defines marked/highlighted text
  60. < code >
    Defines computer code text
  61. < kbd >
    Defines keyboard text 
  62. < samp >
    Defines sample computer code
  63. < var >
    Defines a variable
  64. < pre >
    Defines preformatted text
  65. < abbr >
    Defines an abbreviation or acronym
  66. < address >
    Defines contact information for the author/owner of a document
  67. < bdo >
    Defines the text direction
  68. < blockquote >
    Defines a section that is quoted from another source
  69. < q >
    Defines an inline (short) quotation
  70. < cite >
    Defines the title of a work
  71. < dfn >
    Defines a definition term
  72. CSS
    • Cascading Style Sheets
    • used to style HTML elements
  73. CSS can be added to HTML in 3 ways. Which are
    • Inline - using the style attribute in HTML elements
    • Internal - using the < style > element in the < head > section
    • External - using an external CSS file
    • The preferred way to add CSS to HTML, is to put CSS syntax in separate CSS files
  74. Inline Styles
    An inline style can be used if a unique style is to be applied to one single occurrence of an element
  75. To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property.
    < p style=“color:blue;margin-left:20px;" >This is a paragraph.< /p >
  76. Background Color
    • The background-color property defines the background color for an element
    • < body style=“background-color:yellow;" >
    • < h2 style=“background-color:red;" >This is a heading< /h2 >
    • < p style=“background-color:green;" >This is a paragraph.< /p >
  77. HTML Style Example for Font, Color, and Size
    • A heading

    • A paragraph.

    • The font-family, color, and font-size properties make the old tag obsolete
  78. HTML Style, Text Alignment:
    The text-align property specifies the horizontal alignment of text in an element
  79. < h1 style="text-align:center;">Center-aligned heading< /h1 >
    The text-align property makes the old < center > tag obsolete
  80. Internal Style Sheet
    • can be used if one single document has a unique style.
    • Internal styles are defined in the < head > section of an HTML page, by using the < style > tag, like this
    • < head >
    • < style type=“text/css" >
    • body {background-color:yellow;}
    • p {color:blue;}
    • < /style >
    • < /head >
  81. 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
    • < head >
    • < link rel="stylesheet" type="text/css" href=“mystyle.css" >
    • < /head >
  82. < style >
    defines style information for a document
  83. < link >
    defines the relationship between a document and an external resource
  84. Deprecated Tags and Attributes
    In HTML 4, several tags and attributes were used to style documents. These tags are not supported in newer versions of HTML
  85. Avoid using the elements: < font >, < center >, and < strike >, and the attributes: color and bgcolor
  86. < img >
    • images are defined with the tag
    • The < img > tag is empty, which means that it contains attributes only, and has no closing tag
    • To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display.
    • < img src="url" alt=“some_text" >
    • If an HTML file contains ten images - eleven files are required to display the page right. Loading images takes time, so my best advice is: Use images carefully
    • When a web page is loaded, it is the browser, at that moment, that actually gets the image from a web server and inserts it into the page. Therefore, make sure that the images actually stay in the same spot in relation to the web page, otherwise your visitors will get a broken link icon. The broken link icon is shown if the browser cannot find the image
  87. Where does the browser place an image when using the < img > tag
    The browser displays the image where the tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph
  88. What is the alt attribute
    The required alt attribute specifies an alternate text for an image, if the image cannot be displayed
  89. The value of the alt attribute is an author-defined text
    < img src="smiley.gif" alt="Smiley face” >
  90. What are some reasons for alternate info being shown instead of the image
    • because of slow connection
    • an error in the src attribute
    • if the user uses a screen reader
  91. What attributes are used to specify the size of an image
    • The height and width attributes
    • The attribute values are specified in pixels by default
    • < img src="smiley.gif" alt="Smiley face" width="42" height=“42" >
  92. Why is it a good practice to specify both the height and width attributes for an image
  93. If these attributes are set, the space required for the image is reserved when the page is loaded
    without these attributes, the browser does not know the size of the image. The effect will be that the page layout will change during loading (while the images load)
  94. < map >
    Defines an image-map
  95. < area >
    Defines a clickable area inside an image-map
  96. < tables >
    • Tables are defined with the < table > tag.
    • A table is divided into rows (with the < tr > tag), and each row is divided into data cells (with the < td> tag). td stands for "table data," and holds the content of a data cell. A < td > tag can contain text, links, images, lists, forms, other tables, etc.
  97. Tables and Borders
    • If you do not specify a border attribute, the table will be displayed without borders. Sometimes this can be useful, but most of the time, we want the borders to show.
    • To display a table with borders, specify the border attribute:
    • < table border=“1" >
  98. HTML Table Headers use what tag
    • Header information in a table are defined with the < th > tag.
    • All major browsers display the text in the < th > element as bold and centered
  99. < table >
    Defines a table
  100. < th >
    Defines a header cell in a table
  101. < tr >
    Defines a row in a table
  102. < td >
    Defines a cell in a table
  103. < caption >
    Defines a table caption
  104. < colgroup >
    Specifies a group of one or more columns in a table for formatting
  105. < col >
    Specifies column properties for each column within a element
  106. < thead >
    Groups the header content in a table
  107. < tbody >
    Groups the body content in a table
  108. < tfoot >
    Groups the footer content in a table
  109. What are the most common lists in HTML
    • The most common HTML lists are ordered and unordered lists
    • Inside a list item you can put text, line breaks, images, links, other lists, etc.
  110. < ul >
    • An unordered list starts with the < ul > tag.
    • Each list item starts with the < li > tag.
    • The list items are marked with bullets (typically small black circles).
  111. < ol >
    • an ordered list starts with the < ol > tag
    • each list item starts with the < li > tag
    • the list items are numbered or lettered
  112. < dl >
    • A description list is a list of terms/names, with a description of each term/name.
    • The < dl > tag defines a description list.
    • The < dl > tag is used in conjunction with < dt > (defines terms/names) and < dd > (describes each term/name)
    • < dl >
    • < dt >Coffee< /dt >
    • < dd >- black hot drink< /dd >
    • < dt >Milk< /dt >
    • < dd >- white cold drink< /dd >
    • < /dl >
    • Coffee
    • - black hot drink
    • Milk
    • -white cold drink
  113. < ol >
    Defines an ordered list
  114. < ul >
    Defines an unordered list
  115. < li >
    Defines a list item
  116. < dl >
    Defines a description list
  117. < dt >
    Defines a term/name in a description list
  118. < dd >
    Defines a description of a term/name in a description list
  119. < div >
    The < div > element is a block level element that can be used as a container for grouping other HTML elements.
  120. The < div > element has no special meaning. Except that, because it is a block level element, the browser will display a line break before and after it.
    When used together with CSS, the < div > element can be used to set style attributes to large blocks of content.
  121. Another common use of the < div > element, is for document layout. It replaces the "old way" of defining layout using tables. Using < table > elements for layout is not the correct use of < table >. The purpose of the < table > element is to display tabular data.
    • The < span > element is an inline element that can be used as a container for text.
    • The < span > element has no special meaning.
    • When used together with CSS, the < span > element can be used to set style attributes to parts of the text
  122. Grouping Tags-
    HTML elements can be grouped together with < div > and < span >
  123. < div >
    Defines a section in a document (block-level)
  124. < span >
    Defines a section in a document (inline)
  125. Block Elements
    • Most HTML elements are defined as block level elements or as inline elements.
    • Block level elements normally start (and end) with a new line when displayed in a browser
    • < h1 >, < p >, < ul >, < table >
  126. Inline Elements
    • Inline elements are normally displayed without starting a new line.
    • < b >, < td >, < a >, < img >
  127. Website Layouts
    Most websites have put their content in multiple columns (formatted like a magazine or newspaper)
  128. Multiple columns are created by using < div > or < table > elements. CSS are used to position elements, or to create backgrounds or a colorful look for the pages
    Even though it is possible to create nice layouts with HTML tables, tables were designed for presenting tabular data - NOT as a layout tool!
  129. HTML Layouts Using < div > Elements
    The div element is a block level element used for grouping HTML elements.
  130. HTML Layouts-Using Tables
    • A simple way of creating layouts is by using the HTML < table > tag
    • Multiple columns are created by using < div > or < table > elements.
  131. CSS
    are used to position elements, or to create backgrounds or colorful look for the pages
  132. Using < table > to create a nice layout is NOT the correct use of the element. The purpose of the < table > element is to display tabular data!
  133. HTML Layout Tags
    • < div > -Defines a section in a document (block-level)
    • < span > -Defines a section in a document (inline)
  134. Forms and Input
    • HTML Forms are used to select different kinds of user input.
    • HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.
    • < form >
    • this tag is used to create an HTML form
  135. < input >
    • The most important form element is the < input > element.
    • the input element is used to select user information.
    • can vary in many ways, depending on the type attribute. An < input > element can be of type text field, checkbox, password, radio button, submit button, and more.
  136. Text Fields
    < input type=“text" > defines a one-line input field that a user can enter text into
  137. < form >
    • First name: < input type="text" name=“firstname" >< br >
    • Last name: < input type="text" name=“lastname" >
    • < /form >
    • How the HTML code above looks in a browser:
    • First name: (a box is here)
    • Last name: (a box is here)
    • The form itself is not visible. Also note that the default width of a text field is 20 characters 
  138. Password Field
    • < input type=“password" > defines a password field:
    • < form >
    • Password:
    • < /form >
    • How the HTML code above looks in a browser
    • Password: (with a box here)
    • The characters in a password field are masked (shown as asterisks or circles)
  139. Radio Buttons
    < input type=“radio" > defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices
  140. < form >
    • < input type="radio" name="sex" value=“male" >Male< br >
    • < input type="radio" name="sex" value=“female" >Female
    • < /form >
    • How the HTML code above looks in a browser:
    • (radio button here)Male
    • (radio button here)Female
  141. Checkboxes
    < input type=“checkbox" > defines a checkbox. Checkboxes let a user select ZERO or MORE options of a limited number of choices
  142. < form >
    • < input type="checkbox" name="vehicle" value=“Bike" >I have a bike< br >
    • < input type="checkbox" name="vehicle" value=“Car" >I have a car
    • < /form >
    • How the HTML code above looks in a browser
    • (checkbox here) have a bike
    • (checkbox here) I have a car
  143. Submit Button
    • < input type=“submit" > defines a submit button.
    • is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input
    • < form name="input" action="html_form_action.asp" method=“get" >
    • Username: < input type="text" name=“user" >
    • < input type="submit" value=“Submit” >
    • < /form >
    • How the HTML code above looks in a browser
    • Username: (box here) (submit button here)
    • If you type some characters in the text field above, and click the "Submit" button, the browser will send your input to a page called "html_form_action.asp". The page will show you the received input
  144. < form >
    Defines an HTML form for user input
  145. < input >
    Defines an input control
  146. < textarea >
    Defines a multiline input control (text area)
  147. < label > -Defines a label for an < input > element
  148. < fieldset >
    Groups related elements in a form
  149. < legend >
    Defines a caption for a < fieldset > element
  150. < select >
    Defines a drop-down list
  151. < optgroup >
    Defines a group of related options in a drop-down list
  152. < option >
    Defines an option in a drop-down list
  153. < button >
    Defines a clickable button
  154. < datalist >
    Specifies a list of pre-defined options for input controls
  155. < keygen >
    Defines a key-pair generator field (for forms)
  156. < output >
    Defines the result of a calculation
  157. Iframes
    • An iframe is used to display a web page within a web page
    • < iframe src=“URL” >< /iframe >
    • The URL points to the location of the separate page.
    • The height and width attributes are used to specify the height and width of the iframe
    • The attribute values are specified in pixels by default, but they can also be in percent (like "80%")
    • < iframe src="demo_iframe.htm" width="200" height=“200" >< /iframe >
    • The frameborder attribute specifies whether or not to display a border around the iframe
    • Set the attribute value to "0" to remove the border
    • < iframe src="demo_iframe.htm" frameborder=“0" >< /iframe >
    • An iframe can be used as the target frame for a link.
    • The target attribute of a link must refer to the name attribute of the iframe
    • < iframe src="demo_iframe.htm" name=“iframe_a" >< /iframe >
    • < p >< a href="http://www.w3schools.com" target=“iframe_a" >W3Schools.com< /a >< /p >
  158. < iframe >
    Defines an inline frame
  159. HTML Colors
    • Colors are displayed combining RED, GREEN, and BLUE
    • CSS colors are defined using a hexadecimal (hex) notation for the combination of Red, Green, and Blue color values (RGB)
  160. The lowest value that can be given to one of the light sources is 0 (hex 00).
    • The highest value is 255 (hex FF)
    • Hex values are written as 3 double digit numbers, starting with a # sign. The combination of Red, Green and Blue values from 0 to 255 gives a total of more than 16 million different colors to play with (256 x 256 x 256).
    • Most modern monitors are capable of displaying at least 16384 different colors. Gray colors are displayed using an equal amount of power to all of the light sources rgb(0,0,0) is the darkest grey rgb(256,256,256) is the lightest grey
    • Some years ago, when computers supported max 256 different colors, a list of 216 "Web Safe Colors" was suggested as a Web standard, reserving 40 fixed system colors. This is not important now, since most computers can display millions of different colors, but the choice is left to you
  161. Color Names color names are defined in the HTML and CSS color specification (17 standard colors plus 123 more) The 17 standard colors are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.
  162. < script >
    • JavaScripts make HTML pages more dynamic and interactive
    • The < script > tag is used to define a client-side script, such as a JavaScript. The < script > element either contains scripting statements or it points to an external script file through the src attribute Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content The script below writes Hello World! to the HTML output: < script > document.write("Hello World!") < /script >
  163. < noscript > this tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support client-side scripting The < noscript > element can contain all the elements that you can find inside the < body > element of a normal HTML page The content inside the < noscript > element will only be displayed if scripts are not supported, or are disabled in the user's browser < script >
    • document.write("Hello World!")
    • < /script >
    • < no script >Sorry, your browser does not support JavaScript!
    • Description