Web Development Task1
Web Development Task1
what is HTML?
HTML (HyperText Markup Language) is a markup language that
defines the structure of your content. HTML consists of a series
of elements, which you use to enclose, or wrap, different parts of
the content to make it appear a certain way, or act a certain way.
The enclosing tags can make a word or image hyperlink to
somewhere else, can italicize words, can make the font bigger or
smaller, and so on. For example, take the following line of content:
If we wanted the line to stand by itself, we could specify that it is a
paragraph by enclosing it in paragraph tag:
Empty elements:
Some elements have no content and are called empty elements.
Take the <img> element that we already have in our HTML page:
<img src="images/firefox-icon.png" alt="My test image">
This contains two attributes, but there is no closing </img> tag and
no inner content. This is because an image element doesn't wrap
content to affect it. Its purpose is to embed an image in the HTML
page in the place it appears.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>My test page</title>
</head>
<body>
<img src="images/firefox-icon.png" alt="My test
image">
</body>
</html>
Copy to Clipboard
Here, we have the following:
<!DOCTYPE html> — doctype. In the mists of time, when HTML
was young (around 1991/92), doctypes were meant to act as links to
a set of rules that the HTML page had to follow to be considered
good HTML, which could mean automatic error checking and other
useful things. However these days, they don't do much and are
basically just needed to make sure your document behaves correctly.
That's all you need to know for now.j
<html></html> — the <html> element. This element wraps all the
content on the entire page and is sometimes known as the root
element.
<head></head> — the <head> element. This element acts as a
container for all the stuff you want to include on the HTML page
that isn't the content you are showing to your page's viewers. This
includes things like keywords and a page description that you want
to appear in search results, CSS to style our content, character set
declarations, and more.
<meta charset="utf-8"> — This element sets the character set your
document should use to UTF-8 which includes most characters from
the vast majority of written languages. Essentially, it can now handle
any textual content you might put on it. There is no reason not to set
this and it can help avoid some problems later on.
<title></title> — the <title> element. This sets the title of your
page, which is the title that appears in the browser tab the page is
loaded in. It is also used to describe the page when you
bookmark/favorite it.
<body></body> — the <body> element. This contains all the
content that you want to show to web users when they visit your
page, whether that's text, images, videos, games, playable audio
tracks, or whatever else.
Images :
Let's turn our attention to the <img> element again:
Marking up text
This section will cover some of the essential HTML elements you'll
use for marking up the text.
Headings:
Heading elements allow you to specify that certain parts of your
content are headings — or subheadings. In the same way that a book
has the main title, chapter titles, and subtitles, an HTML document
can too. HTML contains 6 heading levels, <h1> - <h6>, although
you'll commonly only use 3 to 4 at most:
Lists :
A lot of the web's content is lists and HTML has special elements for
these. Marking up lists always consists of at least 2 elements. The
most common list types are ordered and unordered lists:
Unordered lists are for lists where the order of the items doesn't
matter, such as a shopping list. These are wrapped in
a <ul> element.
Ordered lists are for lists where the order of the items does matter,
such as a recipe. These are wrapped in an <ol> element.
Each item inside the lists is put inside an <li> (list item) element.
For example, if we wanted to turn the part of the following
paragraph fragment into a list
<ul>
<li>technologists</li>
<li>thinkers</li>
<li>builders</li>
</ul>
Links:
Links are very important — they are what makes the web a web! To
add a link, we need to use a simple element — <a> — "a" being the
short form for "anchor". To make text within your paragraph into a
link, follow these steps:
Choose some text. We chose the text "Mozilla Manifesto".
Wrap the text in an <a> element, as shown below:
<a>Mozilla Manifesto</a>
Give the <a> element an href attribute, as shown below:
<a href="">Mozilla Manifesto</a>
Fill in the value of this attribute with the web address that you want
the link to:
<a href="https://www.mozilla.org/en-
US/about/manifesto/">Mozilla
Manifesto</a>
CSS( CASCADDING STYLE SHEET)
What is CSS?
Like HTML, CSS is not a programming language. It's not a markup
language either. CSS is a style sheet language. CSS is what you
use to selectively style HTML elements. For example, this CSS selects
paragraph text, setting the color to red:
p{
color: red;
}
• Open your index.html file. Paste the following line in the
head (between the <head> and </head> tags):
1. <link href="styles/style.css"
rel="stylesheet">
Selector
This is the HTML element name at the start of the ruleset. It defines
the element(s) to be styled (in this example, <p> elements). To style
a different element, change the selector.
Declaration
This is a single rule like color: red;. It specifies which of the
element's properties you want to style.
Properties
These are ways in which you can style an HTML element. (In this
example, color is a property of the <p> elements.) In CSS, you
choose which properties you want to affect in the rule.
Property value
To the right of the property—after the colon—there is the property
value. This chooses one out of many possible appearances for a
given property. (For example, there are many color values in
addition to red.)
Note the other important parts of the syntax:
Apart from the selector, each ruleset must be wrapped in curly
braces. ({})
Within each declaration, you must use a colon (:) to separate the
property from its value or values.
Within each ruleset, you must use a semicolon (;) to separate each
declaration from the next one.
To modify multiple property values in one ruleset, write them
separated by semicolons, like this:
p{
color: red;
width: 500px;
border: 1px solid black;
}
h1 {
font-size: 60px;
text-align: center;
}
p, li {
font-size: 16px;
line-height: 2;
letter-spacing: 1px;
}
CSS layout is mostly based on the box model. Each box taking up
space on your page has properties like:
padding, the space around the content. In the example below, it is
the space around the paragraph text.
border, the solid line that is just outside the padding.
margin, the space around the outside of the border.
In this section we also use:
width (of an element).
background-color, the color behind an element's content and
padding.
color, the color of an element's content (usually text).
text-shadow sets a drop shadow on the text inside an element.
display sets the display mode of an element. (keep reading to
learn more)
You may have noticed there's a horrible gap at the top of the body.
That happens because browsers apply default styling to
the <h1> element (among others). That might seem like a bad idea,
but the intent is to provide basic readability for unstyled pages. To
eliminate the gap, we overwrite the browser's default styling with
the setting margin: 0;.
Next, we set the heading's top and bottom padding to 20 pixels.
Following that, we set the heading text to be the same color as the
HTML background color.
Finally, text-shadow applies a shadow to the text content of the
element. Its four values are:
The first pixel value sets the horizontal offset of the shadow from
the text: how far it moves across.
The second pixel value sets the vertical offset of the shadow from
the text: how far it moves down.
The third pixel value sets the blur radius of the shadow. A larger
value produces a more fuzzy-looking shadow.
The fourth value sets the base color of the shadow.