Front End Course
Front End Course
HTML
1. HTML Introduction
2. HTML Tags
3. HTML Building Blocks
4. HTML Headings
5. HTML Paragraph
6. HTML Images
7. HTML Anchor
8. HTML Tables
9. HTML Forms
10. HTML Audio
11. HTML Video
12. HTML Comments
13. HTML Formatting
14. HTML List
15. HTML I frames
16. HTML Navigation
17. HTML Favicon
18. HTML Layouts
19. HTML URL Encode
20. HTML TAGS LIST
CSS
1. CSS Introduction
2. CSS Colors
3. CSS Selectors
4. CSS Borders
5. CSS Box Model
6. CSS Display Properties
7. CSS Positions
8. CSS Text Properties
9. CSS Fonts
10. CSS Background Properties
11. CSS Animations
12. CSS Media Queries
13. CSS 3D Animations
JAVA SCRIPT (JS)
1. JS Introduction
2. JS Features
3. JS Variables
4. JS Data Types
5. JS Arrays
6. JS Operators
7. JS Loops
8. JS Functions
9. JS Events
10. JS Dom
11. JS Ajax
12. JS OOPS
13. JS ES-6 Concepts
Front end Development:
- Front-end development (or) creation of user interface (UI) using some Non – Markup language and
other tools.
- It is the development of the user side where only user interaction will be conduct (or) occurs. It
consists of the interface where buttons text alignment and …etc. are involved and used by the user.
(or)
By using front end development we can create the web pages by using different languages.
<html>
<head>
<title> </title>
</head>
<body>
</body>
</html>
HTML
(HYPER TEXT MARKUP LANGUAGE)
1. HTML Introduction
1. HTML Introduction:
- HTML stands for Hyper Text Markup Language.
- By using HTML we can add the content (text, images, tables, fonts ….etc.) to a web page.
- HTML was introduced by Tim Beavers Lee in the year of 1991.
- We can add this types of content by using tags.
Advantages of HTML:
1. All browsers supports HTML files.
2. It is easy to understand and learn.
3. It is useful for all beginners in web designing.
4. The software is available for free.
5. It is widely used.
6. Simple syntax.
Disadvantages of HTML:
1. It takes more time.
2. It is not completely secured.
3. It is only used for static & Plain page.
4. Limited design capability.
Types of HTML:
We have 3 categories of HTML,
1. Transitional type HTML
2. Strict type HTML
3. Frameset type HTML
1. Transitional HTML: It is one the HTML document that allows some presentational markup and
deprecated elements (<font> elements) but not framesets which validates loose HTML Markup.
Syntax:
Syntax:
3. Frameset type HTML: A frameset is the HTML element that defines how a given number of frames are
to be arranged and displayed on a webpage is known as Frameset type HTML.
Doctype HTML:
The Doctype in HTML is a declaration that tells a browser how to interpret & render a document.
Meta:
- A tag which provides information about the document.
- The metadata from Meta tags is not displayed on the rendered webpage.
- The main purpose is to provide information to browsers, search engines and other web services to
display, interrupt and to handle the webpage.
- It is placed within the <head> section of HTML Document.
Uses of Meta tags:
1. Character Encoding: By using charset attribute we can ensure whether the browser interprets the
characters & symbols on the webpage.
Syntax:
2. Viewport Control: Area which content is visible to the user in a webpage is known as Viewport. The
viewport doesn’t have same size, it varies on various screen sizes of devices (Mobile, laptop, Tab,
Desktop, TV…etc.) on which the webpage is visible.
Syntax:
3. Page Description: A page that provides a brief summary of a webpage's content is known as Page
Description. It helps search engines and users understand the page purpose and content.
Syntax:
Syntax:
5. Search Engine Index: It is used to ensure whether search engines should index and follow links on the
page.
Syntax:
Syntax:
7. HTTP-Equiv: It is used to specify instructions for HTTP headers, such as refreshing the page (or) setting
the language.
Syntax:
HTML HTML5
It didn’t support audio and video without the use It supports audio and video controls with the use
of flash player support. of <audio> and <video> tags.
Does not allow JavaScript to run in the browser. Allows JavaScript to run in the background. This
HTML HTML5
It does not allow drag and drop effects. It allows drag and drop effects.
Not possible to draw shapes like circle, rectangle, HTML5 allows to draw shapes like circle,
triangle etc. rectangle, triangle etc.
<HTML>,<Body> , and <Head> tags are These tags can be omitted while writing HTML
mandatory while writing a HTML code. code.
Older version of HTML are less mobile-friendly. HTML5 language is more mobile-friendly.
Doctype declaration is too long and complicated. Doctype declaration is quite simple and easy.
Character encoding is long and complicated. Character encoding is simple and easy.
It is almost impossible to get true GeoLocation of One can track the GeoLocation of a user easily by
user with the help of browser. using JS GeoLocation API.
Being an older version , it is not fast , flexible , It is efficient, flexible and more fast in
and efficient as compared to HTML5. comparison to HTML.
Attributes like charset, async and ping are absent Attributes of charset, async and ping are a part of
in HTML. HTML 5.
2. HTML Tags
HTML Tags
There are two types of tags,
1. Single tags: It has starting tag but no end tag.
ex: <img>,<hr>,<meta>,<link>,<br>…..etc.
1. Tags: An HTML tag is written in between < and > brackets and acts as a container for different types of
content. Each tag has its own specific meaning, and the same applies to the content within it.
2. Attributes: To provide some extra information about a particular element, attributes are used in an
HTML document. An attribute is applied within the start tag of a particular element and contains two
fields: name & value.
3. Elements: An element in an HTML document can be understood as an individual component of an
HTML file. In more simple words, the elements are everything written within tags, including the tags,
attributes, and contents.
Block Level/Block Level Elements: A Block level/line elements that always starts in a new line & the browser
automatically adds some wide space before and after element. It always takes up the full width available.
Ex: <h1> to <h6>,<li> <li>,<ol> <ol>,<ul> <ul>…..etc.
In-line Elements: An In-line element does not starts on new line, It starts always on the same line. It only takes
up as much as width necessary.
Ex: <a><img>….etc.
Div & Span Tags:
Div Tag:
- Div is also known as Division tag.
- It is used as a container for other HTML elements.
- It is block level element.
- It will takes all available width and comes with line breaks before and after the element.
Span Tag:
- This span tag is a In-line container.
- It is used to mark up a part of text (or) part of document.
HTML Headings:
HTML Headings are titles and subtitles which we display on the webpage.
Syntax:
<h1>Heading no. 1</h1>
<h2>Heading no. 2</h2>
<h3>Heading no. 3</h3>
<h4>Heading no. 4</h4>
<h5>Heading no. 5</h5>
<h6>Heading no. 6</h6>
Sample Code:
<html>
<head>
<title>Headings</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
Output:
5. HTML Paragraph
HTML Paragraph:
A paragraph always starts in a new line and it is denoted with <p>. Browsers automatically add same wide
space before and after a paragraph.
Note: If we are using various <p> tags in one HTML file then browser automatically adds a single blank line
between the two paragraphs.
Syntax:
<p>This is first paragraph</p>
<p>This is second paragraph</p>
<p>This is third paragraph</p>
Sample Code:
<html>
<head>
<title>HTML PARAGRAPH</title>
</head>
<body>
<p>A paragraph always starts in a new line and it is denoted with
<p>. Browsers automatically add same wide space before and after a paragraph.
Note: If we are using various
<p> tags in one HTML file then browser automatically adds a single blank line
between the two paragraphs.
</p>
</body>
</html>
Output:
6. HTML Images
HTML Images:
The image tag will be defined with <img> tag. The <img> tag is used to embed an image in an HTML page.
Images are not technically inserted into a web page, images are linked to the web page. The image tag creates
a holding space for the reference image.
The image tag has two required attributes, they are ‘src’ and ‘alt’.
1. src: It specifies the path of the image.
2. Alt: It specifies an alternative text for the image if the image not displayed for some reasons.
Syntax:
Sample code:
<html>
<head>
<title>HTML Images</title>
</head>
<body>
<img src="https://inc42.com/cdn-cgi/image/quality=75/https://asset.inc42.com/
2023/11/flipkart-robbery-featured-.png"
alt="Flipkart" style="width:1360px;height:720px;">
</body>
</html>
Output:
7. HTML Anchor
HTML Anchor:
An anchor tag defines a hyper link which is used to link from one page to another. The anchor tag is
denoted with <a>. The most important attribute of the <a> element is the ‘href’ attribute, which indicates the
links destination.
Syntax:
Sample Program:
<html>
<head>
<title>anchor tag</title>
</head>
<body>
<a href=" http://www.flipkart.com" target="_blank">Flipkart</a><br>
<a href=" https://www.amazon.in" target="_blank">Amazon</a>
</body>
</html>
Output:
8. HTML Table
HTML Table
- HTML tables allow web developers to arrange data into a rows and columns.
- Table tag will denotes with <table> </table>.
There are three major sub tags in HTML Table,
1. <tr> : table row
2. <th> : table heading
3. <td> : table data
Syntax:
<table>
<tr>
<th>heading<th>
<td>data<td>
<tr>
</table>
Sample Program:
<html>
<head>
</head>
<body>
<h1 align="center">TABLE</h1>
<table border="2px" style="border-collapse: collapse;" cellpadding="20px">
<tr>
<th colspan="10 ">TIME TABLE</th>
</tr>
<tr>
<th rowspan="2">DAY</th>
<th>PERIOD'S</th>
<td>P-1</td>
<td>P-2</td>
<td>P-3</td>
<td rowspan="2">12:00PM-1:00PM</td>
<td>P-4</td>
<td>P-5</td>
<td>P-6</td>
<td>P-7</td>
<tr>
<th>TIMING'S</th>
<td>9:30AM-10:20AM</td>
<td>10:20AM-11:10AM</td>
<td>11:10AM-12:00PM</td>
<td>1:00PM-1:50PM</td>
<td>1:50PM-2:40PM</td>
<td>2:40PM-3:30PM</td>
<td>3:30PM-4:20PM</td>
</tr>
</tr>
<tr>
<th>MONDAY</th>
<th rowspan="6"></th>
<td>ENG</td>
<td>MATH</td>
<td>CHEM</td>
<td rowspan="6">L<br>U<br>N<br>C<br>H</td>
<td colspan="3">LAB</td>
<td>PHY</td>
</tr>
<tr>
<th>TUESDAY</th>
<td colspan="3">LAB</td>
<td>ENG</td>
<td>CHEM</td>
<td>MATH</td>
<td>SPORTS</td>
</tr>
<tr>
<th>WEDNESDAY</th>
<td>MATH</td>
<td>PHY</td>
<td>ENG</td>
<td>CHEM</td>
<td colspan="3">LIBRARY</td>
</tr>
<tr>
<th>THURSDAY</th>
<td>PHY</td>
<td>ENG</td>
<td>CHEM</td>
<td colspan="3">LAB</td>
<td>MATH</td>
</tr>
<tr>
<th>FRIDAY</th>
<td colspan="3">LAB</td>
<td>MATH</td>
<td>CHEM</td>
<td>ENG</td>
<td>PHY</td>
</tr>
<tr>
<th>SATUARDAY</th>
<td>ENG</td>
<td>CHEM</td>
<td>MATH</td>
<td colspan="3">SEMINOR</td>
<td>SPORTS</td>
</tr>
</table>
</body>
</html>
Output:
9. HTML Forms
HTML Forms:
- HTML forms is used to collect user input.
- The user Input is most often sent to a server for processing.
- It is usually starts with <form> tag.
- The HTML form element is used to create a form for user input.
- The form element is a container for different types of input elements such as “ text, field, check boxes,
radio button …. etc.“
Input elements:
Syntax:
Sample Code:
<html>
<head>
</head>
<body>
<form align="center">
<fieldset>
<legend>
<h1>Registration Form</h1>
</legend>
<label>NAME:</label>
<input type="text" placeholder="Enter your Name" required=""><br><br>
<label>EMAIL ID:</label>
<input type="email" placeholder="Enter email id" required=""><br><br>
<label>PASSWORD:</label>
<input type="password" placeholder="Enter password" required=""><br><br>
<label>PH.NO:</label>
<input type="tel"><br><br>
<label>AGE:</label>
<input type="number"><br><br>
<label>D.O.B:</label>
<input type="date"><br><br>
<label>GENDER:</label>
<label>Male:</label>
<input type="checkbox">
<label>Female</label>
<input type="radio"><br><br>
<label>URL</label>
<input type="url"><br><br>
<label>HIDDEN</label>
<input type="hidden"><br><br>
<label>IMAGE</label>
<input type="image"><br><br>
<label>NUMBER</label>
<input type="number"><br><br>
<label>RANGE</label>
<input type="range"><br><br>
<label>SEARCH</label>
<input type="search"><br><br>
<label>TIME</label>
<input type="time"><br><br>
<label>COLOUR</label>
<input type="color"><br><br>
<label>COURSES</label>
<select>
<option>select your course</option>
<option>PYTHON</option>
<option>JAVA</option>
<option>UI</option>
</select><br><br>
<label>ADDRESS</label>
<textarea cols="20" rows="5"></textarea><br><br>
<label>CHOOSE FILE</label>
<input type="file"><br><br>
<label>CHECKBOX</label>
<input type="checkbox"> "I hereby declare that all the information
provided in this form is true, complete,
and accurate to the best of my knowledge and belief, and nothing has been
concealed or
misrepresented.".<br><br>
<button>RESET</button>
<button>SUBMIT</button><br><br>
</fieldset>
</form>
</body>
</html>
Output:
10. HTML Audio
HTML Audio:
- 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.
Syntax:
<audio attribute>
<source src=" ">
</audio>
Sample Program:
<html>
<head>
<title>AUDIO TAGS</title>
</head>
<body>
<h1>Audio tag</h1>
<audio controls>
<source src="C:\Users\admin\Downloads\[iSongs.info] 06 - Dammunte
Pattukora.mp3">
</audio>
</body>
</html>
Output:
11. HTML Video
HTML Video:
- The video tag is used to embed video content in a document such as movies or other video streams.
- The video tag contains one (or) more source tags with different video sources.
- The browser will choose the first source it supports.
- In open <video> tag we can add attribute controls.
Syntax:
<video attribute>
<source src=" ">
</video>
Sample Program:
<html>
<head>
<title>VIDEO TAGS</title>
</head>
<body>
<h1>Video tag</h1>
<video controls>
<source
src="C:\Torrents\www.5MovieRulz.dog - Hanuman (2024) TRUE WEB-DL - 4K SDR
- AVC - (DD+5.1 - 192Kbps) [Telugu + Hindi] - 17GB - ESub.mp4">
<video>
</body>
</html>
Output:
12. HTML Comments
HTML Comments:
- HTML comments are notes that add to your HTML code to explain it.
- They are ignored by browser and don’t appear on the page.
- Start the comment with ‘<!--‘ tag.
- End the comment with ‘-->’.
- Add the text between the tags.
Syntax:
Sample Code:
<html>
<head>
<title>comments</title>
</head>
<!--<body>
<p>
- HTML comments are notes that add to your HTML code to explain it.
- They are ignored by browser and don’t appear on the page.
</p>
</body>-->
</html>
13. HTML Formatting
HTML Formatting:
Sample code:
<html>
<head>
<title>FORMATINF TAGS</title>
</head>
<body>
<b>bold tag</b><br>
<strong>Strong tag</strong><br>
<i>italic tag</i><br>
<em>emphasyze</em><br>
<mark>marked</mark><br>
<del>deleted tag</del><br>
<ins>inserted tag</ins><br>
<small>small </small><br>
<p> the chemical formula of water is H<sub>2</sub>O</p><br>
<p>4<sup>2</sup></p>
</body>
</html>
Output:
14. HTML List
HTML List:
HTML list allow web developers to group a set of related items in a list.
1. Ordered list:
An ordered list starts with the <ol> tag and list items starts with <li> tag. The list items marked with by
number by default
Attributes in <ol> tag: “ Numbers, Alphabets upper and lower cases, Roman numbers upper and lower cases. “
Syntax:
<ol>
<li> list of items </li>
</ol>
2. Un ordered list:
An un ordered list starts with <ul> tag and list starts with <li> tag. The list of items marked with by
bullets(Small black circles) by default.
Syntax:
<ul>
<li> list of items </li>
</ul>
Sample Code:
<html>
<head>
<title>LIST</title>
</head>
<body>
<h1>Orderd List</h1>
<ol type="I" start="">
<li>Cycles</li>
<li>Bikes</li>
<li>Cars</li>
<li>Buses</li>
</ol>
<h1>Un Orderd List</h1>
<ul style="list-style-type: square;">
<li>Cycles</li>
<li>Bikes</li>
<li>Cars</li>
<li>Buses</li>
</ul>
</body>
</html>
Output:
15. HTML I Frames
HTML I Frames:
An In line frames is a piece of HTML code (or) HTML element that embed another HTML web page with in
a HTML web page.
Syntax:
<iframe src= " " ></iframe>
Sample Code:
<html>
<head>
</head>
<body>
<iframe src="https://grktraining.com/"
style="width:1360px;height:720px;"></iframe>
</body>
</html>
Output:
16. HTML Navigation
HTML Navigation:
- A navigation bar in HTML is a list of links that helps user navigation a web site.
- It is usually located at the top of the page.
- Navigation bar is detonated by <nav> tag.
Syntax:
<nav>
Sample code:
<html>
<head></head>
<body>
<h1>The nav element</h1>
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/python/">Python</a>
</nav>
</body>
</html>
Output:
17. HTML Favicon
HTML Favicon:
- A Favicon is a small image displayed next to the page title in the browser tab.
- You can add or use any image you like as favicon.
Syntax:
<link rel =“icon” href = “ ……. ” >
Sample Code:
<html>
<head>
<title>FAV ICONS</title>
<link rel="icon" href="C:\Users\admin\Downloads\1384060.png">
</head>
<body>
<h1>Fav icons</h1>
</body>
</html>
Output:
18. HTML Layouts
HTML Layouts:
HTML layouts are a technique used to divide a web page into multiple sections, making it easier to apply
styles, organize content, and manage operations efficiently. This division improves readability, accessibility,
and overall user experience.
- HTML layout has these following sections, “Header section, Navigation bar, Index, Content section,
Footer section.”
- HTML layout is achieved through elements
like <header>, <nav>, <main>, <article>, <section>, <aside>, and <footer> which help organize
content, define the page’s sections.
Syntax:
<header> Content... </header>
<nav> Content... </nav>
<main> Content... </main>
<footer> Content... </footer>
19. HTML URL
HTML URL:
Syntax:
scheme://prefix.domain:port/path/filename
scheme - defines the type of Internet service (most common is http or https)
prefix - defines a domain prefix (default for http is www)
domain - defines the Internet domain name (like w3schools.com)
port - defines the port number at the host (default for http is 80)
path - defines a path at the server (If omitted: the root directory of the site)
filename - defines the name of a document or resource
20. HTML TAGS LIST:
Tag Description
<datalist> New Tag:Together with the a new list attribute for input can be
used to make comboboxes
CSS Introduction:
- CSS is a style sheet language used for specifying the presentation and styling of a
document written in a markup language is such as HTML,XML is known as
CSS(Cascading Style Sheets).
History of CSS:
- The CSS idea was proposed in the year of 1994 by Hakon Wium Lie.
- The 1st version of CSS is invented in the year of 1996.
- The 2nd version of CSS was released in the year of 1998, from that time CSS begin to
work.
- The current version is CSS3 which different from other versions,
- Instead of being a single mono lithic specifications, it was published a set of separate
documents known as Modules.
Advantages:
Disadvantages:
- Cross browser issues.
- Unexpected behavior.
- High chance of confusion.
- Lack of security.
Types of CSS:
1. Inline CSS
2. Internal CSS
3. External CSS.
1. Inline CSS:
2. Internal CSS:
ex: <head>
<style>
h3{
color: green;
}
</style>
</head>
Syntax: <head>
<link ref=”stylesheet” href=”heading.css”>
</head>
ex: <head>
<link rel="stylesheet"
href="C:\Users\admin\OneDrive\Desktop\FRONTEND\selectors.css">
</head>
CSS Colors:
- To apply colors for foreground element (or) background elements we will use color
properties.
1. Hex Code: A hexadecimal is a 6 digit representation of a color. The first two digits RR
represent a red value, the next two are a green value GG, and the last are the blue value
BB. Each hexadecimal code will be preceded by a pound or hash sign '#'.
2. Short Hex Codes: This is a shorter form of the six-digit notation. In this format, each digit
is replicated to arrive at an equivalent six-digit value.
Here is the list of 216 colors which are supposed to be most safe and computer
independent colors. These colors vary from Hexa code 000000 to FFFFFF. These
colors are safe to use because they ensure that all computers would display the
colors correctly when running a 256 color palette
CSS Selectors:
CSS selectors are used to select the HTML elements that you want to style is known as CSS
selectors.
1. Simple Selector: The simple selector will select the elements based on name, id, class and
universal.
1. Name based selector: This selector selects the HTML element based on the element
name (tags name).
Syntax:
element name{
CSS properties
}
Sample code:
<html>
<head>
<title>SIMPLE selectors</title>
<style>
h1 {
color: red;
text-align: center;
}
</style>
</head>
<body>
<div>
<h1>Name based selector</h1>
<p>This is paragraph</p>
<h2>This is h2</h2>
</div>
</body>
</html>
Output:
2. ID based selector:
Syntax:
ID Attribute{
CSS properties
}
Sample code:
<html>
<head>
<title>SIMPLE ID based selectors</title>
<style>
#paragraph {
color: purple;
text-align: center;
}
</style>
</head>
<body>
<div>
<h1 id="paragraph">ID based selector</h1>
<p>This is paragraph</p>
<h2>This is h2</h2>
</div>
</body>
</html>
Output:
- The class based selector selects HTML elements with a specific class attribute.
- The class selector is denoted with dot (.).
Syntax:
Class Attribute{
CSS properties
}
Sample code:
<html>
<head>
<body>
<div>
<h1>This is h1</h1>
<p>This is paragraph</p>
<h2 class="header">Class based selector</h2>
</div>
</body>
<html>
Output:
>
4. Universal selector:
- The universal selector selects all the HTML elements in the page.
- The universal selector
*{
CSS properties
}
Sample Code:
<html>
<head>
<title>Simple Universal selectors</title>
<link rel="stylesheet" href="C:\Users\admin\OneDrive\Desktop\
FRONTEND\selectors.css">
<style>
* {
color: red;
text-align: center;
}
</style>
</head>
<body>
<div>
<h1>Universal selector</h1>
<p>This is paragraph</p>
<h2>This is h2</h2>
</div>
</body>
</html>
Output:
2. Combinator selector:
1. Child selector
2. Descendent selector.
3. Adjacent sibling selector/Next sibling selector
4. General sibling selector/Sub sequent sibling selector.
1. Child selector:
- The child selector will applies the styles to the selected elements, if the selected
elements was direct child.
- The child selector is denoted with greater-than (>).
Syntax:
selector1>selector2 {
CSS properties
}
Sample Code:
<html>
<head>
<title>Child selector</title>
<style>
div>h1{
color: violet;
text-align: center;
}
</style>
</head>
<body>
<div>
<p>vehicle names</p>
<h1>car</h1>
<h2>bus</h2>
<h3>bike</h3>
<h4>tain</h4>
<p>Fruits names</p>
<h1>mango</h1>
<h5>apple</h5>
</div>
</body>
</html>
Output:
Note: The selected element must have the same parent.
2. Descendent selector:
- The descendent selector will applies the styles to the selected elements in the same
parent, if the selected elements was direct child or indirect child.
- The child selector is denoted with space ( ).
Syntax:
selector1 selector2 {
CSS properties
}
Sample Code:
<html>
<head>
<title>Decendent selector</title>
<style>
div>h1 {
color: red;
text-align: center;
font-weight: bold
}
</style>
</head>
<body>
<div>
<h1>vehicle names</h1>
</p>
<h1>car</h1>
<h2>bus</h2>
<h3>bike</h3>
<h4>tain</h4>
<h1><p>Fruits names</p></h1>
<h1>mango</h1>
<h5>apple</h5>
</div>
<div>
<p>Fruits names</p>
</div>
<p>Fruits names</p>
</body>
</html>
Output:
3. Adjacent sibling selector/Next sibling selector (Immediately following):
The Adjacent sibling selector/Next sibling selector that helps in selecting an element
i.e..... immediately followed by another element where both elements have the same
parent element. It is denoted with plus (+).
Syntax:
selector1+ selector2 {
CSS properties
}
Sample Code:
<html>
<head>
<title>Adjacent sibling selector</title>
<style>
h1 + h2{
color: #009900;
text-align:center;
font-size: 20px;
}
</style>
</head>
<body>
<div>
<h1>adajecant selector</h1>
<h2>this is h2 tag</h2>
<p>parent Element</p>
<p>sub child</p>
</div>
<div>
<h1>adajecant selector</h1>
<h2>this is h2 tag</h2>
<p>parent Element</p>
<p>sub child</p>
</div>
</body>
</html>
Output:
4. General sibling selector/Sub sequent sibling selector:
The General sibling selector/Sub sequent sibling selector selects all elements that are next
siblings of a specified element. It is denoted with tilde (~).
Syntax:
selector1~ selector2 {
CSS properties
}
Sample Code:
<html>
<head>
<title>General sibling selector</title>
<style>
h1~h2{
color: #009900;
text-align:center;
font-size: 20px;
}
</style>
</head>
<body>
<div>
<h1>general sibling selector</h1>
<h2>this is h2 tag</h2>
<h2>This is new h2 tag</h2>
<p>parent Element</p>
<p>sub child</p>
</div>
<div>
<h1>general sibling selector</h1>
<h2>this is h2 tag</h2>
<p>parent Element</p>
<p>sub child</p>
</div>
</body>
</html>
Output:
3. Pseudo Class Selectors:
- A Pseudo class selector is used to define a special state of an element (or) used to
apply styles based on its state.
- It is represented in single colon (:).
1) :link
2) :visited
3) :hover
4) :active
5) :focus
6) :target
7) :First child
8) :last child
Syntax:
selector: pseudo class-name{
property: value;
}
Sample Code:
<html>
<head>
<title>Pseudo class selectors</title>
<style>
a:visited {
color: black;
}
a:active {
color: yellow;
}
a:hover {
color: blue;
font-size: 20px;
}
input:focus {
background-color: rgb(189, 237, 18);
}
h1:first-child {
color: red;
}
p:last-child {
color: purple;
}
:target {
border: 2px solid violet;
}
</style>
</head>
<body>
</body>
</html>
Output:
4. Pseudo Element Selector:
Syntax:
selector:: pseudo element-name{
property: value;
}
1) ::first letter
2) ::before
3) ::after
4) ::first line
5) ::selection
Sample Code:
<html>
<head>
<title>PSEUDO ELEMENT SELECTORS</title>
<style>
h1::first-letter {
color: red;
text-transform: uppercase;
}
h1::before {
color: violet;
content: "This is ";
}
h1::after {
color: blue;
content: " heading";
}
h1::first-line {
color: green;
}
p::selection {
color: deeppink;
background-color: black;
}
</style>
</head>
<body>
<!--The below line code is for the first-letter, before, after,
first-line selectors -->
<h1>first</h1>
<!--The below line code is for the first-letter, before, after,
first-line selectors.
(note: The selection selector styles can be seen when we select
the text that styles we applied)-->
<p>Create a separate CSS file with a .css extension and link this
file to your HTML file using the link tag. It
consider the best practice to add CSS into HTML File.Create a
separate CSS file with a .css extension and link
this file to your HTML file using the link tag. It consider the
best practice to add CSS into HTML File.</p>
</body>
</html>
Output:
5. Attribute Selector:
Attribute selectors are used to style to the elements based on attribute & attribute value.
Syntax:
selector: [attribute = “value”]{
property: value;
}
1) [attribute = “value”]
2) [attribute ~= “value”]
3) [attribute |= “value”]
4) [attribute ^= “value”]
5) [attribute $= “value”]
6) [attribute *= “value”]
Syntax:
selector: [attribute = “value”]{
property: value;
}
2) [attribute ~= “value”]: This selector is used to select elements with an attribute value
containing a specified word.
Syntax:
selector: [attribute~= “value”]{
property: value;
}
3) [attribute |= “value”]: This selector is used to select elements with specified attribute whose
value can be exactly the specified value (or) the specified value followed by hyphen(-).
Syntax:
selector: [attribute|= “value”]{
property: value;
}
4) [attribute ^= “value”]: This selector is used to select elements with specified attribute,
whose value starts with the specified value.
Syntax:
selector: [attribute^= “value”]{
property: value;
}
5) [attribute $= “value”]: This selector is used to select elements whose attribute value ends
with a specified value.
Syntax:
selector: [attribute$= “value”]{
property: value;
}
6) [attribute *= “value”]: This selector is used to select elements whose attribute value
contains a specified value.
Syntax:
selector: [attribute*= “value”]{
property: value;
}
Sample Code:
<html>
<head>
<style>
h1[title="para"] {
color: red;
}
h2[title~="parag"] {
color: green;
}
h3[title|="par"] {
color: purple;
}
h4[title^="para"] {
color: blue;
h5[title$="graph"] {
color: deeppink;
font-size: 20px;
}
h6[title*="a"] {
color: brown;
font-size: 20px;
}
</style>
</head>
<body>
<h1 title="para">This is first heading</h1>
<h1 title="paragraph">This 2nd first heading</h1>
</html>
Output:
4. CSS Borders
CSS Borders:
The border property specifies what kind of border to display.
Sample Code:
<html>
<head>
<title>borders</title>
<style>
div {
text-align: center;
border: 2px solid black;
padding-left: 30px;
padding-right: 30px;
padding-top: 20px;
margin: auto;
margin-top: 30px;
font-style: italic;
}
h1 {
border: solid;
font-size: 20px;
font-style: italic;
}
h2 {
border: dotted;
font-size: 20px;
font-style: italic;
}
h3 {
border: dashed;
font-size: 20px;
font-style: italic;
}
h4 {
border: double;
font-size: 20px;
font-style: italic;
}
h5 {
border: groove;
font-size: 20px;
font-style: italic;
}
h6 {
border: ridge;
font-size: 20px;
font-style: italic;
}
p {
border: inset;
font-size: 20px;
font-style: italic;
font-weight: bold;
}
#x {
border: outset;
font-size: 20px;
font-style: italic;
font-weight: bold;
}
#y {
border: none;
font-size: 20px;
font-style: italic;
font-weight: bold;
}
#y {
border: hidden;
font-size: 20px;
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<div>
<h1>solid border</h1>
<h2>dotted border</h2>
<h3>dashed border</h3>
<h4> double border</h4>
<h5>groove border</h5>
<h6>ridge border</h6>
<p>inset border</p>
<p id="x">outset border</p>
<p id="y">none border</p>
<p id="z">hidden</p>
</div>
</body>
</html>
Output:
5. CSS Box model
Box model:
This CSS box model is essentially a box that grasps around every HTML elements.
It consists of,
1. Content
2. Padding
3. Border
4. Margin
1. Content: The content of the box where the will text & images appear.
2. Padding: It clears an area around the content, this padding is transparent.
3. Border: A border that goes around the padding and content.
4. Margin: It clears an area outside the border, the margin is transparent.
Sample Code:
<html>
<head>
<title>box model</title>
<style>
div {
border: 2px solid red;
width: 600px;
height: 100px;
padding-left: 300px;
padding-top: 20px;
margin: auto;
margin-top: 300px;
}
</style>
</head>
<body>
<div>
<h1>This is h1 tag</h1>
</div>
</body>
</html>
Output:
Box Model Layout:
Total element width = width + left padding + right padding + left border + right border
Total element height = height + top padding + bottom padding + top border + bottom border
6. Display properties
Display properties:
- The display property is used to specify hoe an element is shown on a web page.
- Every HTML element has a default display value depending upon what type of element.
- The default display value for most elements is block (or) inline.
- The display property is used to change the default display behavior of HTML elements.
Syntax:
1. Value Description
table-column-
Set the behavior as <column> for all elements.
group
table-header-
Set the behavior as <header> for all elements.
group
table-footer-
Set the behavior as <footer> for all elements.
group
1. Inline: Displays an element as an inline element (like <span>). Any height and width
properties will have no effect. This is default.
2. Block line: Displays an element as a block element (like <p>). It starts on a new line, and
takes up the whole width.
3. Float: The float property specifies whether an element should float to the left, right &
none.
4. Flex: The flex property is used to create one dimensional layouts (either
row/column).Flex property is a short hand property.
flex-direction: row
flex-direction: row-reverse
flex-direction: column
flex-direction: column-reverse
3. Flex-wrap = wrap, no wrap, wrap-reverse
flex-wrap: wrap;
flex-wrap: nowrap;
flex-wrap: wrap-reverse;
Child Properties:
1. order-integers
2. Flex-grow-number
Flex-grow : 2;
3. Flex-shrink-number
Flex-shrink : 2;
4. Flex-basis-length/auto
5. Flex-flex-grow/flex-shrink
6. Align-self-auto/flex-start/f-end/f-center/baseline/stretch
Grid: The grid layout module offers a grid based layout system with rows and columns. The grid
layout module allows developer to easily create complex layouts.
Grid properties:
1. grid-area
2. Grid-items
3. Grid- template areas
4. Grid -container
5. Grid-template columns
6. grid-template rows
Sample Code:
<html>
<head>
<title>grid layout</title>
<style>
.section1 {
grid-area: header
}
.section2 {
grid-area: menu;
}
.section3 {
grid-area: main;
}
.section4 {
grid-area: right;
}
.section5 {
grid-area: footer;
}
.grid-container {
display: grid;
grid-template-areas:
'header header header header header header'
'menu menu main main right right'
'menu menu footer footer footer footer';
gap: 10px;
padding: 20px;
background-color: green;
}
.grid-container>div {
background-color: white;
font-size: 30px;
padding: 30px 0px;
text-align: center;
font-style: italic;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="section1">Header</div>
<div class="section2">Menu</div>
<div class="section3">Main</div>
<div class="section4">Right</div>
<div class="section5">Footer</div>
</div>
</body>
</html>
Output:
7. CSS Positions
CSS Positions:
The Position property specifies the type of positioning method used for an elements.
There are 5 different types of position values,
1. Static
2. Relative
3. Fixed
4. Absolute
5. Sticky
Note: Top, Bottom, Left & right properties will not work without positioning property.
1. Static: The static position of elements will not effected by top, bottom, left & right
properties. The static position elements will not be displayed in special way.
2. Relative: An element with relative position is positioned to its normal position. Top,
bottom, right & left properties of a relative positional elements will be adjusted away
from its normal position. Other content will not be adjusted to fit into any gap left by
the element.
3. Fixed: An element with fixed position is positioned relative to the view port which
means it always stays in the same place even if the page is scrolls.
5. Sticky: An element with sticky position is positioned based on the users scroll position.
Sample Code:
<html>
<head>
<style>
div{
border: 2px solid red;
height: 700px;
width: 600px;
position: relative;
}
h1{
border: 2px solid green;
position: absolute;
height: 400px;
width: 300px;
top: 100px;
right: 50px;
}
</style>
</head>
<body>
<div>
this is div tag
<h1>relative position</h1>
</div>
</body>
</html>
Output:
8. CSS Text Properties
1. Text color
2. Text alignment
3. Text decoration
4. Text transformation
5. Text spacing
6. Text shadow
1. Text color: The color property is used to set the color for the text. We can give color
properties to the text as color name, color code & rgb.
2. Text alignment: The text alignment property is used to set the horizontal alignment of
text.
3. Text decoration: The text decoration property is used to add a decoration to the text.
1. Text - decoration.
2. Text - decoration – line
3. Text – decoration color
4. Text – decoration style
5. Text – decoration thickness
4. Text transformation: The text transformation property is used to specify upper case &
lower case letters in a text.
5. Text spacing: The text spacing property is used to create a space between letters of
words.
1. Text indent
2. Letter spacing
3. Line height
4. Words spacing
5. White space- wrap/no wrap
6. Text shadow: The text shadow property acts shadow to the text. In its simplest use only
specify horizontal shadow & vertical shadow.
Sample Code:
<html>
<head>
<title>Text properties</title>
<style>
h1 {
color:white;
background-color: green;
text-align: center;
text-decoration-line:overline line-through underline ;
text-decoration-color: white;
text-decoration-style: dashed;
text-decoration-thickness: 2px;
text-transform: lowercase;
text-shadow: 2px 2px 3px red, 0px 0px 5px red, 0px 3px 3px
red;
}
p{
text-align-last:right;
direction: ltr;
unicode-bidi: bidi-override;
text-indent: 50px;
letter-spacing: 10px;
line-height: 40px;
word-spacing: 20px;
white-space: wrap;
}
</style>
</head>
<body>
<h1>TEXT PROPERTIES</h1>
<p>A paragraph is defined as “a group of sentences or a single
sentence that forms a unit” (Lunsford and Connors
116). Length and appearance do not determine whether a section in
a paper is a paragraph. For instance, in some
styles of writing, particularly journalistic styles, a paragraph
can be just one sentence long.A paragraph is
defined as “a group of sentences or a single sentence that forms
a unit” (Lunsford and Connors 116). Length and
appearance do not determine whether a section in a paper is a
paragraph. For instance, in some styles of
writing, particularly journalistic styles, a paragraph can be
just one sentence long.A paragraph is defined as
“a group of sentences or a single sentence that forms a unit”
(Lunsford and Connors 116). Length and appearance
do not determine whether a section in a paper is a paragraph. For
instance, in some styles of writing,
particularly journalistic styles, a paragraph can be just one
sentence long.</p>
</body>
</html>
Output:
9. CSS Fonts
CSS Fonts:
- It allows to customize font style of webpages using various font related.
- The font property is used to style and adjust type of text used in webpage.
In CSS there are five generic font families:
1. Serif fonts: These fonts have a small stroke at the edges of each letter. They create a
sense of formality and elegance.
2. Sans-serif fonts: These fonts have clean lines (no small strokes attached). They create a
modern and minimalistic look.
3. Monospace fonts: Here all the letters have the same fixed width. They create a
mechanical look.
The Background properties are used to add background effects for elements.
We have some properties for background properties,
1. Background color
2. Background image
3. Background position
4. Background size
5. Background attachment
6. Background repeat
Sample Code:
<html>
<head>
<title>Background properties</title>
<style>
body {
background-image:
url("https://img.freepik.com/free-vector/geometric-gradient-futuristic-
background_23-2149116406.jpg");
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Output:
11. CSS Animations
CSS Animations:
CSS allows animation for HTML elements without using java script. Animation property is a
short hand property.
We have some properties for Animations,
1. Animation name
2. Animation duration
3. Animation delay
4. Animation iteration count
5. Animation direction
6. Animation filmode
7. Animation play state
8. @ keyframes
Sample Code:
<html>
<head>
<title>Animation</title>
<style>
.box {
height: 200px;
width: 200px;
background-color: red;
animation-name: x;
animation-duration: 10s;
animation-delay: 1s;
animation-direction: alternate;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
}
@keyframes x {
20% {
background-color: blue;
border-radius: 20%;
40% {
background-color: green;
border-radius: 40%;
transform: translateX(400px);
60% {
background-color: purple;
border-radius: 60%;
transform: translateY(400px);
80% {
background-color: orange;
border-radius: 80%;
transform: translateX(400px);
}
100% {
background-color: rgba(162, 0, 255, 0.84);
border-radius: 100%;
transform: translateY(400px);
}
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
Output:
12. CSS Media Queries
A media queries consists of a media type and can contain one(or)more features which resolve
to either true(or)false.
Major important keyword in media queries are,
@media screen
Sample Code:
<html>
<head>
<style>
@media screen {
body {
background-color: black;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Output:
For Desktop:
For Laptop:
For Tab:
For Mobile:
13. CSS 3D-Animations
CSS 3D-Animations:
Translate: The translate property allows you to change the position of an element. The
translate property define x and y co-ordinates of an element in 2D. You can also define the z co-
ordinates to change the position in 3D.
Sample Code:
<html>
<head>
<title>#D Aimations</title>
<style>
.child1 {
height: 600px;
width: 800px;
border: 2px solid;
margin: 200px;
position: relative;
}
.child1 img {
height: inherit;
width: inherit;
}
.child2 {
height: inherit;
width: 400px;
color: white;
position: absolute;
top: 0px;
background-color: rgba(128, 128, 128, 0.333);
transform: perspective(400px) rotateX(0deg);
transition: all 3s;
transform-origin: left;
}
.child1:hover .child2 {
transform: perspective(400px) rotateX(360deg);
}
</style>
</head>
<body>
<div class="x">
<div class="child1">
<img src="C:\Users\admin\OneDrive\Desktop\IMG.png">
<div class="child2">
<p>CSS was released (in 1996), 3 years after HTML (in
1993). The main idea behind its use is, it allows
the separation of content (HTML) from presentation
(CSS). This makes websites easier to maintain and
more flexible.</p>
</div>
</div>
</div>
</body>
</html>
Output:
JAVA SCRIPT
(JS)
1. JS Introduction
Java Script:
JavaScript is a high-level, interpreted programming language primarily used to create
interactive and dynamic content on websites. It runs in the browser and enables client-side
behavior like form validation, animations, interactive maps, and more. Current version of java
script is ES-6.
ECMA International:
- It is an industry association founded in 1996, dedicated to the standardization of
information and communication systems is known as ECMA International.
ES – 1 1997
ES – 5 2009 (Lots of New Features)
ES – 6 (ES 2015) 2015 (Biggest update for JS)
Note: Java and Java Script both are different programming languages nothing is common.
2. JS Features
Java Script Features:
3. JS Variables
Variables:
- Variables are used to store data which can be changed (or) used when we need is
known as Variables.
- There are Keywords to declare a variable.
- It is a container.
Sample Program:
<script>
var x=10
var y=15
z=x+y
console.log(z)
console.log(x+y)
document.write(x+5 + "<br>")
document.write(z)
alert(z)
</script>
4. JS Data Types
Data Types:
- Data types are used to specify that what type of data that we have given is known as
Data Types.
Sample Program:
<script>
var x=10
console.log(x)//10
console.log(typeof(x))//number
</script>
2. String: The Data type that has series of characters that are surrounded by quotes is
known as String.
Sample Program:
<<script>
var x="HELLO"
console.log(x)//HELLO
console.log(typeof(x))//String
var y='HOW ARE YOU'
console.log(y)//HOW ARE YOU
console.log(typeof(y))//String
</script>
3. Boolean Data Type: The Data Type which allows only two values True (or) False is
known as Boolean.
Sample Program:
<script>
var x=20
var y=10
var z=x>y
console.log(z)//True
console.log(typeof(z))//Boolean
</script>
4. Null: The data type that defies special value that represents nothing (or) empty value is
known as Null.
Sample Program:
<script>
let age = null;
console.log(age)//null
console.log(typeof (age))//object
</script>
5. Undefined: When a variable is declared but not initialized with value is automatically
assigned the undefined value is known as Undefined.
Sample Program:
<script>
let age;
console.log(age)//undefined
</script>
1. Array: A special kind of data of an object used to store an ordered collection of values
which can be any data type is known as Array.
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
console.log(x)// (4) [1, 3.6, 'HI', 'Hello']
console.log(typeof (x))//Array
</script>
Output:
2. Object: The data type in used to store key-value pairs, where each key is a string (or
Symbol) and the value can be any data type is known as Object.
Sample Program:
<script>
let names = {
type: "Company",
location: "Noida"
}
console.log(names)//{type: 'Company', location: 'Noida'}
console.log(typeof (names))//object
</script>
Output:
5. Arrays
Arrays:
- A special kind of data of an object used to store an ordered collection of values which
can be any data type is known as Array.
- It is a Non-Primitive Data type.
- We can declare an array as,
var x =[]
var x = new array()
Ex: x [2]
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
var y = new Array(1, 3.6, 'HI', "Hello")
console.log(x)// (4) [1, 3.6, 'HI', 'Hello']
console.log(typeof (x))//Array
console.log(y)
//Accessing an array using index value
console.log(x[3])//Hello
</script>
Output:
<script>
var x = [1, 3.6, 'HI', "Hello"];
//Accessing an array using index value
console.log(x[3])//Hello
console.log(x[0])
</script>
Output:
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
//Accessing first element of an array
let first = x[0]
console.log("First Item: ", first)//Hello
</script>
Output:
3. Accessing last Element of an Array:
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
//Accessing last element of an array
let last = x[x.length - 1]
console.log("First Item: ", last)//Hello
</script>
Output:
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
console.log(x)
Output:
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
console.log(x)
Output:
6. Removing Elements from an Array:
Sample Program:
<script>
var x = [1, 3.6, 'HI', "Hello"];
console.log(x)
Output:
7. Array Length:
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
console.log(x)
// Array Lenmgth
let arrlenth = x.length
console.log("Array Length is: " + arrlenth)
</script>
Output:
8. Decrease and Increase the length of an Array:
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
console.log(x)
Output:
9. Iterating Through Array Elements:
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
console.log(x)
Output:
10. Array Concatenation:
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
let y = ["Good Morning", "Good Night"];
console.log(x)
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
let y = ["Good Morning", "Good Night"];
console.log(x)
Output:
12. Array type:
Sample Program:
<script>
let x = [1, 3.6, 'HI', "Hello"];
let y = ["Good Morning", "Good Night"];
console.log(x)
Output: