HTML and Css Tutorial
HTML and Css Tutorial
4.
The
next
two
important
elements
to
add
to
your
HTML
file
are
the
head
and
body
elements,
your
HTML
file
should
look
like
this
now:
<html> <head> </head> <body> </body> </html>
The
head
functions
"behind
the
scenes."
Tags
placed
within
the
head
element
are
not
directly
displayed
by
web
browsers.
Other
elements
(CSS)
will
eventually
be
introduced
and
you
will
have
to
place
them
within
your
head
element.
For
now,
your
head
element
will
continue
to
lay
empty
except
for
the
title
element
that
will
be
introduced
next.
The
<body>
element
is
where
all
content
is
placed.
(Paragraphs,
pictures,
tables,
etc).
For
now,
it
is
only
important
to
understand
that
the
body
element
will
encapsulate
all
of
your
webpage's
viewable
content.
4.
Place
the
<title>
tag
within
the
<head>
element
to
title
your
page.
The
words
you
write
between
the
opening
and
closing
<title></title>
tags
will
be
displayed
at
the
top
of
a
viewer's
browser.
Below
is
the
html
code:
<html> <head> <title>My Title</title> </head> <body> </body> </html>
5. Lets create a heading using the h2 tag, this will display a title heading for our main page. Heading tags range from h1 to h6. Experiment with different ones or add multiple headings to code. <html> <head> <title>My Title</title> </head> <body> <h1>My h1 Heading</h1> <h2>My h2 Heading</h2> </body> </html> At this point if you navigate to the folder youve created and launch your HTML file, it should open in your web browser by default. If this doesnt happen right click and Open With a web browser of your choice. You should see a blank page with your title and headings in the browser. Play around and experiment with the different heading tags. 6. An example of break-line tag </br>. To tell the browser we want to place a line break (carriage return) onto the site, it is not necessary to type <br>linebreak</br>. Try the following code with and without the </br> tags and see the difference when you open the HTML page in a browser. The <p> element, is simply for a paragraph. <html> <head> <title>My Title</title> </head> <body> <h1>My h1 Heading</h1> <h2>My h2 Heading</h2> <p> This is my first sentence.</br> This is my second sentence.</br> This is my third sentence.</br> </p> </body> </html> You should be able to see changes by refreshing the page in your browser, just make sure to save the changes before refreshing your browser.
7. Download a image and save it in your folder, lets try adding the image to your HTML file. <html> <head> <title>My Title</title> </head> <body> <h1>My h1 Heading</h1> <h2>My h2 Heading</h2> <p> This is my first sentence.</br> This is my second sentence.</br> This is my third sentence.</br> </p> <h2>My Image</h2> <img src="image.jpg" /> </body> </html> 8. This was a very basic introduction to HTML, there are many more things that you can investigate, I recommend looking at and going through:
Cascading
Style
Sheets
(CSS)
are
a
way
to
control
the
look
and
feel
of
your
HTML
documents
in
an
organized
and
efficient
manner.
With
CSS
you
will
be
able
to:
Add new looks to your old HTML Completely restyle a web site with only a few changes to your CSS code Use the "style" you create on any webpage you wish!
A
stylesheet
can,
and
should
be
completely
separate
from
your
HTML
documents.
When
you
have
mastered
CSS
and
HTML,
you
will
be
able
to
separate
your
web
site's
design
and
formatting
(CSS)
from
the
content
(HTML).
Now create 2 new files in your editor and in the same folder, and save one as Spring.css, and the other as Wobbly.css Copy the code over from the following two links: http://staffnet.kingston.ac.uk/~ku33185/ToolBox/spring.css http://staffnet.kingston.ac.uk/~ku33185/ToolBox/wobbly.css
10.
Now
link
your
Spring.css
style
sheet
to
your
HTML
file:
<html> <head> <title>My Title</title> <link rel="stylesheet" type="text/css" href="Spring.css" /> </head> <body> <h1>My h1 Heading</h1> <h2>My h2 Heading</h2> <p> This is my first sentence.</br> This is my second sentence.</br> This is my third sentence.</br> </p> <h2>My Image</h2> <img src="image.jpg" /> </body> </html>
Now
try
changing
the
href="Spring.css"
above
to
href="Wobbly.css"
and
reload
the
page
to
see
the
difference.
Now
if
you
look
at
the
code
in
the
Spring.css
style
sheet
you
can
see
that
it
is
describing
features
of
the
h1,
h2,
h3,
and
h4
tags,
as
well
as
the
body.
Features
such
as
font,
colour
centering.
This
was
a
very
brief
introduction,
now
go
look
at
CSS
tutorials
online,
such
as:
http://www.w3schools.com/css/default.asp
also
experiment
with
making
changes
to
the
style
sheet.
Example
<html>
<head>
<title>My
new
webpage</title>
<link
rel="stylesheet"
type="text/css"
href="Spring.css"/>
</head>
<body>
<h1>My
new
heading
1</h1>
<h2>my
new
heading
2</h2>
<p>
this
is
my
first
sentence
</br>
this
is
my
second
sentence
</br>
this
is
my
third
sentence
</br>
</p>
<h2>mosdef</h2>
<img
src="mosdef.jpg"/>
<h3>jay
elctronica
video</h3>
<iframe
width="560"
height="315"
src="http://www.youtube.com/embed/dPO5L5mTM9o"
frameborder="0"
allowfullscreen></iframe>
</br>
</br>
<iframe
width="420"
height="315"
src="http://www.youtube.com/embed/qPRl0LzD_MA"
frameborder="0"
allowfullscreen></iframe>
<h4>Order
List</h4>
<ol>
<li>
hello
this
is
a
test</li>
<li>
hello
this
is
a
test</li>
<li>
hello
this
is
a
test</li>
</ol>
</body>
</html>