SlideShare a Scribd company logo
1 of 24
HTML, CSS,
JAVASCRIPT
For Beginners
Prakriti Dhang
22-06-2020
HTML
Hyper Text Markup Language
HTML
• Abbreviation for Hyper Text Markup Language
• Is the standard markup language for creating web pages.
• Easy to understand
• Well Organized
• Front-end programming language
• saved with a .html extension
HTML elements
• HTML elements has starting tag, contents and closing tag
<tagname> content </tagname>
• The closing tag ends with a backslash (/).
• The start tag and close tag name should be same.
• <h1> content </h1>
HTML elements
• <!DOCTYPE html> defines that this document is an
HTML5 document.
• <html> element is the root element of an HTML page
• <head> element contains meta information about the
HTML page
• <title> element specifies a title for the HTML page (shown
in the browser's title bar)
• <body> element defines the document's body.
• The <h1> element defines a large heading
• The <p> element defines a paragraph
Body elements
• Body tag contains all the visible contents,
 Headings (h1-h6),
 Paragraphs,
 Images,
 Hyperlinks,
 Tables,
 Lists, etc.
Example
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 1</title>
• </head>
• <body>
• <h1> WELCOME! </h1>
• <p>Welcome to my first page.</p>
• </body>
• </html>
CSS
Cascading Style Sheet
CSS
• CSS Stands for Cascading Style Sheets
• Easy to understand
• Well Organized
• Front-end programming language
• saved with a .css extension when use external CSS.
CSS syntax
h1 {
color: yellow;
text-align: center;
}
• <h1> is the selector in CSS.
• Color is the property and yellow is the value.
• Text-align is the property and center is the value
Ways to insert CSS
• There are 3 ways to insert CSS:
1. Internal: The internal style is defined inside the
<style> element, inside the head section.
2. External: Can be written in any text editor, and
must be saved with a .css extension. The external
.css file should not contain any HTML tags.
3. Inline: add the style attribute to the element. The
style attribute can contain any CSS property.
Internal CSS
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 1 </title>
• <style>
• body {
• background-color: lightgreen;
• }
• h1 {
• color: yellow;
• text-align: center;
• }
• p {
• font-family: Arial;
• font-size: 20px;
• font-style:italic;
• }
• </style>
• </head>
• <body>
• <h1> WELCOME! </h1>
• <p>Welcome to my first page.</p>
• </body>
• </html>
External CSS
In Example.html
<!DOCTYPE html>
<html>
<head>
<title>Example 1</title>
<link rel="stylesheet" type="text/css"
href=“stylesheet1.css">
</head>
<body>
<h1> WELCOME! </h1>
<p>Welcome to my first page.</p>
</body>
</html>
In stylesheet.css
body {
background-color: lightgreen;
}
h1 {
color: yellow;
text-align: center;
}
p {
font-family: Arial;
font-size: 20px;
font-style:italic;
}
Inline CSS
<!DOCTYPE html>
<html>
<body style="background-color: lightgreen;">
<h1 style="color:yellow;text-align:center;">This is a
heading</h1>
<p style="font-family: Arial; font-size: 20px; font-
style:italic; ">This is a paragraph.</p>
</body>
</html>
CSS selectors
1. Id selector:
• The id of an element is unique within a page.
• The id selector is used to select one unique element.
• Write a hash (#) character, before the id of the element.
2. Class selector:
• The class selector selects HTML elements with a specific
class attribute.
• To select elements with a specific class, write a dot (.)
character, before the class name.
Example
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 2</title>
• <style>
• body {
• background-color: lightgreen;
• }
• #head1 {
• color: yellow;
• text-align: center;
• }
• .para1{
• font-family: Arial;
• font-size: 20px;
• font-style:italic;
• }
• </style>
• </head>
• <body>
• <h1 id=“head1”> WELCOME! </h1>
• <p class=“para1”>Welcome to my first page.</p>
• </body>
• </html>
JAVASCRIPT
JavaScript
• Is a programming language
• Is used for creating websites
• Easy to learn.
• Standalone language
• Used to make dynamic webpages
• Add special effects on webpages like rollover, roll out and
many types of graphics.
• saved with a .js extension.
Inline JavaScript
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 1</title>
• <style>
• body {
• background-color: lightgreen;
• }
• #head1{
• color: yellow;
• text-align: center;
• }
• .para1 {
• font-family: Arial;
• font-size: 20px;
• font-style:italic;
• }
• </style>
• </head>
• <body>
• <h1 id="head1"> WELCOME! </h1>
• <p class="para1">Welcome to my first page.</p>
• <h2 id="head2"></h2>
• <button type="button" onclick='document.getElementById("head2").innerHTML = "This is JavaScript!"'>Click Me!</button>
• </body>
• </html>
Internal JavaScript
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 1</title>
• <style>
• body {
• background-color: lightgreen;
• }
• #head1{
• color: yellow;
• text-align: center;
• }
• .para1 {
• font-family: Arial;
• font-size: 20px;
• font-style:italic;
• }
• </style>
• <script>
• function clickme(){
• document.getElementById("head2").innerHTML = "This is JavaScript";
• }
• </script>
• </head>
• <body>
• <h1 id="head1"> WELCOME! </h1>
• <p class="para1">Welcome to my first page.</p>
• <h2 id="head2"> </h2>
• <button type="button" onclick="clickme()">Click Me!</button>
• </body>
• </html>
External JavaScript
• <!DOCTYPE html>
• <html>
• <head>
• <title> Example 1</title>
• <script type="text/javascript" src="exjse.js"></script>
• <style>
• body {
• background-color: lightgreen;
• }
• #head1{
• color: yellow;
• text-align: center;
• }
• .para1 {
• font-family: Arial;
• font-size: 20px;
• font-style:italic;
• }
• </style>
• </head>
• <body>
• <h1 id="head1"> WELCOME! </h1>
• <p class="para1">Welcome to my first page.</p>
• <h2 id="head2"> </h2>
• <button type="button" onclick="clickme()">Click Me!</button>
• </body>
• </html>
Add this code in a new file and name as exjse.js
function clickme(){
document.getElementById("head2").innerHTML
= "This is JavaScript";
}
Practice
1. Create a web page with a title “My tour”
• Use heading size 2, “My trip to ….” . Add a paragraph
and write about the place. Your name should be in
head size 4.
• Use external css. Add text color to both headings and
paragraph, the heading should be in bold and
paragraph should be in italics. Add background color
to light blue.
• Use external JavaScript, when clicking the button, it
should display your name.
In Next Lesson we will learn
• How to use lists, tables, images and hyperlinks.
• Use javascript to resize image size.
Thank You

More Related Content

What's hot

What's hot (20)

HTML Introduction
HTML IntroductionHTML Introduction
HTML Introduction
 
Basic Html Knowledge for students
Basic Html Knowledge for studentsBasic Html Knowledge for students
Basic Html Knowledge for students
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Html coding
Html codingHtml coding
Html coding
 
Html basics
Html basicsHtml basics
Html basics
 
HTML Dasar : #5 Heading
HTML Dasar : #5 HeadingHTML Dasar : #5 Heading
HTML Dasar : #5 Heading
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Html5
Html5 Html5
Html5
 
HTML & CSS Masterclass
HTML & CSS MasterclassHTML & CSS Masterclass
HTML & CSS Masterclass
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Html list.
Html list.Html list.
Html list.
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts Basics
 
CSS Font & Text style
CSS Font & Text style CSS Font & Text style
CSS Font & Text style
 
Html
HtmlHtml
Html
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
Web design - Working with tables in HTML
Web design - Working with tables in HTMLWeb design - Working with tables in HTML
Web design - Working with tables in HTML
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
Html presentation
Html presentationHtml presentation
Html presentation
 

Similar to HTML, CSS, JavaScript for beginners

Similar to HTML, CSS, JavaScript for beginners (20)

6. Css
6. Css6. Css
6. Css
 
What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)
 
Basics ogHtml
Basics ogHtml Basics ogHtml
Basics ogHtml
 
Html2
Html2Html2
Html2
 
VAIBHAV JAIN WEB TECHNOLOGY.pptx
VAIBHAV JAIN WEB TECHNOLOGY.pptxVAIBHAV JAIN WEB TECHNOLOGY.pptx
VAIBHAV JAIN WEB TECHNOLOGY.pptx
 
Html cia
Html ciaHtml cia
Html cia
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Html
HtmlHtml
Html
 
Java script and html new
Java script and html newJava script and html new
Java script and html new
 
Java script and html
Java script and htmlJava script and html
Java script and html
 
Intro to HTML
Intro to HTMLIntro to HTML
Intro to HTML
 
Quan Head Tag Presentation
Quan Head Tag PresentationQuan Head Tag Presentation
Quan Head Tag Presentation
 
presentation_web_design_basic_1595487867_382444.pptx
presentation_web_design_basic_1595487867_382444.pptxpresentation_web_design_basic_1595487867_382444.pptx
presentation_web_design_basic_1595487867_382444.pptx
 
Html
HtmlHtml
Html
 
DESIGN THINKING SYLLABUS MATERIAL NOTES UNIT 1 .pptx
DESIGN THINKING SYLLABUS MATERIAL NOTES UNIT 1 .pptxDESIGN THINKING SYLLABUS MATERIAL NOTES UNIT 1 .pptx
DESIGN THINKING SYLLABUS MATERIAL NOTES UNIT 1 .pptx
 
10x10 presentation Edited 4
10x10 presentation Edited 410x10 presentation Edited 4
10x10 presentation Edited 4
 
Khoa dang (kay)
Khoa dang (kay)Khoa dang (kay)
Khoa dang (kay)
 
Html intro
Html introHtml intro
Html intro
 
Lab_Ex1.pptx
Lab_Ex1.pptxLab_Ex1.pptx
Lab_Ex1.pptx
 
Html5.pptx
Html5.pptxHtml5.pptx
Html5.pptx
 

Recently uploaded

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Recently uploaded (20)

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

HTML, CSS, JavaScript for beginners

  • 3. HTML • Abbreviation for Hyper Text Markup Language • Is the standard markup language for creating web pages. • Easy to understand • Well Organized • Front-end programming language • saved with a .html extension
  • 4. HTML elements • HTML elements has starting tag, contents and closing tag <tagname> content </tagname> • The closing tag ends with a backslash (/). • The start tag and close tag name should be same. • <h1> content </h1>
  • 5. HTML elements • <!DOCTYPE html> defines that this document is an HTML5 document. • <html> element is the root element of an HTML page • <head> element contains meta information about the HTML page • <title> element specifies a title for the HTML page (shown in the browser's title bar) • <body> element defines the document's body. • The <h1> element defines a large heading • The <p> element defines a paragraph
  • 6. Body elements • Body tag contains all the visible contents,  Headings (h1-h6),  Paragraphs,  Images,  Hyperlinks,  Tables,  Lists, etc.
  • 7. Example • <!DOCTYPE html> • <html> • <head> • <title> Example 1</title> • </head> • <body> • <h1> WELCOME! </h1> • <p>Welcome to my first page.</p> • </body> • </html>
  • 9. CSS • CSS Stands for Cascading Style Sheets • Easy to understand • Well Organized • Front-end programming language • saved with a .css extension when use external CSS.
  • 10. CSS syntax h1 { color: yellow; text-align: center; } • <h1> is the selector in CSS. • Color is the property and yellow is the value. • Text-align is the property and center is the value
  • 11. Ways to insert CSS • There are 3 ways to insert CSS: 1. Internal: The internal style is defined inside the <style> element, inside the head section. 2. External: Can be written in any text editor, and must be saved with a .css extension. The external .css file should not contain any HTML tags. 3. Inline: add the style attribute to the element. The style attribute can contain any CSS property.
  • 12. Internal CSS • <!DOCTYPE html> • <html> • <head> • <title> Example 1 </title> • <style> • body { • background-color: lightgreen; • } • h1 { • color: yellow; • text-align: center; • } • p { • font-family: Arial; • font-size: 20px; • font-style:italic; • } • </style> • </head> • <body> • <h1> WELCOME! </h1> • <p>Welcome to my first page.</p> • </body> • </html>
  • 13. External CSS In Example.html <!DOCTYPE html> <html> <head> <title>Example 1</title> <link rel="stylesheet" type="text/css" href=“stylesheet1.css"> </head> <body> <h1> WELCOME! </h1> <p>Welcome to my first page.</p> </body> </html> In stylesheet.css body { background-color: lightgreen; } h1 { color: yellow; text-align: center; } p { font-family: Arial; font-size: 20px; font-style:italic; }
  • 14. Inline CSS <!DOCTYPE html> <html> <body style="background-color: lightgreen;"> <h1 style="color:yellow;text-align:center;">This is a heading</h1> <p style="font-family: Arial; font-size: 20px; font- style:italic; ">This is a paragraph.</p> </body> </html>
  • 15. CSS selectors 1. Id selector: • The id of an element is unique within a page. • The id selector is used to select one unique element. • Write a hash (#) character, before the id of the element. 2. Class selector: • The class selector selects HTML elements with a specific class attribute. • To select elements with a specific class, write a dot (.) character, before the class name.
  • 16. Example • <!DOCTYPE html> • <html> • <head> • <title> Example 2</title> • <style> • body { • background-color: lightgreen; • } • #head1 { • color: yellow; • text-align: center; • } • .para1{ • font-family: Arial; • font-size: 20px; • font-style:italic; • } • </style> • </head> • <body> • <h1 id=“head1”> WELCOME! </h1> • <p class=“para1”>Welcome to my first page.</p> • </body> • </html>
  • 18. JavaScript • Is a programming language • Is used for creating websites • Easy to learn. • Standalone language • Used to make dynamic webpages • Add special effects on webpages like rollover, roll out and many types of graphics. • saved with a .js extension.
  • 19. Inline JavaScript • <!DOCTYPE html> • <html> • <head> • <title> Example 1</title> • <style> • body { • background-color: lightgreen; • } • #head1{ • color: yellow; • text-align: center; • } • .para1 { • font-family: Arial; • font-size: 20px; • font-style:italic; • } • </style> • </head> • <body> • <h1 id="head1"> WELCOME! </h1> • <p class="para1">Welcome to my first page.</p> • <h2 id="head2"></h2> • <button type="button" onclick='document.getElementById("head2").innerHTML = "This is JavaScript!"'>Click Me!</button> • </body> • </html>
  • 20. Internal JavaScript • <!DOCTYPE html> • <html> • <head> • <title> Example 1</title> • <style> • body { • background-color: lightgreen; • } • #head1{ • color: yellow; • text-align: center; • } • .para1 { • font-family: Arial; • font-size: 20px; • font-style:italic; • } • </style> • <script> • function clickme(){ • document.getElementById("head2").innerHTML = "This is JavaScript"; • } • </script> • </head> • <body> • <h1 id="head1"> WELCOME! </h1> • <p class="para1">Welcome to my first page.</p> • <h2 id="head2"> </h2> • <button type="button" onclick="clickme()">Click Me!</button> • </body> • </html>
  • 21. External JavaScript • <!DOCTYPE html> • <html> • <head> • <title> Example 1</title> • <script type="text/javascript" src="exjse.js"></script> • <style> • body { • background-color: lightgreen; • } • #head1{ • color: yellow; • text-align: center; • } • .para1 { • font-family: Arial; • font-size: 20px; • font-style:italic; • } • </style> • </head> • <body> • <h1 id="head1"> WELCOME! </h1> • <p class="para1">Welcome to my first page.</p> • <h2 id="head2"> </h2> • <button type="button" onclick="clickme()">Click Me!</button> • </body> • </html> Add this code in a new file and name as exjse.js function clickme(){ document.getElementById("head2").innerHTML = "This is JavaScript"; }
  • 22. Practice 1. Create a web page with a title “My tour” • Use heading size 2, “My trip to ….” . Add a paragraph and write about the place. Your name should be in head size 4. • Use external css. Add text color to both headings and paragraph, the heading should be in bold and paragraph should be in italics. Add background color to light blue. • Use external JavaScript, when clicking the button, it should display your name.
  • 23. In Next Lesson we will learn • How to use lists, tables, images and hyperlinks. • Use javascript to resize image size.