Professional Documents
Culture Documents
Coding Study Guide PDF
Coding Study Guide PDF
HTML Fundamentals
● The <noscript> tag defines an alternate content to be displayed to users that have
disabled scripts in their browser or have a browser that doesn't support script.
● The <link> tag defines the relationship between the current document and an external resource.
○ The <link> tag is most often used to link to external style sheets or to
add a favicon to your website.
○ The <link> element is an empty element, it contains attributes only.
2. CSS Fundamentals
2.1 Analyze and implement inline styles, internal (embedded) style sheets, and
external style sheets
● When to use inline styles, internal (embedded) style sheets,or external style sheets;
precedence when using a combination of inline styles and style sheets
○ With an external style sheet, you can change the look of an entire website by
changing just one file!
■ Each HTML page must include a reference to the external style sheet file
inside the <link> element, inside the head section.
● The <link> tag defines the relationship between the current document
and an external resource.
● The <link> tag is most often used to link to external style sheets or
to add a favicon to your website.
● The <link> element is an empty element, it contains attributes only.
○ An internal style sheet may be used if one single HTML page has a unique style.
■ The internal style is defined inside the <style> element, inside the head section.
■ Internal styles are defined within the <style> element,
inside the <head> section of an HTML page
○ An inline style may be used to apply a unique style for a single element.
■ To use inline styles, add the style attribute to the relevant element.
The style attribute can contain any CSS property.
■ Inline styles are defined within the "style" attribute of the relevant element
■ An inline style loses many of the advantages of a style sheet
(by mixing content with presentation). Use this method sparingly.
● Please understand how to attach an external stylesheet to your webpage for the certification.
● A <style> tag is used for internal style sheets.
● ID selectors target an element that has a specific value for its id attribute:
○ an ID selector is a name preceded by a hash character (“#”).
○ Attribute selectors give you different ways to select elements based on the
presence of a certain attribute on an element:
● For example: a[title] { } would probably apply its conditions on
an <a> element with a title attribute, in which the
<a> anchor element is used to create hyperlinks in an HTML document.
○ You can even make a selection based on the presence of an attribute with a
particular value:
● For example: a[href="https://example.com"]{} would probably apply its conditions
on an <a> element with the specific value href matching "https://example.org”
○ The <a> tag defines a hyperlink, which is used to link from one page
to another.
<a href="https://www.w3schools.com">
<img border="0" alt="W3Schools" src="logo_w3s.gif" width="100" height="100">
</a>
○ Pseudo-classes are selectors that select elements that are in a specific state
and styles certain states of an element.
● For example: The :hover pseudo-class in a:hover { } for example selects an
element only when it is being hovered over by the mouse pointer.
○ Pseudo-elements select a certain part of an element rather than the element itself.
● For example, the ::first-line in p::first-line { } always selects the first line of text
inside an element ( <p>), acting as if a <span> was wrapped around
the first formatted line and then selected.
● Table tags (table, tr, th, td), h1-h6, p, br, hr, div, span, ul, ol, li
○ Table Cells are defined by a <td> and a </td> tag.
■ td stands for table data.
■ Everything between <td> and </td> are the content of the table cell.
○ Table Rows start with a <tr> and end with a </tr> tag.
■ tr stands for table row.
○ Table Headers sometimes you want your cells to be table header cells. In those cases use the <th> tag
instead of the <td> tag:
■ th stands for table header.
○ HTML tables can have cells that span over multiple rows and/or columns.
■ To make a cell span over multiple rows, use the rowspan attribute:
● The value of the rowspan attribute represents the number of rows to span.
■ To make a cell span over multiple columns, use the colspan attribute
● The value of the colspan attribute represents the number of columns to span.
3.2 Construct and analyze markup that uses HTML5 semantic elements
● Semantic tags (header, nav, section, article, aside, footer, details, summary, figure, caption)
● Semantic HTML tags define the meaning of the content they contain.
○ tags like <header>, <article>, and <footer> are semantic HTML tags. They clearly indicate the role of
the content they contain.
■ Most browsers will display the <footer> element with the following default values:
● display: block;
○ On the other hand, tags like <div> and <span> are typical examples of non-semantic HTML elements
and serve only as content holders given no indication as to what type of content they contain
■ The <div> element is a block-level element
■ A <span> element which is used to color a part of a text
■ Note: The <article> element does not render as anything special in a browser. However, you
can use CSS to style the <article> element.
■ Most browsers will display the <article> element with the following default values:
● display: block;
○ The <aside> tag defines some content aside from the content it is placed in.
■ The aside content should be indirectly related to the surrounding content.
■ Note: The <aside> element does not render as anything special in a browser. However, you can
use CSS to style the <aside> element (see example below).
■ Most browsers will display the <aside> element with the following default values:
● display: block;
○ The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
■ While the content of the <figure> element is related to the main flow, its position is independent
of the main flow, and if removed it should not affect the flow of the document.
■ Most browsers will display the <figure> element with the following default values:
● display: block;
● margin-top: 1em;
● margin-bottom: 1em;
● margin-left: 40px;
● margin-right: 40px;
○ A file path describes the location of a file in a web site's folder structure.
■ For simple folder hierarchies, the folder name needs to precede the webpage name in a
hyperlink if the folder is below the webpage in the hierarchy of the website.
■ However, if the folder is above the webpage in the hierarchy, two dots and a backslash need to
be placed in front of the folder name.
● A relative link is a hyperlink located within the same website from the HTML document
from where the link originates.
○ The target attribute specifies where the linked document will open when the link is clicked.
■ _blank opens the linked document in a new window or tab
■ _self opens the linked document in the same frame as it was clicked (this is default)
■ _parent opens the linked document in the parent frame
■ _top opens the linked document in the full body of the window
■ framename opens the linked document in the named iframe
■ The <map> element contains a number of <area> elements, that define the clickable areas in
the image map.
■ The <map> tag doesn’t require attributes for latitude and longitude.
○ Creating bookmarks in Html can be useful if a webpage is very long.
● Form attributes, action, method, submission methods, input types and restrictions, select, textarea, button,
option, label
○
● The HTML Label tag can be associated to a form-control either by nesting the control within it or by matching
the value of the label's for attribute to the value of a control's id attribute.
○ The Label tag is necessary to showcase what the field represents on the form you are creating and
ultimately displaying
■ The content that goes inside of a label should:
● Be visible.
○ A label can be clicked or tapped to focus its input.
■ The extra space it provides to interact with the input is beneficial because
it increases the tap or click target.
○ The lack of a semantic label and input combination makes it much harder for all sorts of people to
complete forms.
■ An input with a type="submit" does not need a label — the value attribute acts as the accessible
label text instead.
■ <input type="submit">
● <input type="submit"> defines a button for submitting form data to a form-handler.
● The form-handler is typically a server page with a script for processing input data.
○ The form-handler is specified in the form's action attribute:
■ <input type=”button”>
● An input with a type="button" does not need a label — the value attribute acts as the
accessible label text instead.
■ <input type="color">
■ <input type="date">
● All date and time controls can be constrained using the min and max attributes, with
further constraining possible via the step attribute (whose value varies according to input
type).
●
●
■ <input type="datetime-local">
■ <input type="email">
● You can use the multiple attribute in combination with the email input type to allow
several email addresses to be entered in the same input (separated by commas)
● You can also use the step attribute to set the increment increase and decrease caused
by pressing the spinner buttons.
● To allow float numbers, specify step="any"
● If omitted, the step value defaults to 1, meaning only whole numbers are valid.
■ <input type="file">
■ <input type="month">
■ <input type="number">
● With the number input type, you can constrain the minimum and maximum values
allowed by setting the min and max attributes.
■ <input type="password">
● <input type="password"> defines a password field:
● The characters in a password field are masked (shown as asterisks or circles).
■ <input type="radio">
■ <input type="range">
■ <input type="search">
■ <input type="tel">
■ <input type="text">
● <input type="text"> defines a single-line text input field:
■ <input type="time">
● All date and time controls can be constrained using the min and max attributes, with
further constraining possible via the step attribute (whose value varies according to input
type).
■ <input type="url">
■ <input type="week">
■ <meter>
■ <progress>
■ <select>
■ <textarea>
■ The global attributes are attributes that can be used with all HTML elements: These are global
attributes:
● The class attribute specifies one or more classnames for an element (refers to a class in
a style sheet)
● The data-* attribute is used to store custom data private to the page or application
● The dir attribute specifies the text direction for the content in an element
● The enterkeyhint attribute specifies the text of the enter-key on a virtual keyboard
● The hidden attribute specifies that an element is not yet, or is no longer, relevant
● The inert attribute specifies that the browser should ignore this section
● The spellcheck attribute specifies whether the element is to have its spelling and
grammar checked or not
● The translate attribute specifies whether the content of an element should be translated
or not
■ The action attribute defines the action to be performed when the form is submitted.
● Usually, the form data is sent to a file on the server when the user clicks on the submit
button.
● Tip: If the action attribute is omitted, the action is set to the current page.
■ The target attribute specifies where to display the response that is received after submitting the
form.
■ The method attribute specifies the HTTP method to be used when submitting the form data.
● The form-data can be sent as URL variables (with method="get") or as HTTP post
transaction (with method="post").
● The default HTTP method when submitting form data is GET.
■ The autocomplete attribute specifies whether a form should have autocomplete on or off.
● When autocomplete is on, the browser automatically complete values based on values
that the user has entered before.
■ The accept-charset attribute specifies the character encodings used for form submission
■ The enctype attribute specifies how the form-data should be encoded when submitting it to the
server (only for method="post")
■ The rel attribute specifies the relationship between a linked resource and the current document
■ The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients
and servers.
● HTTP works as a request-response protocol between a client and server
● HTTP Methods:
○ GET
■ One of the two most common
■ GET is used to request data from a specified resource.
■ can be cached
■ remain in the browser history
■ can be bookmarked
■ should never be used when dealing with sensitive data
■ have length restrictions
■ less secure compared to POST because data sent is part of the URL
● Never use GET when sending passwords or other sensitive
information!
■ Parameters remain in browser history
■ Only ASCII characters allowed in terms of data type
■ Data is visible to everyone in the URL
■ are only used to request data (not modify)
○ POST
■ One of the two most common
■ The data sent to the server with POST is stored in the request
body of the HTTP request
■ are never cached
■ calling a POST request repeatedly have side effects of creating the same
resource multiple times.
■ Always use POST if the form data contains sensitive or personal
information!
■ No restrictions on data type.
● Binary data is also allowed
■ Parameters are not saved in browser history
■ do not remain in the browser history
■ cannot be bookmarked
■ POST is a little safer than GET because the parameters are not stored in
browser history or in web server logs
■ Data is not displayed in the URL
■ have no restrictions on data length
● can be used to send large amounts of data.
■ Data will be re-submitted if website is reloaded and alerts the user that
the data are about to be re-submitted
○ PUT
■ used to send data to a server to create/update a resource.
■ PUT requests are idempotent.
● calling the same PUT request multiple times will always produce
the same result.
○ DELETE
■ The DELETE method deletes the specified resource.
● The <form> tag is used to create an HTML form for user input.
○ Form controls can be grouped by enclosing them with the fieldset element.
■ The fieldset tag allows a user to group fields on a form to make the form user-friendly.
● It defines a box around a set of fields.
○ The <form> element can contain one or more of the following form elements:
■ <input>
● The <input> tag specifies an input field where the user can enter data and can be
displayed in several ways, depending on the type attribute. (Button, checkbox, color,
data, datetime-local, email, file, hidden, image, month number password, radio range,
reset, search, submit, tel, text, time, url, & week.)
■ <textarea>
● The <textarea> tag defines a multi-line text input control and is often used in a form, to
collect user inputs like comments or reviews.
● The size of a text area is specified by the cols and rows attributes (or with CSS).
■ <button>
● The <button> tag defines a clickable button.
■ <select>
● The <select> element is used to create a drop-down list and is most often used in a
form, to collect user input.
● The name attribute is needed to reference the form data after the form is submitted (if
you omit the name attribute, no data from the drop-down list will be submitted).
● The id attribute is needed to associate the drop-down list with a label.
● The <option> tags inside the <select> element define the available options in the
drop-down list.
■ <option>
● The <option> tag defines an option in a select list.
● <option> elements go inside a <select>, <optgroup>, or <datalist> element.
● There are two ways to create option tags:
○ they can be individual option tags
○ They can be grouped into group option tags.
■ <optgroup>
● The <optgroup> tag is used to group related options in a <select> element (drop-down
list).
● Group option (optgroup) tags take individual option tags and group them in similar
groups to make options easy to read.
●
■ <fieldset>
● The <fieldset> tag is used to group related elements in a form.
● The <fieldset> tag draws a box around the related elements.
■ <label>
● The <label> tag defines a label for several elements: checkbox, color, date,
datetime-local, email, file, month, number, password, radio, range, search, tel, text, time,
url, week, <meter>, <progress>, <select>,<textarea>.
○
■ <output>
● The <output> tag is used to represent the result of a calculation (like one performed by a
script).
○ The for attribute specifies the relationship between the result of the calculation,
and the elements used in the calculation.
○ The form attribute specifies which form the output element belongs to.
○ The name attribute specifies a name for the output element.
■ With images, the img tag is used to indicate an image on a webpage and the source (src)
attribute is used to define the location of the image.
■ If this image is in the same folder as the page itself, the file name is all that is needed.
● Otherwise, the path to the file needs to be defined
.
■ If the image is on the same website but in an images folder adjacent to the file, the path needs
to have the folder name, a backslash, and then the file.
4.2 Construct and analyze markup that plays video and audio
■ Tip: It is a good practice to always include a title attribute for the <iframe>. This is used by
screen readers to read out what the content of the iframe is.
● for screen readers
■ Use the height and width attributes to specify the size of the iframe.
● The height and width are specified in pixels by default
● you can also add the style attribute and use the CSS height and width properties
● The <track> tag can be used to add closed captioning or subtitles to a video.
○ The <track> element is used as a child of an <audio> or <video> element and adds a time-based data
source to the parent media element.
■ For example, the <track> element can be used to add timed subtitles to a video and closed
captions to audio content.
○ This element is used to specify subtitles, caption files or other files containing text, that should be
visible when the media is playing.
■ The default attribute specifies that the track is to be enabled if the user's preferences do not
indicate that another track would be more appropriate
■ The kind attribute specifies the kind of text track
■ The label attribute specifies the title of the text track
■ The src attribute is required & specifies the URL of the track file
■ The srclang attribute specifies the language of the track text data (required if kind="subtitles")
■
● The <audio> tag is used to embed sound content in a document, such as music or other audio streams.
○ The <audio> tag contains one or more <source> tags with different audio sources. The browser will
choose the first source it supports.
○ The text between the <audio> and </audio> tags will only be displayed in browsers that do not support
the <audio> element.
○ There are three supported audio formats in HTML: MP3, WAV, and OGG.
○ Some usable attributes:
■ The autoplay attribute specifies that the audio will start playing as soon as it is ready
■ The controls attribute specifies that audio controls should be displayed (such as a play/pause
button etc)
■ The loop attribute specifies that the audio will start over again, every time it is finished
■ The muted attribute specifies that the audio output should be muted
■ The preload attribute specifies if and how the author thinks the audio should be loaded when the
page loads
■ The src attribute specifies the URL of the audio file
● The <source> tag is used to specify multiple media resources for media elements, such as <video>, <audio>,
and <picture>.
○ The srcset attributes contain the path to the image to display and is required when <source> is used in
<picture>. It will specify the URL of the image to use in different situations.
○ The <source> tag allows you to specify alternative video/audio/image files which the browser may
choose from, based on browser support or viewport width.
■ The browser will choose the first <source> it supports.
○ Media accepts any valid media query that would normally be defined in a CSS
■ The media attribute accepts any valid media query that would normally be defined in a CSS
■ The sizes attribute specifies image sizes for different page layouts
■ The src attribute is required when <source> is used in <audio> and <video> & specifies the URL
of the media file
■ The srcset attribute is required when <source> is used in <picture> & specifies the URL of the
image to use in different situations.
■ The type attribute specifies the MIME-type of the resource
○ Relative
■ An element with position: relative; is positioned relative to its normal position.
■ Setting the top, right, bottom, and left properties of a relatively-positioned
element will cause it to be adjusted away from its normal position.
■ Other content will not be adjusted to fit into any gap left by the element.
○ Fixed
■ An element with position: fixed; is positioned relative to the viewport,
which means it always stays in the same place even if the page is scrolled.
The top, right, bottom, and left properties are used to position the element.
■ A fixed element does not leave a gap in the page where it would
normally have been located.
○ Absolute
■ An element with position: absolute; is positioned relative to the
nearest positioned ancestor (instead of positioned relative to the viewport,
like fixed).
■ However; if an absolute positioned element has no positioned ancestors,
it uses the document body, and moves along with page scrolling.
■ Absolute positioned elements are removed from the normal flow,
and can overlap elements.
○ Sticky
■ An element with position: sticky; is positioned based on the user's
scroll position.
■ A sticky element toggles between relative and fixed,
depending on the scroll position. It is positioned relative until a given
offset position is met in the viewport - then it "sticks" in place (like position:fixed).
5.3 Construct and analyze styles that format backgrounds and borders
● border-color, border-style, border-width, background properties, colors
5.4 Construct and analyze styles that create a simple responsive layout
● Units of measurement (percentages, pixels, em, vw, vh), viewport and media query, frameworks and templates,
working with breakpoints, grids
○ Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set
breakpoints wherever you want to pause debugger execution.
■ For example, you may want to see the state of code variables or look at the call stack at a
certain breakpoint.
6.1 Construct well-formed HTML and CSS markup that conforms to industry best practices
● Reusing rules and rule sets, commenting, web-safe fonts, cross-platform usability, separation of structure
(HTML) and style (CSS)
○ The /* */ comment syntax is used for both single and multiline comments.