week 5 Flashcards
intro to HTML
- Hypertext Markup Language
- markup language for creating web pages and applications
- contains elements and attributes, that web browsers parse in order to render the content of the webpage
- structure and content of a webpage is defined
HTML5
- DOCTYPE declaration
- character encoding (charset) declaration , converts bytes to characters
- features to embed audio and video files on the web page and provides the support to run JavaScript in the background
common HTML tags
- <div>: defines a "division of the page"
</div> - <p>: defines a paragraph
</p> - <span>: an inline tag for grouping text or elements</span>
- <b>: bold text</b>
- <i>: italicized text</i>
- </i></b></span></p><h1><b><i>, <h2>, … </h2><h6>: these are headings, h1 is largest and h6 is smallest</i></b>
- <br></br>: line break
- : defines a table. defines a table row, </h6> defines a table cell, and is used for table headers
- <img></img>
- <ol>: an ordered list. <li> to list items.
</li></ol> - <ul>: an unordered list. <li> to list items.
</li></ul> - <a>: makes a hyperlink</a></li></ul></li></ol></i></b></h1></div>
HTML5 non semantic elements
- not related to the content on the web page
<div><span></span></div>
HTML5 semantic elements
- used to define the content and on the webpage
: defines a thematic grouping of content
: represents a section of content that forms an independent part of a document or site such as Forum post, Blog post, Newspaper article, etc.
: specifies a header for a document or section
: define the footer for a document or section. contains information about the author of the document, copyright information, links to terms of use, contact information, etc.
: major navigation blocks that specify a set of navigation links
: identify content that is related to the primary content of the web page
: describes some flow content, optionally with a caption, that is self-contained and referenced as a single unit from the main flow of the document
: add the visual explanation / caption of the image
: used to add details that user can view or hide
: used to highlight or mark the text
: defines a obvious heading for a details element
: used to add a date/time
HTML5 audio tag
- element used to embed audio in a web page
- element defines sound content and it has a controls attribute that adds audio controls, like play, pause, and volume. Any text within the and displayed on the browser only if the audio was not supported by the browser.
- element defines the media resources for the audio files and it has attributes such as src and type. The src is used to specify the file format of the audio content and type specifies the media types that element supports.
file format ==== media type
MP3 ==== audio/mpeg
OGG ==== audio/ogg
WAV ==== audio/wav
HTML5 video tag
- element used to embed a video on a web page, such as a movie clip or other video streams.
- any text between the and tags will be displayed in browsers that do not support the element.
attribute; value; description
- src; URL; Specifies the URL of the video file
- controls; controls; Specifies the video controls such as a play/pause button, etc
- height; pixels; Sets the height of the video player
- width; pixels; Sets the width of the video player
format ==== MIME-type
MP4 ==== video/mp4
WebM ==== video/webm
Ogg ==== video/ogg
starting HTML documents
- – : metadata. for character encoding
- – : actual content of page to be shown on screen
elements (HTML)
- provide the structure of the document
- defined within HTML files using tags (ex. <div> </div>, <img></img>)
- may be nested within other elements
- tags must be properly nested to be valid
attributes (HTML)
- key/value pairs that give metadata about the tag that are important for the browser to know
- ex. <img></img>
global attributes (HTML)
can be applied to any element on the page
- class
- id
- hidden
- lang
- style
- tabindex
- title
HTML form
- a section of a document that contains controls such as text fields, password fields, checkboxes, radio buttons, submit button, menus, etc.
- using these elements the page can collect information from a user which is typically submitted to a web server.
- tag used to create forms
attributes used in HTML forms
for use on tag and elements
- action: indicates where the form data will be processed
- target: used to specify whether the submitted result will open in the current window (is default), a new tab (set to “blank”) or on a new frame
- name: should be provided for each input element
- method: used to specify the HTTP method used to send data while submitting the form
- —- GET: form values will be visible in the address bar of the browser
- —- POST: form values will NOT be visible in the address bar of the browser
- value: specifies an initial value for an input field. also serves as the attribute to use when providing a button label for submit and reset input elements.
- placeholder: specifies a hint that describes the expected value of the input field (a sample value or a short description of the expected format). short hint is displayed in the input field before the user enters a value. works with the following input types: text, search, url, tel, email, and password.
- required: indicates an input field that must be filled out before submitting the form. works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.
- min and max: specify the minimum and maximum values for an input field. work with the following input types: number, range, date, datetime-local, month, time and week.
input elements in HTML forms
specify an addition type attribute to indicate which field to display
- text field: one-line input field that allows the user to input a line of text. created by specifying the type attribute value as “text”.
- password field: type of text field in which the text entered is masked using asterisk or dots. created by specifying the type attribute value as “password”. not encrypted.
- radio buttons: let the user select exactly one value from a list of predefined options. created by specifying the type attribute value as “radio”.
- checkboxes: let the user select one or more values from a pre-defined set of options. type attribute value for checkboxes input control is “checkbox”.
- file select boxes: allow the user to select a local file on their computer and send it as an attachment to the webserver or write path and name of file. created by specifying a type attribute value as “file”.
- text area: multi-line text input control which allows users to provide a paragraph or multiple lines of text. It is created by using the “textarea” element. DO NOT use the element. use attributes “rows” and “cols” to control size of text area.
- select boxes (drop downs): allow users to select one or more options from a drop-down list. created by using two elements: and .
- reset and submit buttons:
- —– submit button allows the user to send the form data to the web server. specify the type attribute as “submit”.
- —– reset button is used to reset the form data and will display any default values. specify the type attribute as “reset”.
inline and block elements
- block level elements will render on new lines in blocks by default
- inline elements render within the line itself
CSS
- cascading style sheets
- language for styling HTML documents by specifying certain rules for layout and display in key/value pairs
- simple and powerful method of allowing attachment of rendering information to HTML documents
- used to style the webpages by setting background-color, font color, font size, font family, etc.
- style rule composed of selectors and declarations
selectors: an HTML element
declarations: comprised of a property and a value surrounded by curly braces
types of CSS
- inline: contains the CSS property in the body section attached with element. specified within an HTML tag using style attribute.
- internal / embedded: used when a single HTML document must be styled uniquely. CSS rule set should be within the HTML file in the head section
- external: separate CSS file which contains only style property with the help of tag attributes. CSS property written in a separate file with .css extension and should be linked to the HTML document using link tag.
element selector
selects HTML elements by their name / tag name like a, h1, div, p etc.
CSS properties
- border: allows to style the border area of a box. include “border-width”, “border-style”, “border-color”
- padding: set the padding area for an element that separates its border from its content. can take up to 4 values.
- margin: sets the margins around the sides of an element’s box. can take up to 4 values.
- display: sets whether an element is treated as a block or inline elements and the layout used for its children, such as flow layout, flex or grid.
- —- inline level elements: used to create a short structure that can have data and other inline elements. include <b>, <big>,< i>, <small>, <tt>, <abbr>, <acronym>, <code>, <strong>, etc.</strong></code></acronym></abbr></tt></small></big></b>
- —- block level elements: used to create larger structures than inline elements also it starts on new lines by default. include <p>, </p><h1>, </h1><h2>, </h2><h3>, </h3><h4>, </h4><h5>,</h5><h6>, <ol>, </ol><ul>, </ul><pre>, <address>, <blockquote>, <dl>, <div>, , , <hr>, , etc .
- position: defines how an element will be arranged on a page. property values are static, relative, absolute, fixed, or inherit.
- color: used to specify the foreground color of text
- text align: used to align the content inside the element. left, right, center, justify.</div></dl></blockquote></address></pre></h6></strong></code></acronym></abbr></tt></small></big></b>
class selector
- a name preceded by a period (“.”)
- uses the class attribute of an HTML element to match the specific HTML element
id selector
- a name preceded by a hash character (“#”)
- uses the id attribute of an HTML element to match the specific HTML element
- id of an element should be unique within a page, so the id selector is used to select one unique element
amazon S3
- object storage service that offers industry-leading scalability, data availability, security, and performance
- store any type of file in S3
- each individual object is put into a bucket, connect to Amazon S3 using a URL.
- URL will have name of object and the name of bucket. The bucket is just the container to put objects in.
- use REST API to connect to S3 using a URL.
- browser does a HTTP PUT request and it puts the objects in the bucket.
create AWS S3 bucket
- bucket name: unique across all of Amazon S3, between 3 to 63 characters long, not contain uppercase characters, start with lowercase letter or number
- uncheck “block public access” setting
JavaScript
- ECMAScript
- client-side scripting language
- high-level, multi-paradigm, interpreted programming language used to create dynamic webpages
- internal js: javascript code placed anywhere within the HTML page using tags
- external js: JavaScript code placed in a separate file from the HTML code. files are saved with the “. js” extension and imported into the HTML page using the src attribute
JS syntax
- comments: single line “//” or multi lines “/* */”
- literals: fixed values. can be numbers, strings, boolean values, etc.
- keywords: tokens that have special meaning in JavaScript. ex: break, case, catch, continue, do, else, finally, for, function, if, in, new, return, switch, this, throw, try, typeof, var, void, while, etc.
JS variables
- used to store data values
- uses the var keyword to declare variables
- starts only with the alphabet, underscores (_) or dollar ($)
- cannot start with a number and also there shouldn’t be spaces in-between.
JS operators
- performs some operation on single or multiple operands and produces a result
Arithmetic operators - +, -, *, /, %, ++, –
Comparison Operators - ==, ===, !=, >, =, <=
Logical Operators - &&, ||, !
Assignment Operators - =, +=, -=, *=, /=, %=
Ternary Operator - ? : ;