SlideShare uma empresa Scribd logo
1 de 21
BEGIN LAB 1
Establishing page structure
It’s time for our fist lab. Let’s set up our very first HTML5 web page. Then, we’ll write some CSS and have
that CSS applied to one or more DOM elements in that page.
Before we actually write any code, we’ll need to set up a folder structure to keep everything in our
project organized. Go to your file system and create the folder structure depicted below, which will help
us keep our project files organized.
As a convenience, the images below will demonstrate how to create folders both on a PC and on a Mac.
Once the folders have been created as shown above, open up your instance of the notepad++ code
editor and enter the following code (without the line numbers).
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>My First Page</title>
5 </head>
6 <body>
7 <h1>My First Heading</h1>
8 <p>My first paragraph.</p>
9 </body>
10 </html>
Save the file as index_v1.html, inside your intro_to_web_dev folder. Your folder and file structure
should now look like the image shown below.
Now, double-click on the newly-created index_v1.html file. It should open in your default browser and appear as
shown below.
We’ll explain each line, one-by-one
Line number 1 Every HTML page should begin with a DOCTYPE. What is a DOCTYPE? “A document type
declaration, or DOCTYPE, is an instruction that associates a particular SGML (Standard Generalized
Markup Language) or XML (Extensible Markup Language) document (for example, a webpage) with a
document type definition (DTD).
DOCTYPEs from earlier versions of HTML were longer (see the examples below) because the HTML
language was SGML-based (a sub-set of SGML) and therefore required a reference to a DTD.
With HTML5 this is no longer the case and the DOCTYPE is only needed to enable (trigger in the browser)
“standards mode” for documents written using the HTML syntax.
A few DOCTYPE examples -------------------
The DOCTYPE for HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
The DOCTYPE for HTML 4.01 Transitional -------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
All that you really need to know is that there are different kinds of DOCTYPEs and that the only one required for use
by HTML5 (thankfully) is the very simple one shown on line 1 above: <!DOCTYPE html>
Lines number 2 and 10 As mentioned earlier, HTML tags usually come in pairs (there are a few exceptions –
we’ll talk about them later), with a start tag and an end tag. What you see, on lines number 2 and 10, are the
opening and closing HTML <html></html>tags.
Your web browser will interpret everything between these two tags as HTML markup.
These are the opening and closing HTML <head></head> tags. These tags should
always be at the top (or the “head”) of your HTML document, just inside of the opening <html> tag.
There are a few different ways to incorporate things such as CSS
and JavaScript into your page.
The best way (for the sake of organization) is to have your CSS and JavaScript in stand-alone files and brought into
your page by means of either a
<link rel="stylesheet" href="…”> statement as in the case of CSS or, in the case of JavaScript, opening and closing
script tags, as shown below . . .
Lines number 3 and 5
How to add CSS and JavaScript to your project
<script src=”…”></script>
For the purposes of this course, this is the method that we will use.
The CSS rule set in your centrally-located file might look like this:
.boldBlue {
color:blue;
font-weight:bold;
}
These are your <title></title> HTML tags along with the actual title information inside them.
They control what the browser will show as your page’s title as well as what Google will see as your document’s title.
Title tags are also important for usability (think screen readers) and Search Engine Optimization (SEO).
These are the opening and closing HTML <body></body> tags. Your page’s main content –
that is, your copy (textual content), forms, buttons, images, multimedia, etc. These elements should always be
nested between your opening and closing body tags.
Line number 4
Lines number 6 and 9
These are examples of actual web page DOM elements created using the heading 1 (<h1>)
and paragraph (<p>) html tags – we’ll talk more about these as well as other HTML tags as we go along in the course.
Lines number 6 and 9
END LAB 1 - BEGIN LAB 2
The <head> tags and scripts
Ok – with those reminders firmly in place, it’s time for our second lab. Go back to our index_v1.html file in your
code editor and very carefully change the code so that it looks like the lines shown below in blue. Then save the file
as “index_v2.html”.
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <meta charset="utf-8">
5. <meta name="viewport" content="width=device-width, initial-scale=1">
6. <meta name="description" content="The Tuscany Cooking School">
7. <title>Tuscany Cooking School</title>
8. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
9. </head>
10. <body>
11. <h1>My First Heading</h1>
12. <p>My first paragraph.</p>
13. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
14. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
15. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
16. <script src="js/ie10-viewport-bug-workaround.js"></script>
17. <script src="js/cooking.js"></script>
18. </body>
19. </html>
You should now have two files inside your intro_to_web_dev folder as depicted below.
Let’s walk through the new code, line-by-line:
<meta charset="utf-8">
From https://www.quora.com/What-is-UTF8: “UTF-8 is a compromise character encoding that can be as
compact as ASCII (if the file is just plain English text) but can also contain any unicode characters (with
some increase in file size). UTF stands for Unicode Transformation Format. The '8' means it uses 8-bit blocks
to represent a character.”
<meta name="viewport" content="width=device-width, initial-scale=1">
The “viewport” is merely the viewable portion of the browser – where we see the content of the site (take
a look at the image below). The “width=device-width” part sets the width of the page to equal the screen-
width of the device its’ being viewed on and “initial-scale=1” defines the scale of the website. This
parameter sets the initial zoom level, which means 1 CSS pixel is equal to 1 viewport pixel.
Line number 4
Line number 5
<meta name="description" content="The Tuscany Cooking School">
Just as the name suggests, the description meta tag (see the image below) tells search engines and
screen readers what your site is about.
Line number 6
<title>Tuscany Cooking School</title>
The information in meta <title> tags is usually shown in SERP (Search Engine Results Pages - See the image below) and
in the tabs of browsers.
Line number 7
Next, we pull in a CSS resource by use of the <link> tag. This will be a stand-alone CSS file.
The <link> tag can be complex looking, but it has a very simple function. Technical writer Clair Broadley, has
provided a great explanation of what the tag does at https://html.com/attributes/link-rel/: “The <link> element
creates a link between your HTML document and an external resource. The rel attribute specifies the relationship
between the two documents”.
In our case, we’ll be linking in two external resources. Link tags are one of a handful of HTML tags that are self-
closing, that is, they do not require something like </link>.
Line number 8 <link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-
BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
If you look closely at the path information in the link tag’s href attribute, you’ll notice that this resource,
Bootstrap’s CSS file, is being pulled from a CDN (Content Delivery Network) named maxcdn. CDN’s have very
powerful servers that are optimized for pure speed and security, so the use of CDN’s is a common practice, for
obvious reasons.
The integrity and crossorigin attributes in our link tag are used for Subresource Integrity (SRI) checking. This is a
security measure that lets browsers ensure that resources hosted on third-party servers (like CDN’s) have not
been tampered with.
Use of SRI is recommended as a best-practice, whenever libraries are loaded from a third-party source.
You can read more at srihash.org. Cross-Origin Resource Sharing (CORS) is a W3C (World Wide Web Consortium)
specification.
Lines no. 13, 14, 16 & 17 Next, we have four <script> tags used to pull in some JavaScript, as well as some
commented information:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-
Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
<script src="js/cooking.js"></script>
The first <script> tag (line no. 13) is pulling in the JavaScript library jQuery from a Google CDN – both Microsoft and
Google host jQuery.
The second <script> tag (line no. 14) is pulling in a minified version of Bootstrap’s JavaScript file – we’ll talk a lot
more about what Bootstrap is and what is does a bit later.
Before we get to the last two <script> tags, we see some information provided between opening and closing HTML
comment delimiters like these: <!-- -->
Put simply, comment tags allow developers to insert information that the browser’s parsing engine knows to ignore
(these tags aren’t used to create or manipulate the page content such as text, images, buttons or input fields), but
that would be helpful or instructive to human readers.
Comment tags are not only used in HTML markup, but also in CSS, JavaScript and many other programming
languages. In this case, the commented information is just telling us that the next (3rd) <script> tag (line no. 16), will
pull in some JavaScript used to get around a bug found in the way IE 10 handles the viewport.
The 4th and final <script> tag (line no. 17) will incorporate a stand-alone script that we will generate ourselves.
Notice that the src (source) attribute of the last two <script> tags does not start with a web URL (Uniform Resource
Locator) such as https://www. … -- but rather simply with “js”. This syntax tells the browser to simply look in the
same folder that the file it is currently displaying is in, for another folder named “js”. Inside of that folder, it will
expect to find the resource named, “cooking.js”.
If you double-click on our newly-created index_v2.html file, it should open in your default web browser and look
pretty close to the depiction below:
END OF LABS 1 and 2 – RETURN TO MAIN TEXT

Mais conteúdo relacionado

Mais procurados

Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>tutorialsruby
 
An Introduction To HTML5
An Introduction To HTML5An Introduction To HTML5
An Introduction To HTML5Robert Nyman
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Parsing strange v3
Parsing strange v3Parsing strange v3
Parsing strange v3Hal Stern
 
Vision academy sachinsir_9822506209_html_java_script_notes (1)
Vision academy sachinsir_9822506209_html_java_script_notes (1)Vision academy sachinsir_9822506209_html_java_script_notes (1)
Vision academy sachinsir_9822506209_html_java_script_notes (1)ShraddhaGurav7
 
Intr to-html-xhtml-1233508169541646-3
Intr to-html-xhtml-1233508169541646-3Intr to-html-xhtml-1233508169541646-3
Intr to-html-xhtml-1233508169541646-3bluejayjunior
 
Technical seo tips for web developers
Technical seo tips for web developersTechnical seo tips for web developers
Technical seo tips for web developersSingsys Pte Ltd
 
Html5 tutorial
Html5 tutorialHtml5 tutorial
Html5 tutorialmadhavforu
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pagesNilesh Bafna
 
Html5, a gentle introduction
Html5, a gentle introduction Html5, a gentle introduction
Html5, a gentle introduction Diego Scataglini
 
Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesCurelet Marius
 
Html 5, a gentle introduction
Html 5, a gentle introductionHtml 5, a gentle introduction
Html 5, a gentle introductionDiego Scataglini
 
Origins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTMLOrigins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTMLHowpk
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Thomas Daly
 

Mais procurados (18)

Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
 
An Introduction To HTML5
An Introduction To HTML5An Introduction To HTML5
An Introduction To HTML5
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Web page concept final ppt
Web page concept  final pptWeb page concept  final ppt
Web page concept final ppt
 
Parsing strange v3
Parsing strange v3Parsing strange v3
Parsing strange v3
 
Uta005 lecture2
Uta005 lecture2Uta005 lecture2
Uta005 lecture2
 
Vision academy sachinsir_9822506209_html_java_script_notes (1)
Vision academy sachinsir_9822506209_html_java_script_notes (1)Vision academy sachinsir_9822506209_html_java_script_notes (1)
Vision academy sachinsir_9822506209_html_java_script_notes (1)
 
Intr to-html-xhtml-1233508169541646-3
Intr to-html-xhtml-1233508169541646-3Intr to-html-xhtml-1233508169541646-3
Intr to-html-xhtml-1233508169541646-3
 
Technical seo tips for web developers
Technical seo tips for web developersTechnical seo tips for web developers
Technical seo tips for web developers
 
Html5 tutorial
Html5 tutorialHtml5 tutorial
Html5 tutorial
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Html5, a gentle introduction
Html5, a gentle introduction Html5, a gentle introduction
Html5, a gentle introduction
 
Intro to html 5
Intro to html 5Intro to html 5
Intro to html 5
 
Performance Of Web Applications On Client Machines
Performance Of Web Applications On Client MachinesPerformance Of Web Applications On Client Machines
Performance Of Web Applications On Client Machines
 
Html 5, a gentle introduction
Html 5, a gentle introductionHtml 5, a gentle introduction
Html 5, a gentle introduction
 
Lecture1and2
Lecture1and2Lecture1and2
Lecture1and2
 
Origins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTMLOrigins and evolution of HTML and XHTML
Origins and evolution of HTML and XHTML
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
 

Semelhante a Web technologies part-2

Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAPJeanie Arnoco
 
Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1Paxcel Technologies
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1Shawn Calvert
 
Twitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptTwitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptRadheshyam Kori
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3Gopi A
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateSean Burgess
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3Usman Mehmood
 
01. 02. html web engineering html &amp; introduction
01. 02. html   web engineering html &amp; introduction01. 02. html   web engineering html &amp; introduction
01. 02. html web engineering html &amp; introductionN Gull
 
Industrial training report
Industrial training report Industrial training report
Industrial training report Akash Kr Sinha
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabadCss Founder
 

Semelhante a Web technologies part-2 (20)

HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
 
Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1Html5 deciphered - designing concepts part 1
Html5 deciphered - designing concepts part 1
 
HTML Foundations, part 1
HTML Foundations, part 1HTML Foundations, part 1
HTML Foundations, part 1
 
Twitter bootstrap training_session_ppt
Twitter bootstrap training_session_pptTwitter bootstrap training_session_ppt
Twitter bootstrap training_session_ppt
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3
 
Html and html5 cheat sheets
Html and html5 cheat sheetsHtml and html5 cheat sheets
Html and html5 cheat sheets
 
01. 02. html web engineering html &amp; introduction
01. 02. html   web engineering html &amp; introduction01. 02. html   web engineering html &amp; introduction
01. 02. html web engineering html &amp; introduction
 
Industrial training report
Industrial training report Industrial training report
Industrial training report
 
ashish ppt webd.pptx
ashish ppt webd.pptxashish ppt webd.pptx
ashish ppt webd.pptx
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabad
 
Introduction css
Introduction cssIntroduction css
Introduction css
 

Último

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 

Último (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 

Web technologies part-2

  • 1. BEGIN LAB 1 Establishing page structure It’s time for our fist lab. Let’s set up our very first HTML5 web page. Then, we’ll write some CSS and have that CSS applied to one or more DOM elements in that page. Before we actually write any code, we’ll need to set up a folder structure to keep everything in our project organized. Go to your file system and create the folder structure depicted below, which will help us keep our project files organized.
  • 2. As a convenience, the images below will demonstrate how to create folders both on a PC and on a Mac.
  • 3. Once the folders have been created as shown above, open up your instance of the notepad++ code editor and enter the following code (without the line numbers). 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>My First Page</title> 5 </head> 6 <body> 7 <h1>My First Heading</h1> 8 <p>My first paragraph.</p> 9 </body> 10 </html> Save the file as index_v1.html, inside your intro_to_web_dev folder. Your folder and file structure should now look like the image shown below.
  • 4. Now, double-click on the newly-created index_v1.html file. It should open in your default browser and appear as shown below.
  • 5.
  • 6. We’ll explain each line, one-by-one Line number 1 Every HTML page should begin with a DOCTYPE. What is a DOCTYPE? “A document type declaration, or DOCTYPE, is an instruction that associates a particular SGML (Standard Generalized Markup Language) or XML (Extensible Markup Language) document (for example, a webpage) with a document type definition (DTD). DOCTYPEs from earlier versions of HTML were longer (see the examples below) because the HTML language was SGML-based (a sub-set of SGML) and therefore required a reference to a DTD. With HTML5 this is no longer the case and the DOCTYPE is only needed to enable (trigger in the browser) “standards mode” for documents written using the HTML syntax.
  • 7. A few DOCTYPE examples ------------------- The DOCTYPE for HTML 4.01 Strict <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> The DOCTYPE for HTML 4.01 Transitional ------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> All that you really need to know is that there are different kinds of DOCTYPEs and that the only one required for use by HTML5 (thankfully) is the very simple one shown on line 1 above: <!DOCTYPE html>
  • 8. Lines number 2 and 10 As mentioned earlier, HTML tags usually come in pairs (there are a few exceptions – we’ll talk about them later), with a start tag and an end tag. What you see, on lines number 2 and 10, are the opening and closing HTML <html></html>tags. Your web browser will interpret everything between these two tags as HTML markup. These are the opening and closing HTML <head></head> tags. These tags should always be at the top (or the “head”) of your HTML document, just inside of the opening <html> tag. There are a few different ways to incorporate things such as CSS and JavaScript into your page. The best way (for the sake of organization) is to have your CSS and JavaScript in stand-alone files and brought into your page by means of either a <link rel="stylesheet" href="…”> statement as in the case of CSS or, in the case of JavaScript, opening and closing script tags, as shown below . . . Lines number 3 and 5 How to add CSS and JavaScript to your project
  • 9. <script src=”…”></script> For the purposes of this course, this is the method that we will use. The CSS rule set in your centrally-located file might look like this: .boldBlue { color:blue; font-weight:bold; } These are your <title></title> HTML tags along with the actual title information inside them. They control what the browser will show as your page’s title as well as what Google will see as your document’s title. Title tags are also important for usability (think screen readers) and Search Engine Optimization (SEO). These are the opening and closing HTML <body></body> tags. Your page’s main content – that is, your copy (textual content), forms, buttons, images, multimedia, etc. These elements should always be nested between your opening and closing body tags. Line number 4 Lines number 6 and 9
  • 10. These are examples of actual web page DOM elements created using the heading 1 (<h1>) and paragraph (<p>) html tags – we’ll talk more about these as well as other HTML tags as we go along in the course. Lines number 6 and 9 END LAB 1 - BEGIN LAB 2 The <head> tags and scripts Ok – with those reminders firmly in place, it’s time for our second lab. Go back to our index_v1.html file in your code editor and very carefully change the code so that it looks like the lines shown below in blue. Then save the file as “index_v2.html”.
  • 11. 1. <!DOCTYPE html> 2. <html> 3. <head> 4. <meta charset="utf-8"> 5. <meta name="viewport" content="width=device-width, initial-scale=1"> 6. <meta name="description" content="The Tuscany Cooking School"> 7. <title>Tuscany Cooking School</title> 8. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 9. </head> 10. <body> 11. <h1>My First Heading</h1> 12. <p>My first paragraph.</p> 13. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 14. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 15. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> 16. <script src="js/ie10-viewport-bug-workaround.js"></script> 17. <script src="js/cooking.js"></script> 18. </body> 19. </html>
  • 12. You should now have two files inside your intro_to_web_dev folder as depicted below.
  • 13. Let’s walk through the new code, line-by-line: <meta charset="utf-8"> From https://www.quora.com/What-is-UTF8: “UTF-8 is a compromise character encoding that can be as compact as ASCII (if the file is just plain English text) but can also contain any unicode characters (with some increase in file size). UTF stands for Unicode Transformation Format. The '8' means it uses 8-bit blocks to represent a character.” <meta name="viewport" content="width=device-width, initial-scale=1"> The “viewport” is merely the viewable portion of the browser – where we see the content of the site (take a look at the image below). The “width=device-width” part sets the width of the page to equal the screen- width of the device its’ being viewed on and “initial-scale=1” defines the scale of the website. This parameter sets the initial zoom level, which means 1 CSS pixel is equal to 1 viewport pixel. Line number 4 Line number 5
  • 14.
  • 15. <meta name="description" content="The Tuscany Cooking School"> Just as the name suggests, the description meta tag (see the image below) tells search engines and screen readers what your site is about. Line number 6
  • 16. <title>Tuscany Cooking School</title> The information in meta <title> tags is usually shown in SERP (Search Engine Results Pages - See the image below) and in the tabs of browsers. Line number 7
  • 17. Next, we pull in a CSS resource by use of the <link> tag. This will be a stand-alone CSS file. The <link> tag can be complex looking, but it has a very simple function. Technical writer Clair Broadley, has provided a great explanation of what the tag does at https://html.com/attributes/link-rel/: “The <link> element creates a link between your HTML document and an external resource. The rel attribute specifies the relationship between the two documents”. In our case, we’ll be linking in two external resources. Link tags are one of a handful of HTML tags that are self- closing, that is, they do not require something like </link>. Line number 8 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384- BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  • 18. If you look closely at the path information in the link tag’s href attribute, you’ll notice that this resource, Bootstrap’s CSS file, is being pulled from a CDN (Content Delivery Network) named maxcdn. CDN’s have very powerful servers that are optimized for pure speed and security, so the use of CDN’s is a common practice, for obvious reasons. The integrity and crossorigin attributes in our link tag are used for Subresource Integrity (SRI) checking. This is a security measure that lets browsers ensure that resources hosted on third-party servers (like CDN’s) have not been tampered with. Use of SRI is recommended as a best-practice, whenever libraries are loaded from a third-party source. You can read more at srihash.org. Cross-Origin Resource Sharing (CORS) is a W3C (World Wide Web Consortium) specification.
  • 19. Lines no. 13, 14, 16 & 17 Next, we have four <script> tags used to pull in some JavaScript, as well as some commented information: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384- Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="js/ie10-viewport-bug-workaround.js"></script> <script src="js/cooking.js"></script> The first <script> tag (line no. 13) is pulling in the JavaScript library jQuery from a Google CDN – both Microsoft and Google host jQuery. The second <script> tag (line no. 14) is pulling in a minified version of Bootstrap’s JavaScript file – we’ll talk a lot more about what Bootstrap is and what is does a bit later.
  • 20. Before we get to the last two <script> tags, we see some information provided between opening and closing HTML comment delimiters like these: <!-- --> Put simply, comment tags allow developers to insert information that the browser’s parsing engine knows to ignore (these tags aren’t used to create or manipulate the page content such as text, images, buttons or input fields), but that would be helpful or instructive to human readers. Comment tags are not only used in HTML markup, but also in CSS, JavaScript and many other programming languages. In this case, the commented information is just telling us that the next (3rd) <script> tag (line no. 16), will pull in some JavaScript used to get around a bug found in the way IE 10 handles the viewport. The 4th and final <script> tag (line no. 17) will incorporate a stand-alone script that we will generate ourselves. Notice that the src (source) attribute of the last two <script> tags does not start with a web URL (Uniform Resource Locator) such as https://www. … -- but rather simply with “js”. This syntax tells the browser to simply look in the same folder that the file it is currently displaying is in, for another folder named “js”. Inside of that folder, it will expect to find the resource named, “cooking.js”.
  • 21. If you double-click on our newly-created index_v2.html file, it should open in your default web browser and look pretty close to the depiction below: END OF LABS 1 and 2 – RETURN TO MAIN TEXT