SlideShare a Scribd company logo
1 of 39
The Basics of Web
Development (Front End)
BY MV HACKS
Some Editors to Download
• Geany
• Notepad ++
• Sublime Text
• Eclipse (or other IDEs)
• Brackets
What You will Learn Today
• HTML
• CSS
Why WebDev?
• Create cool looking websites
• “Hack” online games (like Cookie Clicker!!)
• Create your own online games
How Websites Work
• Website = HTML document + resources (CSS,
images, JavaScript)
• Browsers (Chrome, Firefox, etc.) read HTML and
render the appropriate page
•Or if Internet Explorer, the wrong page
• Websites can be on your local computer or on a web
server
What is HTML?
• HTML = Hyper Text Markup Language
• Language of the web!
•All webpages are structured in HTML
•Composed of elements which consist of tags
•Tags mark beginning and end of elements
•Ex. A paragraph element - <p>Paragraph Content</p>
Common Elements
•Common Elements
•HTML - <html></html>
•Head - <head></head>
•Body - <body></body>
•Heading - <h1></h1>
•Paragraph - <p></p>
•Anchor - <a></a>
•Image - <img />
Starting
• HTML documents start with <!DOCTYPE html>
• Tells browser to render as HTML5
•Then <html> to put everything inside
• Most elements need to be closed
• HTML is highest order, so end with </html>
<!DOCTYPE html>
<html>
<!–- all the webpage’s elements -->
</html>
Header Element
• Next is the head element, <head>
•This is where you bring in style files, scripts, etc.
•No actual content seen on the page will be here!
•Ex. Titles, Style tags (CSS basically), etc.
<!DOCTYPE html>
<html>
<head>
<title> Let’s Hack!! </title>
</head>
</html>
Body Element
• Finally the body element, <body>
•The “body” of the html file
• Where you put images, paragraphs, bullet points,
etc.
<!DOCTYPE html>
<html>
<head>
<title> Let’s Hack!! </title>
</head>
<body>
<p>Hello world! Congratulations on making
your first page!</p>
</body>
</html>
Saving and Viewing
•File -> save as nameofFile.html
• Naming doesn’t matter
• “MvHacks.html”
• HTML files don’t need to be compiled
•Open browser, click File -> Open file…. and navigate to your
html document
• Or with Brackets, use live-view (sideways lightning bolt)
HTML Details 1
• Headings, <h1> …. <h6>
• 6 different levels, appropriately used to section content
• Cannot nest headings in each other, like <h1><h2></h2></h1>, that is bad
• How to use:
<h1>Favorite Foods</h1>
<h2>Korean Food</h2>
<p>Korean food is awesome!</p>
<h2>Thai Food</h2>
<p>Thai food is also awesome!</p>
HTML Details 2
•Paragraph, <p>
• Most common/general text element
• Automatically includes margins (spacing) between paragraphs
•Line break, <br>
• Separates lines of text
• Can be placed in a <p> element
<p>The following sentence is true.<br> The previous sentence is
false.</p> Output:
The following sentence is true.
The previous sentence is false.
HTML Details 3
• Anchor (link), <a>
• Used to create hyperlink to separate content
• Must declare ‘href’ attribute with value as destination
•Destination can be URL (http://www.google.com/) or a relative
destination (doc2.html)
• Link text enclosed in element
•<a href=“http://www.google.com/”>This link goes to Google.</a>
•<a href=“doc2.html”>This link goes to doc2</a>
HTML Details 4
• Blocks, <div>
• Used to separate different sections of an html doc
• You can nest as many as these within each other as you want, but keep in mind to close each one!
• You can also set id’s to them to set them apart (useful for CSS)
<div id=“tasty_delicious_food”></div>
<div id=“Food”>
<div id = “more_food”>
<div id = “even_more_food”>
</div>
</div>
</div>
HTML Details 5
• Image, <img>
• Used to input images into the doc
• You can specify width and height through the tag
• Width & height are both in measured in pixels
• The <img> doesn’t have a closing tag
<img src=“penguinsFlying.jpg” >
<img src=“moreFlyingStuff.jpg” width=“100” height=“100”>
HTML Details 6
•Lists
• <ul> - unordered lists aka bullet lists
• <ol> - ordered lists aka numbered lists
• <li> - these will be the individual points within each list
<ul>
<li>Birds</li>
<li>Penguins</li> </ul>
<ol>
<li>Fuzzy Creatures</li>
<li>Pandas</li> </ol>
Output:
• Birds
• Penguins
1. Fuzzy Creatures
2. Pandas
Hands-On Part 1
Create a VERY basic HTML website that includes:
1. At least one picture
2. A proper title (for the webpage)
3. A few sentences (in bullet or numbered points) about yourself
4. Anything else you want
You have 5 minutes. If you are done or need
help, raise your hand.
HTML Details 7
•Tables, <table>
• Are used to display data in a table-like fashion
• If you don’t specify a border, it’ll display with no borders
<table border = “1”>
<tr>
<td>Blah</td>
</tr>
<tr>
<td>Blah again</td>
</tr>
</table>
HTML 5
• Cool new HTML version that includes:
• <video> is used to embed a YouTube-esque video player in your website
• Supported video formats include MP4, Ogg, and WebM
<video src="Ep. 35 - The Tales of Ba Sing Se.mp4" controls>
Your browser does not support the video element.
</video>
• <audio> is used to embed an audio player in your website
• Supported audio formats include MP3, Wav, and Ogg
<audio src="leaves.mp3" controls>
Your browser does not support the audio element.
</audio>
<header>
<nav>
<!-- navigation links -->
</nav>
</header>
<section>
<h1></h1>
<p></p>
</section>
<footer>
&copy; 2015 MV HACKS
</footer>
What is CSS?
• CSS stands for Cascade Style Sheets
• CSS allows you to style your webpages by matching the
rules with HTML tags
• This is were <div> id’s come in handy!
How to Incorporate CSS
1. Make an external CSS spreadsheet (style.css)
◦ Add with <link rel = “stylesheet” type=“text/css” href=“style.css”>
◦ Must be in the <head> section!
◦ CSS file must be in same folder as HTML
2. Internal CSS
◦ Put everything in between <style> </style> elements
◦ Again, must be in the <head> section
3. Inline Stylesheet
◦ Manually write style=“”
◦ Like: <p style=“color: # 421c52;”> Yo! </p>
Some Syntax
body {
background: #ffffff;
font-size: 16px;
}
div#css_lessons {
width: 100%;
height: 960px;
background: #421c52;
}
Whatever is in the {} is what you are modifying
If you gave an ID, then you have to use #Idname
selector
If you have a class, then the .classname selector
Generally, most things like font-size work in the
syntax ->
nameofRule:
CSS Selectors 1
• Tag
• Use element name, applies to all elements of that type in the document
p { color: blue; }
• Class
• Use class name, applies to all elements of that class in the document
.subtext { font-weight: bold; }
• ID
• Use id name, applies to only element with specified id
#key { font-size: 28px; }
CSS Selectors 2
• You can group selectors together in the same CSS rule
• Enclosed properties apply to all selected elements
/* Applies to all paragraph elements, and heading 1s with id ‘title’ */
p, h1#title {
font-style: italic;
}
CSS Properties 1
• Text properties
• Font-family
• Font-style
• Font-size
• Font-weight
• Color
p {
font-weight: bold;
font-style: italic;
font-size: 20px;
font-family: serif;
color: #666666;
}
/* All paragraphs are now bold, italic, 20px large, serif font, and gray */
CSS Properties 2
•Background properties
• Background-color
• Background-image
• Background-repeat
• Background-attachment
• Background-position
body {
background-image: url(“background.png”);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center top;
}
/* Sets body’s background image as fixed at
the top of the page */
CSS Positioning
• Margin
• Space surrounding element
• Border
• Element border
• Padding
• Space surrounding element content
CSS Positioning 1
•Margin:
• Clears a space around your element
• Imagine there’s a border around it, margin clears
everything outside of it
• Usable one of two ways: long-hand way or short-hand
way
/*creates a margin above, right, below, left – shorthand*/
div#Hacks {
margin: 5px 6px 7px 8px;
}
/*creates a margin above,right, below, left – longhand*/
div#Hacks {
margin-top: 5px;
margin-right: 6px;
margin-bottom: 7px;
margin-left: 8px;
}
CSS Positioning 2
• Margins – a useful trick for aligning the element into the center of the page
/*centers an element into the center of the page*/
div#pieText {
margin: 0 auto;
}
• Why does this work?
• The 0 tells the browser to set the top and bottom margins to 0
• The auto tells the browser to split up the left and right evenly so the element is centered
CSS Positioning 3
•Padding:
• Clears a space around the content within the
element
• Imagine a box around the element, padding
applies to everything within the border
/*creates padding above, right, below, left –
shorthand*/
p {
padding: 5px 6px 7px 8px;
}
/*creates padding above, right, below, left –
longhand*/
p {
padding-top: 5px;
padding-right: 6px;
padding-bottom: 7px;
padding-left: 8px;
}
CSS Positioning 4
• Floating
• Allow you to float an element left or right
• Great for layouts and images
*Float to the left*/
div#pieImage {
float: left;
}
/*Float to the right*/
div#pieImage {
float: right;
}
Hands-On Part 2
Take your previous HTML website and using CSS,
1. Add at least 1 class and 1 ID and style them
2. Style the background (colors, designs, etc.)
3. Style the sentences you wrote (colors, fonts, etc.)
4. Challenge: put some padding on the image and center it
You have 5 minutes. If you are done or need
help, raise your hand.

More Related Content

What's hot

Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?Saulius Skeirys
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptSeble Nigussie
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
 
Intro to HTML, CSS & JS - Internship Presentation Week-3
Intro to HTML, CSS & JS - Internship Presentation Week-3Intro to HTML, CSS & JS - Internship Presentation Week-3
Intro to HTML, CSS & JS - Internship Presentation Week-3Devang Garach
 
HTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersHTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersPrakritiDhang
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.pptsentayehu
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...Edureka!
 
Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3Kannika Kong
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stackAshok Raj
 
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)Clément Wehrung
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom ManipulationMohammed Arif
 

What's hot (20)

Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?Typescript in React: HOW & WHY?
Typescript in React: HOW & WHY?
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
CSS Grid vs. Flexbox
CSS Grid vs. FlexboxCSS Grid vs. Flexbox
CSS Grid vs. Flexbox
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Intro to HTML, CSS & JS - Internship Presentation Week-3
Intro to HTML, CSS & JS - Internship Presentation Week-3Intro to HTML, CSS & JS - Internship Presentation Week-3
Intro to HTML, CSS & JS - Internship Presentation Week-3
 
HTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginnersHTML, CSS, JavaScript for beginners
HTML, CSS, JavaScript for beginners
 
Java script
Java scriptJava script
Java script
 
Html 5
Html 5Html 5
Html 5
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
 
Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3Responsive Web Design with HTML5 and CSS3
Responsive Web Design with HTML5 and CSS3
 
Css box-model
Css box-modelCss box-model
Css box-model
 
Js ppt
Js pptJs ppt
Js ppt
 
jQuery Ajax
jQuery AjaxjQuery Ajax
jQuery Ajax
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
 
Introducing CSS Grid
Introducing CSS GridIntroducing CSS Grid
Introducing CSS Grid
 
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 

Viewers also liked

Front-end Web Dev (HK) Info Session
Front-end Web Dev (HK) Info SessionFront-end Web Dev (HK) Info Session
Front-end Web Dev (HK) Info SessionAllison Baum
 
Anyanwu Emmanuel Stock Handler
Anyanwu Emmanuel Stock HandlerAnyanwu Emmanuel Stock Handler
Anyanwu Emmanuel Stock HandlerEmmanuel Anyanwu
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewDiacode
 
League of extraordinary front end dev tools
League of extraordinary front end dev toolsLeague of extraordinary front end dev tools
League of extraordinary front end dev toolsSherif Tariq
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Developmentnelsonmenezes
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Developmentmwrather
 
คู่มือภาษา HTML และการจัดข้อความ
คู่มือภาษา HTML และการจัดข้อความคู่มือภาษา HTML และการจัดข้อความ
คู่มือภาษา HTML และการจัดข้อความPakornkrits
 
คู่มือ Photoshop cs3
คู่มือ Photoshop cs3คู่มือ Photoshop cs3
คู่มือ Photoshop cs3charuwarin
 
คู่มือการใช้งาน Photoshop cs
คู่มือการใช้งาน Photoshop csคู่มือการใช้งาน Photoshop cs
คู่มือการใช้งาน Photoshop cssurachet179
 
Understand front end developer
Understand front end developerUnderstand front end developer
Understand front end developerHsuan Fu Lien
 

Viewers also liked (13)

Front-end Web Dev (HK) Info Session
Front-end Web Dev (HK) Info SessionFront-end Web Dev (HK) Info Session
Front-end Web Dev (HK) Info Session
 
Anyanwu Emmanuel Stock Handler
Anyanwu Emmanuel Stock HandlerAnyanwu Emmanuel Stock Handler
Anyanwu Emmanuel Stock Handler
 
php lesson 1
php lesson 1php lesson 1
php lesson 1
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 
League of extraordinary front end dev tools
League of extraordinary front end dev toolsLeague of extraordinary front end dev tools
League of extraordinary front end dev tools
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Development
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
 
คู่มือภาษา HTML และการจัดข้อความ
คู่มือภาษา HTML และการจัดข้อความคู่มือภาษา HTML และการจัดข้อความ
คู่มือภาษา HTML และการจัดข้อความ
 
คู่มือ Photoshop cs3
คู่มือ Photoshop cs3คู่มือ Photoshop cs3
คู่มือ Photoshop cs3
 
คู่มือการใช้งาน Photoshop cs
คู่มือการใช้งาน Photoshop csคู่มือการใช้งาน Photoshop cs
คู่มือการใช้งาน Photoshop cs
 
Adobe Photoshop
Adobe PhotoshopAdobe Photoshop
Adobe Photoshop
 
Understand front end developer
Understand front end developerUnderstand front end developer
Understand front end developer
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Similar to Basics of Front End Web Dev PowerPoint

Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18TJ Stalcup
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Thinkful
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Aslam Najeebdeen
 
What's a web page made of?
What's a web page made of?What's a web page made of?
What's a web page made of?Charlie Allen
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlantaHtml css crash course may 11th, atlanta
Html css crash course may 11th, atlantaThinkful
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)François Massart
 
Castro Chapter 3
Castro Chapter 3Castro Chapter 3
Castro Chapter 3Jeff Byrnes
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlJoomla!Days Netherlands
 
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 .pptxbmit1
 

Similar to Basics of Front End Web Dev PowerPoint (20)

Lecture 2 - HTML Basics
Lecture 2 - HTML BasicsLecture 2 - HTML Basics
Lecture 2 - HTML Basics
 
Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18
 
Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)Code &amp; design your first website (3:16)
Code &amp; design your first website (3:16)
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to html
 
Artdm171 Week4 Tags
Artdm171 Week4 TagsArtdm171 Week4 Tags
Artdm171 Week4 Tags
 
The web context
The web contextThe web context
The web context
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
 
What's a web page made of?
What's a web page made of?What's a web page made of?
What's a web page made of?
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlantaHtml css crash course may 11th, atlanta
Html css crash course may 11th, atlanta
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
Class1slides
Class1slidesClass1slides
Class1slides
 
Castro Chapter 3
Castro Chapter 3Castro Chapter 3
Castro Chapter 3
 
Lab_Ex1.pptx
Lab_Ex1.pptxLab_Ex1.pptx
Lab_Ex1.pptx
 
HTML Webinar Class
HTML Webinar ClassHTML Webinar Class
HTML Webinar Class
 
Intro to HTML
Intro to HTMLIntro to HTML
Intro to HTML
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
 
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
 
Lab1_HTML.pptx
Lab1_HTML.pptxLab1_HTML.pptx
Lab1_HTML.pptx
 
Html advance
Html advanceHtml advance
Html advance
 

Basics of Front End Web Dev PowerPoint

  • 1. The Basics of Web Development (Front End) BY MV HACKS
  • 2. Some Editors to Download • Geany • Notepad ++ • Sublime Text • Eclipse (or other IDEs) • Brackets
  • 3. What You will Learn Today • HTML • CSS
  • 4. Why WebDev? • Create cool looking websites • “Hack” online games (like Cookie Clicker!!) • Create your own online games
  • 5. How Websites Work • Website = HTML document + resources (CSS, images, JavaScript) • Browsers (Chrome, Firefox, etc.) read HTML and render the appropriate page •Or if Internet Explorer, the wrong page • Websites can be on your local computer or on a web server
  • 6.
  • 7. What is HTML? • HTML = Hyper Text Markup Language • Language of the web! •All webpages are structured in HTML •Composed of elements which consist of tags •Tags mark beginning and end of elements •Ex. A paragraph element - <p>Paragraph Content</p>
  • 8. Common Elements •Common Elements •HTML - <html></html> •Head - <head></head> •Body - <body></body> •Heading - <h1></h1> •Paragraph - <p></p> •Anchor - <a></a> •Image - <img />
  • 9. Starting • HTML documents start with <!DOCTYPE html> • Tells browser to render as HTML5 •Then <html> to put everything inside • Most elements need to be closed • HTML is highest order, so end with </html>
  • 10. <!DOCTYPE html> <html> <!–- all the webpage’s elements --> </html>
  • 11. Header Element • Next is the head element, <head> •This is where you bring in style files, scripts, etc. •No actual content seen on the page will be here! •Ex. Titles, Style tags (CSS basically), etc.
  • 12. <!DOCTYPE html> <html> <head> <title> Let’s Hack!! </title> </head> </html>
  • 13. Body Element • Finally the body element, <body> •The “body” of the html file • Where you put images, paragraphs, bullet points, etc.
  • 14. <!DOCTYPE html> <html> <head> <title> Let’s Hack!! </title> </head> <body> <p>Hello world! Congratulations on making your first page!</p> </body> </html>
  • 15. Saving and Viewing •File -> save as nameofFile.html • Naming doesn’t matter • “MvHacks.html” • HTML files don’t need to be compiled •Open browser, click File -> Open file…. and navigate to your html document • Or with Brackets, use live-view (sideways lightning bolt)
  • 16. HTML Details 1 • Headings, <h1> …. <h6> • 6 different levels, appropriately used to section content • Cannot nest headings in each other, like <h1><h2></h2></h1>, that is bad • How to use: <h1>Favorite Foods</h1> <h2>Korean Food</h2> <p>Korean food is awesome!</p> <h2>Thai Food</h2> <p>Thai food is also awesome!</p>
  • 17. HTML Details 2 •Paragraph, <p> • Most common/general text element • Automatically includes margins (spacing) between paragraphs •Line break, <br> • Separates lines of text • Can be placed in a <p> element <p>The following sentence is true.<br> The previous sentence is false.</p> Output: The following sentence is true. The previous sentence is false.
  • 18. HTML Details 3 • Anchor (link), <a> • Used to create hyperlink to separate content • Must declare ‘href’ attribute with value as destination •Destination can be URL (http://www.google.com/) or a relative destination (doc2.html) • Link text enclosed in element •<a href=“http://www.google.com/”>This link goes to Google.</a> •<a href=“doc2.html”>This link goes to doc2</a>
  • 19. HTML Details 4 • Blocks, <div> • Used to separate different sections of an html doc • You can nest as many as these within each other as you want, but keep in mind to close each one! • You can also set id’s to them to set them apart (useful for CSS) <div id=“tasty_delicious_food”></div> <div id=“Food”> <div id = “more_food”> <div id = “even_more_food”> </div> </div> </div>
  • 20. HTML Details 5 • Image, <img> • Used to input images into the doc • You can specify width and height through the tag • Width & height are both in measured in pixels • The <img> doesn’t have a closing tag <img src=“penguinsFlying.jpg” > <img src=“moreFlyingStuff.jpg” width=“100” height=“100”>
  • 21. HTML Details 6 •Lists • <ul> - unordered lists aka bullet lists • <ol> - ordered lists aka numbered lists • <li> - these will be the individual points within each list <ul> <li>Birds</li> <li>Penguins</li> </ul> <ol> <li>Fuzzy Creatures</li> <li>Pandas</li> </ol> Output: • Birds • Penguins 1. Fuzzy Creatures 2. Pandas
  • 22. Hands-On Part 1 Create a VERY basic HTML website that includes: 1. At least one picture 2. A proper title (for the webpage) 3. A few sentences (in bullet or numbered points) about yourself 4. Anything else you want You have 5 minutes. If you are done or need help, raise your hand.
  • 23. HTML Details 7 •Tables, <table> • Are used to display data in a table-like fashion • If you don’t specify a border, it’ll display with no borders <table border = “1”> <tr> <td>Blah</td> </tr> <tr> <td>Blah again</td> </tr> </table>
  • 24. HTML 5 • Cool new HTML version that includes: • <video> is used to embed a YouTube-esque video player in your website • Supported video formats include MP4, Ogg, and WebM <video src="Ep. 35 - The Tales of Ba Sing Se.mp4" controls> Your browser does not support the video element. </video> • <audio> is used to embed an audio player in your website • Supported audio formats include MP3, Wav, and Ogg <audio src="leaves.mp3" controls> Your browser does not support the audio element. </audio>
  • 25. <header> <nav> <!-- navigation links --> </nav> </header> <section> <h1></h1> <p></p> </section> <footer> &copy; 2015 MV HACKS </footer>
  • 26.
  • 27. What is CSS? • CSS stands for Cascade Style Sheets • CSS allows you to style your webpages by matching the rules with HTML tags • This is were <div> id’s come in handy!
  • 28. How to Incorporate CSS 1. Make an external CSS spreadsheet (style.css) ◦ Add with <link rel = “stylesheet” type=“text/css” href=“style.css”> ◦ Must be in the <head> section! ◦ CSS file must be in same folder as HTML 2. Internal CSS ◦ Put everything in between <style> </style> elements ◦ Again, must be in the <head> section 3. Inline Stylesheet ◦ Manually write style=“” ◦ Like: <p style=“color: # 421c52;”> Yo! </p>
  • 29. Some Syntax body { background: #ffffff; font-size: 16px; } div#css_lessons { width: 100%; height: 960px; background: #421c52; } Whatever is in the {} is what you are modifying If you gave an ID, then you have to use #Idname selector If you have a class, then the .classname selector Generally, most things like font-size work in the syntax -> nameofRule:
  • 30. CSS Selectors 1 • Tag • Use element name, applies to all elements of that type in the document p { color: blue; } • Class • Use class name, applies to all elements of that class in the document .subtext { font-weight: bold; } • ID • Use id name, applies to only element with specified id #key { font-size: 28px; }
  • 31. CSS Selectors 2 • You can group selectors together in the same CSS rule • Enclosed properties apply to all selected elements /* Applies to all paragraph elements, and heading 1s with id ‘title’ */ p, h1#title { font-style: italic; }
  • 32. CSS Properties 1 • Text properties • Font-family • Font-style • Font-size • Font-weight • Color p { font-weight: bold; font-style: italic; font-size: 20px; font-family: serif; color: #666666; } /* All paragraphs are now bold, italic, 20px large, serif font, and gray */
  • 33. CSS Properties 2 •Background properties • Background-color • Background-image • Background-repeat • Background-attachment • Background-position body { background-image: url(“background.png”); background-repeat: no-repeat; background-attachment: fixed; background-position: center top; } /* Sets body’s background image as fixed at the top of the page */
  • 34. CSS Positioning • Margin • Space surrounding element • Border • Element border • Padding • Space surrounding element content
  • 35. CSS Positioning 1 •Margin: • Clears a space around your element • Imagine there’s a border around it, margin clears everything outside of it • Usable one of two ways: long-hand way or short-hand way /*creates a margin above, right, below, left – shorthand*/ div#Hacks { margin: 5px 6px 7px 8px; } /*creates a margin above,right, below, left – longhand*/ div#Hacks { margin-top: 5px; margin-right: 6px; margin-bottom: 7px; margin-left: 8px; }
  • 36. CSS Positioning 2 • Margins – a useful trick for aligning the element into the center of the page /*centers an element into the center of the page*/ div#pieText { margin: 0 auto; } • Why does this work? • The 0 tells the browser to set the top and bottom margins to 0 • The auto tells the browser to split up the left and right evenly so the element is centered
  • 37. CSS Positioning 3 •Padding: • Clears a space around the content within the element • Imagine a box around the element, padding applies to everything within the border /*creates padding above, right, below, left – shorthand*/ p { padding: 5px 6px 7px 8px; } /*creates padding above, right, below, left – longhand*/ p { padding-top: 5px; padding-right: 6px; padding-bottom: 7px; padding-left: 8px; }
  • 38. CSS Positioning 4 • Floating • Allow you to float an element left or right • Great for layouts and images *Float to the left*/ div#pieImage { float: left; } /*Float to the right*/ div#pieImage { float: right; }
  • 39. Hands-On Part 2 Take your previous HTML website and using CSS, 1. Add at least 1 class and 1 ID and style them 2. Style the background (colors, designs, etc.) 3. Style the sentences you wrote (colors, fonts, etc.) 4. Challenge: put some padding on the image and center it You have 5 minutes. If you are done or need help, raise your hand.