HTML 5
HTML 5
Basic </>
● an attribute name
● an equal = sign
● a value surrounded by quotation marks “value”
<html lang=”en-US”>
…..
</html>
Attribute href Example
<a href = “https://www.google.com”> Go To google.com </a>
Attribute title Example
<a href= “#link” title = “I serve as a tooltip”> Link </a>
Attributes id and class
</p>
Internal Style Sheet
p{
Font-size : 14px;
</style>
Inline Styling
<head>
</head>s
Text Font-Family Example
<h1 style = “ font-family : Times New Roman ”> I am a Times New Roman
</h1>
<center>
<h1> I am a centered heading . </h1>
<p> I am a centered paragraph. </h1>
<img src = “images/example.jpg” />
</center>
Alternative - Center Elements
<p style = “ text-align: left ”> HTML paragraph aligned left </p>
<p style = “ text-align: center ”> HTML paragraph aligned center </p>
<p style = “ text-align: right ”> HTML paragraph aligned right </p>
Styling HTML Paragraphs
● HTML Links are very necessary for all web pages. All web sites have
links. HTML Links are hyperlinks
Internal Links
● <a href = “file-in-the-same-folder”> Example </a>
External Links
● <a href= “https: //www.wikipedia.org” >Wikipedia </a>
Opening Link in New Tab
● <a href= “htts://www.wikipedia.org” target= “_blank”> Wikipedia</a>
HTML Line Break <br />
It always starts on a new line and takes the full width available.
● <h1> - <h6>
● <p>
● <div>
Here is a list of HTML5 Elements that work similarly with the <div>
● <nav> : defines a navigation list or bar
● <header> : defines a header
● <main> : main content
● <footer> : defines a footer
<div> Example
<p>
<span style=”font-size: 30px”>I</span>
<span style=”color: blue”>am a paragraph</span>
<span style=”color:green”> and my world are using</span>
<span style=”color:orange”> different style with span</span>
</p>
HTML Images
<img src=”example.jpg”/>
We use attribute src to specify an image’s url or file path and attribute alt
to define the image if the image doesn’t exist
<img src = “example.jpg” alt=”I am alternate text for the image”/>
Image Sizing (width and height)
<img src = “example.jpg” width=”100” height=”100”/>
Floating Image (Left or right)
<p>
<img src=”images/star.png “ style=”float:left; width = 50px;height 50px”>
The Image is float left . The Image is float left ….. </p>
<p>
<img src=”images/star.png “ style=”float:right; width = 50px;height 50px”>
The Image is float left . The Image is float left ….. </p>
Image as a link
<a href=”http://www.google.com”>
<img src=”google.jpg” />
</a>
Image in Another Folder
JavaScript (JS) is a scripting language used to make a web page dynamic and
more interactive.
JS is a commonly used for form validation, dynamic content, effects and
image manipulation.
● <script type= “text/javascript”> …….</script>
● <script src= “my-script.js” ></script>
JavaScript Examples
● Alert Box
● Dynamic Content Example
● Dynamic Styles Example
● Hiding and Showing Example
● Dynamic Image Example
HTML Forms
HTML forms can be used to collect user data ,make login form, registration
form , a search form, a contact form etc.
<form> </form>
Forms Attributes
GET POST
label {
border-radius: 5px;
background: #428bca;
color: #fff;
padding: 5px;
Margin-right: 3px;
}
HTML5 Input Types
Text
<img src = “” alt = “The image file will be shown here.” id = “result” />
function readFile( ){
reader.onload = function(e){
document.getElementById(‘result’).src = e.target.result;
reader.readAsDataURL(file);
</script>
Hidden
<input type= “radio” name= “gender” value = “Male” id= “male” />
<label for = “male” > Male </label> <br>
<input type = “radio” name= “gender” value = “Female” id = “female” />
<labe for = “female” >Female </label> <br>
<button onclick = “getRadioValue()” > Get Value </button>
Con’t
<script type = “text/javascript”>
function getRadioValue(){
if( radios[i].checked){
alert(radios[i].value);
</script>
Con’t
Index 0 Index 1
Number of Radios = 2
Range
textarea{
background-color: #f3f3f3;
color: #d9534f;
border: none;
outline: none;
resize: none;
</style>
HTML Dropdown List
var value = [ ];
if(options[i].selected){
value.push(options[i].value);
alert(JSON.stringnify(value));
}
HTML5 Forms Elements Attributes
● autocapitalize
● autocomplete
● autofocus
● disabled
● max
● maxlength
● min
● minlength
Con’t
● multiple
● name
● pattern
● placeholder
● readonly
● required
● spellcheck
● wrap
Attribute autofocus
<label>
The input below only allow allow a maximum of 5 characters
<input type= “text” maxlength = “5”/>
</label>
Attribute min
● multiple
● name
● pattern
● placeholder
● readonly
● required
● spellcheck
● wrap
Attribute multiple
<p> After submitting the form below the pagehandler can get the value of
the input by referring to its name. </p>
<form action = “page-handler.html”>
<input type = “text” name= “demo”/>
<input type = “submit” />
</form>
Attribute pattern
<p> Try to fill the text field with a non-alphanumeric value then submit the
form.
<form action = “page-handler.html”>
<input type = “text” patter= “[a-zA-Z0-9]+” title = “alphanumeric
only”/>
<input type = “submit” />
</form>
Attribute placeholder
<input type = “text” value = “ I can only read but not edited” readonly />
<textarea readonly>
I can only be read and selected but not edited
</textarea>
Attribute required
● Buttons
● HTML Content Editable
● HTML Meta
● HTML Blockqoute
● HTML nbsp
● HTML Subscript Text
● HTML Superscript Text
● Pre Element
Con’t
● Figures
● Character Entities
● Audios
● Videos
● Iframe
● YoutubeVideos
CSS
CSS
● Cascading Stylesheet
● A Stylesheet language used to describe the presentation of an HTML
● CSS describes how elements should be rendered on screen.
Con’t
● CSS Syntax
● CSS Selectors
● CSS Comments
● CSS Inserting
○ Internal Style Sheet
○ External Style Sheet
○ Inline Styling
● CSS Colors
CSS Syntax:
Selector {
property : value ;
property : value ;
property : value ;
}
CSS Module 2
● CSS Backgrounds
○ background-color
○ background-image
○ background-repeat
○ background-attachment
○ background-position
● CSS Borders
● CSS Margins
● CSS Paddings
● CSS Width and Height
CSS Module 3
● Box Models
● Text
● Fonts
● Icons
● Links
Box Model
Text
● Text Color
● Text Align
● Text Transform
● Text Indent
● Text Decoration
● Text Shadow
● Letter Spacing
● Word Spacing
● Line Height
● Text Direction
CSS Fonts
● Font Family
● Font Size
● Font Style
● Font Weight
● Font Variant
CSS Icons
● Lists
● Tables
● Outline
● Buttons
● Images
CSS Module - 5
● Combinators
● Pseudo-classes
● Pseudo-elements
● Attrubute Selectors
● Opacity
● Rounded Corner
● Border Images
CSS Module - 7
● CSS 3 Transitions
● CSS 3 Animations
● CSS 3 Multiple Columns
● CSS 3 User Interface
CSS Module - 9
● Navbar
● Dropdown
● Footer
● Pagination
● Breadcrumbs
● Tooltips
CSS Module - 11
● Lightbox
● Image Gallary
● Accordion
● Counter
● CSS Columns
Javascript
● JS Clock
● JS Stopwatch
● JS Note Project
● JS Live User Filter
JS Module - 1
● Display Output
● Statement
● Syntax
● Comments
● Variables
● Datatypes
JS Module - 2
● Operators
● Arithmetic Operators
● Assignment Operators
● Comparison Operators
● Logical & Conditional Operators
JS Module - 3
● Functions
● Objects
● Strings
● String Methods
● Numbers
● Number Methods
JS Module - 4
● Arrays
● Array Methods
● Array Sorting
● Array Iteration
JS Module - 5
● Events
● Math Object
● Math Random
● Conditional Statement - if … else
● Conditional Statement - switch
JS Module - 6
● For Loop
● For Of Loop
● While Loop
● Break and Continue
JS Module - 7
● Variable Scope
● Variable Hoisting
● Strict Mode
● let
● const
JS Module - 9
● Dates
● Date Formats
● Date Get Methods
● Date Set Methods
JS Module - 10
● this Keyword
● Arrow Function
● Classes
● JSON
JS Module - 11
● Form
● Form Inputs
● Reserved Keywords
DOM - Document Object Model
● DOM Introduction
● DOM Selectors
● DOM Nodes
● DOM Navigation
● DOM HTML
● DOM CSS or Styling
● DOM Effects
● DOM Events
Document Object Model ( DOM )
With JS, we can select any element from the DOM tree using the document
object.
Why do we select elements?
● To get their content.
● To change their content.
● To style them.
● To get or change their attribute.
● To remove them and many more …
Select the Topmost Elements
The topmost elements can be selected directly from the document object
properties.
● document.documentElement selects <html>
● document.head selects <head>
● document.body selects <body>
Let’s check VS Code!
Other Select Elements
● Select an Element By ID
● Select Elements by Class Name
● Select Elements by Tag Name
● Select Elements by Name
● Select Elements Using CSS Selectors
DOM Nodes
The nodes in the DOM tree have relationships with each other.
We use the terms parent, child and sibling to describe their relationships.
Let’s take a look at out example DOM tree again:
Con’t
Con’t
Even the text inside the elements are considered as nodes, they are called
text nodes.
Therefore:
● “The Title” is a child of <title>
● “A Header” is a child of <h1>
● “A Paragraph” is a child of <p>
Note! In a Document Object Model tree, everything is a node.
JS Navigating Nodes
● firstElementChild
● lastElementChild
● children
Siblings
● previousElementSibling
● nextElementSibling
JavaScript DOM HTML
In this lesson, we will study about the amazing things that we can do to
HTML using the DOM.
● Getting Element’s Content
● Replacing Element’s Content
● Creating Elements ( Nodes )
● Inserting to Elements
● Removing Elements
Working With Attributes
With JavaScript and DOM, we can get,set and change an attribute’s value.
● Getting Attribute Value
● Setting or Changing Attribute Value
JS DOM CSS or Styling
With css, javascript and DOM we can create effects that can be applied to
elements
● Fading Effects
● Fade Out
● Fade In
● Sliding Effect
JavaScript DOM Events
With JavaScript and DOM , we can listen to events that happen to elements.
For example, we can listen then do something when a button is clicked.
The addEventListener( ) Method
The addEventListener() method sets up a function that will be called
whenever the specified event is fired to the element.
Con’t
element.addEventListener(eventType,listenerFunction)
● Click Event
● Load Event
● Change Event
BOM - Browser Object Model
What is the BOM?
The back() method loads the previous page from the history list.
If you want to try this method, go to console and type “history.back()”
The forward() Method
The forward() method loads the next page from the history list. If you want
to try this method: go to console and type “history.forward()”
JS BOM Navigator
The window.navigator object represents the state and the identity of the
user’s browser.
Just like other window properties, it can be accessed without the window
prefix.
The navigator object contains the following properties:
platform, language , appName , appCodeName , appVersion , userAgent ,
onLine
JS BOM Pop-up Box
Add an expiry date ( in UTC ) so that it does not get closed when the
browser is closed.
document.cookie = “firstName=John”;
expires=Mon, 21 Apr 2025 12:00:00 UTC”
Getting a Cookie Value
Document.cookie = “firstName=Jane”;
Delete a Cookie
document.cookie = “firstName=;age=0”;
Boostrap
What is Boostrap?