SlideShare a Scribd company logo
CHRISTMAS TREES
WITH HTML, CSS & JS
NIAMH FOLEY
WHAT WE ARE GOING TO CREATE
HTML5 Tree with decoration

HTML + CSS Tree
HYPER TEXT MARK UP LANGUAGE
Pros

Cons

β€’ Provides a basic structure for data to be
displayed

β€’ HTML is not dynamic – meaning it has no logic
to it

β€’ Very easy to pick up and learn

β€’ No one structure to it

β€’ Mistakes are easily found and fixed
β€’ There are many development environments
CASCADING STYLE SHEETS
Pros
β€’ Easy to learn
β€’ Used by 99.999% of websites
β€’ Tidy's up HTML makes it β€œCleaner”
β€’ Provides the skin to HMTL

Cons
β€’ None Its that Good
JAVASCRIPT
Pros
β€’ As close as you can get to coding with out all the
β€œMessy Stuff” of code
β€’ Safe !! You cannot damage your system as its
self contained

β€’ Extremely powerful tool for creating web apps
β€’ Very easy to pick up and learn

Cons
β€’ Only works in a browser
β€’ No Development environment
β€’ Debugging is a pain
β€’ Each browser reacts to code differently
β€’ Imagination is your only limit with JS
HOUSE KEEPING
1. Create a Directory called β€œChristmas Tree”
2. Create a subdirectory called β€œcss”
3. Create a file called β€œstyles.css” and save into css
4. Create a file called β€œindex.htm” and save into the root directory (Christmas Tree)
Keyboard Short cuts
Copy : Ctrl + C
Paste : Ctrl + V
Cut :

Ctrl + X
HTML BOILER PLATE
Use this boiler plate code to begin

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML, CSS & JS Christmass Trees</title>
<link rel="stylesheet" href="css/tree.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<canvas id="canvas" width="300" height="300" style="border-style:solid;" ></canvas>
</body>
</html>
HTTP://BIT.LY/CHRISTMASTREE
HTTP://BIT.LY/TREECSS
HTTP://BIT.LY/JSTREE
FEAR NOT !!!
HTML5 + JAVASCRIPT TREE
<body onload="draw();">
<script type="text/javascript">

FUNCTIONALITY

// JS goes in here

Setup

</script>
function draw() {
var canvas = document.getElementById('canvas');

FUNCTIONALITY
Step 1 - Beginning Code

if (canvas.getContext){
var ctx = canvas.getContext('2d');
// more code goes here !!

}
}
ctx.beginPath();
ctx.moveTo(150, 10); // starting point

FUNCTIONALITY
Step 2 – The Triangle

ctx.lineTo(x, y);

ctx.lineTo(x, y);
ctx.fillStyle = β€œUSE HEX CODE” ;
ctx.fill();
FUNCTIONALITY
Step 3 – The base

ctx.fillStyle = β€œUSE HEX CODE”;
ctx.fillRect (x,y,w,h); // (x,y,width,height)
ctx.beginPath();
ctx.arc(140, 75, 10, 0, Math.PI*2, true);

FUNCTIONALITY
Step 4 - Decorations

// Uses trig to create circle

ctx.closePath();
ctx.fillStyle = " USE HEX CODE ";
ctx.fill();
TEST IT !!
Fingers Crossed it Worked
HTML + CSS TREE
SETUP

1. Use HTML Boiler Plate
2. Create a styles.css file in the css directory
HTML BOILER PLATE
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML, CSS & JS Christmass Trees</title>
<link rel="stylesheet" href="css/tree.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<canvas id="canvas" width="300" height="300" style="border-style:dotted solid;" ></canvas>
</body>
</html>
<div class="logo">
<div id="tree"></div>
<div id="trunk">

FUNCTIONALITY
Adding the HTML scaffolding

<div id="left-branch"></div>
<div id="right-bottom-branch"></div>
<div id="right-top-branch"></div>
</div>
</div>
.logo{

height: 200px; width: 160px;

FUNCTIONALITY

margin: 150px auto;

Logo Class

position: relative;
}
#tree {

border-bottom: 200px solid #//Putt Colour in here;
border-left: 80px solid transparent;

FUNCTIONALITY

border-right: 80px solid transparent;

Tree Identifier

position: absolute; top: 0; left: 0;
height: 0; width: 0;
}
#trunk{

height: 85px; width: 16px;

FUNCTIONALITY

background: #3b543f;

Trunk Identifier

position: absolute; left: 72px; bottom: -20px;
}
#left-branch{
background: #//Put Colour in here;
height: 30px; width: 6px;

position: absolute; left: -10px; top: 15px;

FUNCTIONALITY

transform: rotate(-50deg);

Branch Identifiers

-webkit-transform: rotate(-50deg);

Left

-moz-transform: rotate(-50deg);
-ms-transform: rotate(-50deg);
-o-transform: rotate(-50deg);
}
#right-bottom-branch{
background: #//Put Colour in here;
height: 50px; width: 6px;
position: absolute; top: 15px; left: 23px;

FUNCTIONALITY

transform: rotate(50deg);

Branch Identifier

-webkit-transform: rotate(50deg);

Right bottom

-moz-transform: rotate(50deg);

-ms-transform: rotate(50deg);
-o-transform: rotate(50deg);
}
#right-top-branch{
background: #//Put Colour in here;
height: 27px; width: 6px;
position: absolute; top: 2px; left: 20px;

FUNCTIONALITY

transform: rotate(50deg);

Branch Identifier

-webkit-transform: rotate(50deg);

Right Top

-moz-transform: rotate(50deg);

-ms-transform: rotate(50deg);
-o-transform: rotate(50deg);
}
TEST IT !!
Fingers Crossed it Worked
Christmas Trees Made with HTML CSS and JS

More Related Content

PDF
Security Best Practice: Oracle passwords, but secure!
PDF
MySQL partitions tutorial
PDF
KNIME tutorial
PDF
HTML lets get creative!!
PPTX
Media as mirror vs. prosthesis
PDF
HTML and UML
PDF
HMTL putting it all to gether
PDF
HTML page layout II
Security Best Practice: Oracle passwords, but secure!
MySQL partitions tutorial
KNIME tutorial
HTML lets get creative!!
Media as mirror vs. prosthesis
HTML and UML
HMTL putting it all to gether
HTML page layout II

Viewers also liked (20)

PPTX
Lifestyle unit 9
PPT
Php Security
PPT
Π’Π²Π΅Π΄Π΅Π½ΠΈΠ΅ Π² Π²Π΅Π±-ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅
PPT
Π’Π°Π±Π»ΠΈΡ†Ρ‹ Html
PPTX
Ρ€Π΅ΡˆΠ΅Π½ΠΈΠ΅ основной ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡ‹ Agile (scrum) ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ΠΎΠ² Π² контСкстС ba
Β 
PPTX
WordPress as Rapid Prototyping Tool
PDF
ΠŸΠΈΠ½Π³Π²ΠΈΠ½Ρ‹ ΠΈΠ· ΠΊΠ°Π»ΠΈΠ½ΠΈΠ½Π³Ρ€Π°Π΄Π°
PDF
Custom Post Type and Taxonomies in WordPress 3.x
PDF
Show vs. Tell in UX Design (Front in Amsterdam)
PDF
How Joomla Works
PPTX
17. основы css (cascading style sheets)
PPTX
6. Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ ΠΈ Π΄Ρ€ΡƒΠ³ΠΈΠ΅ Ρ‚Π΅Π³ΠΈ html
PDF
Organisation and navigation
PPTX
Images and Tables in HTML
PPT
Getting Started With Php Frameworks @BCP5
PPT
Box Model
PDF
Π‘Π΅Ρ€Π³Π΅ΠΉ Π‘Π΅Ρ€Π΅ΠΆΠ½ΠΎΠΉ "ΠŸΡ€ΠΎ ΡˆΠ°Π±Π»ΠΎΠ½ΠΈΠ·Π°Ρ‚ΠΎΡ€Ρ‹ Π²ΠΎΠΎΠ±Ρ‰Π΅ ΠΈ BEMHTML Π² частности"
Β 
PDF
Using Flexbox Today (Generate Sydney 2016)
PDF
FL Blog Con 2015: How To Find The Best WordPress Plugins For You
PPT
ВСрстка_ЛСкция1
Β 
Lifestyle unit 9
Php Security
Π’Π²Π΅Π΄Π΅Π½ΠΈΠ΅ Π² Π²Π΅Π±-ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅
Π’Π°Π±Π»ΠΈΡ†Ρ‹ Html
Ρ€Π΅ΡˆΠ΅Π½ΠΈΠ΅ основной ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡ‹ Agile (scrum) ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ΠΎΠ² Π² контСкстС ba
Β 
WordPress as Rapid Prototyping Tool
ΠŸΠΈΠ½Π³Π²ΠΈΠ½Ρ‹ ΠΈΠ· ΠΊΠ°Π»ΠΈΠ½ΠΈΠ½Π³Ρ€Π°Π΄Π°
Custom Post Type and Taxonomies in WordPress 3.x
Show vs. Tell in UX Design (Front in Amsterdam)
How Joomla Works
17. основы css (cascading style sheets)
6. Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ ΠΈ Π΄Ρ€ΡƒΠ³ΠΈΠ΅ Ρ‚Π΅Π³ΠΈ html
Organisation and navigation
Images and Tables in HTML
Getting Started With Php Frameworks @BCP5
Box Model
Π‘Π΅Ρ€Π³Π΅ΠΉ Π‘Π΅Ρ€Π΅ΠΆΠ½ΠΎΠΉ "ΠŸΡ€ΠΎ ΡˆΠ°Π±Π»ΠΎΠ½ΠΈΠ·Π°Ρ‚ΠΎΡ€Ρ‹ Π²ΠΎΠΎΠ±Ρ‰Π΅ ΠΈ BEMHTML Π² частности"
Β 
Using Flexbox Today (Generate Sydney 2016)
FL Blog Con 2015: How To Find The Best WordPress Plugins For You
ВСрстка_ЛСкция1
Β 
Ad

More from Niamh Foley (7)

PDF
HTML Cheat Sheet
PDF
HTML coding and syntax
PDF
HTML an introduction
PDF
HTML an introduction
PDF
File management 101
PDF
Basic tags
PDF
Niamh foley html module discriptor
HTML Cheat Sheet
HTML coding and syntax
HTML an introduction
HTML an introduction
File management 101
Basic tags
Niamh foley html module discriptor
Ad

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Classroom Observation Tools for Teachers
PDF
RMMM.pdf make it easy to upload and study
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
Institutional Correction lecture only . . .
PPTX
Cell Types and Its function , kingdom of life
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
BΓ€I TαΊ¬P Bα»” TRα»’ 4 Kα»Έ NΔ‚NG TIαΊΎNG ANH 9 GLOBAL SUCCESS - CαΊ’ NΔ‚M - BÁM SÁT FORM Đ...
Microbial disease of the cardiovascular and lymphatic systems
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Classroom Observation Tools for Teachers
RMMM.pdf make it easy to upload and study
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Cell Structure & Organelles in detailed.
Institutional Correction lecture only . . .
Cell Types and Its function , kingdom of life
2.FourierTransform-ShortQuestionswithAnswers.pdf
O7-L3 Supply Chain Operations - ICLT Program
Sports Quiz easy sports quiz sports quiz
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GDM (1) (1).pptx small presentation for students
TR - Agricultural Crops Production NC III.pdf
Final Presentation General Medicine 03-08-2024.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
BΓ€I TαΊ¬P Bα»” TRα»’ 4 Kα»Έ NΔ‚NG TIαΊΎNG ANH 9 GLOBAL SUCCESS - CαΊ’ NΔ‚M - BÁM SÁT FORM Đ...

Christmas Trees Made with HTML CSS and JS

  • 1. CHRISTMAS TREES WITH HTML, CSS & JS NIAMH FOLEY
  • 2. WHAT WE ARE GOING TO CREATE HTML5 Tree with decoration HTML + CSS Tree
  • 3. HYPER TEXT MARK UP LANGUAGE Pros Cons β€’ Provides a basic structure for data to be displayed β€’ HTML is not dynamic – meaning it has no logic to it β€’ Very easy to pick up and learn β€’ No one structure to it β€’ Mistakes are easily found and fixed β€’ There are many development environments
  • 4. CASCADING STYLE SHEETS Pros β€’ Easy to learn β€’ Used by 99.999% of websites β€’ Tidy's up HTML makes it β€œCleaner” β€’ Provides the skin to HMTL Cons β€’ None Its that Good
  • 5. JAVASCRIPT Pros β€’ As close as you can get to coding with out all the β€œMessy Stuff” of code β€’ Safe !! You cannot damage your system as its self contained β€’ Extremely powerful tool for creating web apps β€’ Very easy to pick up and learn Cons β€’ Only works in a browser β€’ No Development environment β€’ Debugging is a pain β€’ Each browser reacts to code differently β€’ Imagination is your only limit with JS
  • 6. HOUSE KEEPING 1. Create a Directory called β€œChristmas Tree” 2. Create a subdirectory called β€œcss” 3. Create a file called β€œstyles.css” and save into css 4. Create a file called β€œindex.htm” and save into the root directory (Christmas Tree) Keyboard Short cuts Copy : Ctrl + C Paste : Ctrl + V Cut : Ctrl + X
  • 7. HTML BOILER PLATE Use this boiler plate code to begin <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>The HTML, CSS & JS Christmass Trees</title> <link rel="stylesheet" href="css/tree.css"> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <canvas id="canvas" width="300" height="300" style="border-style:solid;" ></canvas> </body> </html>
  • 11. function draw() { var canvas = document.getElementById('canvas'); FUNCTIONALITY Step 1 - Beginning Code if (canvas.getContext){ var ctx = canvas.getContext('2d'); // more code goes here !! } }
  • 12. ctx.beginPath(); ctx.moveTo(150, 10); // starting point FUNCTIONALITY Step 2 – The Triangle ctx.lineTo(x, y); ctx.lineTo(x, y); ctx.fillStyle = β€œUSE HEX CODE” ; ctx.fill();
  • 13. FUNCTIONALITY Step 3 – The base ctx.fillStyle = β€œUSE HEX CODE”; ctx.fillRect (x,y,w,h); // (x,y,width,height)
  • 14. ctx.beginPath(); ctx.arc(140, 75, 10, 0, Math.PI*2, true); FUNCTIONALITY Step 4 - Decorations // Uses trig to create circle ctx.closePath(); ctx.fillStyle = " USE HEX CODE "; ctx.fill();
  • 15. TEST IT !! Fingers Crossed it Worked
  • 16. HTML + CSS TREE
  • 17. SETUP 1. Use HTML Boiler Plate 2. Create a styles.css file in the css directory
  • 18. HTML BOILER PLATE <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>The HTML, CSS & JS Christmass Trees</title> <link rel="stylesheet" href="css/tree.css"> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <canvas id="canvas" width="300" height="300" style="border-style:dotted solid;" ></canvas> </body> </html>
  • 19. <div class="logo"> <div id="tree"></div> <div id="trunk"> FUNCTIONALITY Adding the HTML scaffolding <div id="left-branch"></div> <div id="right-bottom-branch"></div> <div id="right-top-branch"></div> </div> </div>
  • 20. .logo{ height: 200px; width: 160px; FUNCTIONALITY margin: 150px auto; Logo Class position: relative; }
  • 21. #tree { border-bottom: 200px solid #//Putt Colour in here; border-left: 80px solid transparent; FUNCTIONALITY border-right: 80px solid transparent; Tree Identifier position: absolute; top: 0; left: 0; height: 0; width: 0; }
  • 22. #trunk{ height: 85px; width: 16px; FUNCTIONALITY background: #3b543f; Trunk Identifier position: absolute; left: 72px; bottom: -20px; }
  • 23. #left-branch{ background: #//Put Colour in here; height: 30px; width: 6px; position: absolute; left: -10px; top: 15px; FUNCTIONALITY transform: rotate(-50deg); Branch Identifiers -webkit-transform: rotate(-50deg); Left -moz-transform: rotate(-50deg); -ms-transform: rotate(-50deg); -o-transform: rotate(-50deg); }
  • 24. #right-bottom-branch{ background: #//Put Colour in here; height: 50px; width: 6px; position: absolute; top: 15px; left: 23px; FUNCTIONALITY transform: rotate(50deg); Branch Identifier -webkit-transform: rotate(50deg); Right bottom -moz-transform: rotate(50deg); -ms-transform: rotate(50deg); -o-transform: rotate(50deg); }
  • 25. #right-top-branch{ background: #//Put Colour in here; height: 27px; width: 6px; position: absolute; top: 2px; left: 20px; FUNCTIONALITY transform: rotate(50deg); Branch Identifier -webkit-transform: rotate(50deg); Right Top -moz-transform: rotate(50deg); -ms-transform: rotate(50deg); -o-transform: rotate(50deg); }
  • 26. TEST IT !! Fingers Crossed it Worked