Computer Project
Computer Project
Chainpur, Bara
Submitted by:
Submitted to:
Roll no:8
Subject Teacher’s Signature
Principal’s Signature
Acknowledgment
I want to express my sincere thanks to everyone who helped
make the “HTML and CSS” project happen. Firstly, a big shoutout
to our teacher, Mr. Deepak Sarraf, for guiding us and sharing
valuable insights throughout the project. A heartfelt appreciation
goes out to online communities, forums, and web development
resources that provided a ton of information and inspiration,
creating a fantastic learning environment.
Sincerely,
Bridhi Agarwal
Class: 10 “Theta”
Certificate
Sumedha
Khandelwal
Of Class 10 ‘Theta’ has Successfully
completed her
Computer Applications project on
“HTML and CSS”.
Mr. Deepak Sarraf
CONTENTS
1. Introduction to HTML with features
What is HTML?
Features of HTML
2. Pre-Requisites
Text Editor and Web Browser
3. Tags
Types of Tags
Container Tags
Empty Tags
4. Elements and Attributes
*Structure of an HTML document
5. Comments
6. Creating Lists
Ordered List and Unordered List
Definition List
Nested List
7. Insertion of Image
<img> tag and its Attributes
8. Cell Padding and Cell Spacing
Table tag and its attributes
9. Linking
Internal and External Linking
<a> tag
10. Mailto
11. Embedding Multimedia Object
12. Selector, Property and Value
13. Link Style Sheets
Internal, External and Inline Style Sheets
14. CSS Border
15. CSS Margins
16. CSS Outline
17. CSS Font
What is HTML?’
HTML is a markup language which is used to mark the contents
that helps in designing web pages.
History of HTML:
HTML, born in 1991, was crafted by Tim Berners-Lee for the
nascent World Wide Web. Evolving from basic tags in HTML 1.0
to the richer features of HTML5 in 2014, it has been a
cornerstone for structuring web content. HTML5, with its
multimedia support and enhanced semantics, revolutionized web
development, shaping the dynamic online experiences we enjoy
today.
Features of Html:
1. Semantic Structure:
- HTML provides a semantic structure through tags like
`<header>`, `<nav>`, `<section>`, and `<footer>`,
enhancing document readability and accessibility.
3. Multimedia Integration:
- With tags like `<img>`, `<audio>`, and `<video>`,
HTML enables seamless integration of multimedia content,
enhancing the richness of web pages.
Brief Note:
HTML’s strength lies in its ability to structure content
semantically, handle user input through forms, seamlessly
integrate multimedia elements, and facilitate effective
navigation through hyperlinks. These features collectively
contribute to creating dynamic and interactive web pages.
2. Pre-Requisites:
Text Web
Editor Browser
Text Editor:
A text editor is a software tool for creating and editing plain text files.
It provides a simple interface for manipulating text without formatting.
Popular text editors include Notepad, Sublime Text, and Visual Studio
Code. They are essential for coding, scripting, and basic document
editing.
Web Browser:
A web browser is a software application
for accessing information on the
internet. It interprets HTML documents
to display web pages, enabling users to
navigate the web. Popular examples
include Chrome, Firefox, Safari, and
Edge. Browsers also support additional
features like bookmarks, extensions, and private browsing..
3. Tags:
HTML tags are elements that define the structure of a web page. They
consist of an opening tag, content, and a closing tag, enclosed in angle
brackets (e.g., `<p>content</p>`). Tags provide instructions for
rendering elements like paragraphs, headings, and links on a webpage.
i. Container Tags:
Tags utilized in pairs are termed ‘container tags,’ featuring both an
opening and a closing tag. The closing tag mirrors the opening tag but
includes a slash (/) before it. These tags delineate a text section and
dictate the formatting for all content within. They are alternatively
known as Paired tags.
Example:
Output: Hello
Standalone tags without pairs are called Empty tags. They lack an
ending tag and represent ‘one-time’ instructions, used for tasks like
line breaks or inserting images. Empty tags have only an ON tag (start
tag) and perform their task at the point of insertion. These tags are
also referred to as Singular tags.
<HR>
It is used to add a horizontal rule or line across the webpage.
<BR>
It is used add a line break in between sentences.
Example:
Hlo
<br>
hi
Output:
Hello
Hi
Elements:
HTML elements are fundamental units in web development,
composed of start tags, content, and end tags enclosed in angle
brackets (e.g., `<p>paragraph</p>`). These elements define
the structure and content of a webpage, ranging from headings
and paragraphs to links and images.
I. A start tag
II. An end tag
III. The content between start and end tags
So, the syntax of an element is:
<Opening tag> content </closing tag>
For example:
<h1>Hello </h1>
Here, <h1> is the start tag and </h1> is the end tag. “Hello” is
the content between the two tags.
This is an example of the Heading element.
Attributes:
For example:
<body bgcolor=”pink”>
The “bgcolor” is the name for the attribute of the <body> tag
and “pink” is its value.
5. Comments:
HTML comments provide a way to insert notes within the code, aiding
developers in understanding and documenting specific sections.
Comments are not visible to users on the webpage but serve as helpful
annotations for those working on the codebase.
6. Creating Lists:
1. Ordered List:
An ordered list is a list in which the items are numbered and presented
in an orderly manner.
In HTML, an ordered list is created using the <ol> (ordered list) and
<li> (list item) tags. The <ol> tag is used to define the start of the
ordered list, and each list item is marked with the <li> tag. The
ordered list renders items with sequential numbers, automatically
incrementing for each list item. This structured approach is beneficial
when presenting information that follows a specific order or sequence
on a webpage.
The <ol> tag is not an empty element, so it has a closing tag in </ol>
<ol>
<li>...</li>
<li>...</li>
<li>...</li>
</ol>
<ol>
<li>HTML</li>
<li>CSS</li>
</ol>
Output:
1.HTML
2.CSS
2. Unordered List:
HTML Unordered List or Bulleted List displays elements in
bulleted format. We can use unordered list where we do not
need to display items in any particular order. The HTML ul tag is
used for the unordered list. There can be 4 types of bulleted list:
Disc
Circle
Square
Syntax to use <ul> tag:
<ul type=”value”>
<li>…</li>
<li>…</li>
<li>…</li>
</ul>
Example:
<ul type=”circle”>
<li>HTML</li>
<li>CSS</li>
</ul>
Output:
• HTML
• CSS
Fig-Representing Ul list
Definition List:
In HTML, a definition list is created using the <dl> tag, and it
consists of a series of terms and their associated descriptions.
The terms are defined using the <dt> tag (definition term), and
the corresponding descriptions are enclosed in <dd> tags
(definition description).
<dl>
<dt>Term 1</dt>
<dd>Description of Term 1.</dd>
<dt>Term 2</dt>
<dd>Description of Term 2.</dd>
Output-
●Term 1
•Description of Term 1.
●Term 2
•Description of Term 2.
7. Insertion of images:
1.Definition:
In HTML, images enhance the visual appeal and content
presentation of webpages. They play a crucial role in conveying
information, creating engaging interfaces, and making websites
more visually attractive.
3. Attributes:
1. src (Source):
- Syntax:*`<img src=”image.jpg” alt=”Description”>`
- Note: Specifies the path or URL of the image. The `alt`
attribute provides alternative text for accessibility and displays if
the image fails to load.
2. width:
- Syntax: `<img src=”image.jpg” alt=”Description”
width=”300”>`
- Note: Sets the width of the image in pixels. Maintains the
aspect ratio if height is not explicitly specified.
3. height:
- Syntax: `<img src=”image.jpg” alt=”Description”
height=”200”>`
- Note: Specifies the height of the image in pixels. Maintains
aspect ratio if width is not specified.
5. title:
- Syntax: `<img src=”image.jpg” alt=”Description”
title=”Additional info”>`
- Note: Displays additional information when the user hovers
over the image.
Inserting an Image:
Output:
To know about the above topic, its firstly important to know about
html table , In HTML, a table is created using the `<table>` tag. It
consists of rows and columns, with specific tags for defining headers,
data cells, and other elements. Here's a breakdown of key table-
related tags and their attributes:
1. <table>:
- Definition: Defines the beginning of a table.
- Attributes:
- `border`: Specifies the width of the border around the table.
2. <tr>:
- Definition: Represents a table row.
- Syntax: `<tr>`
3. <th>:
- Definition: Defines a header cell in a table.
- Attributes:
- `colspan`: Specifies the number of columns a header cell should
span.
- `rowspan`: Specifies the number of rows a header cell should
span.
- Syntax: `<th colspan="2" rowspan="1">Header</th>`
4. <td>:
- Definition: Represents a data cell in a table.
- Attributes:
- `colspan`: Specifies the number of columns a data cell should
span.
- `rowspan`: Specifies the number of rows a data cell should span.
- Syntax: `<td colspan="2" rowspan="1">Data</td>`
5. <caption>:
- Definition: Defines a table caption (a title for the table).
- Syntax: `<caption>Caption Text</caption>`
Here's a basic example of a table with two rows and two columns:
<table border="1">
<caption>Sample Table</caption>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Output:
Sample Table
Header 1 Header 2
Data 1 Data 2
1. Cellspacing:
- Description: Adjusts the space between adjacent cells within
the table.
- Usage:`<table cellspacing=”value”>`
2. Cellpadding:
- Description: Defines the space between the content and the
borders inside each table cell.
- Usage: <table cellpadding=”value”>`
An Example Of Table-
Syntax-
<table>
<tr>
<th>Name</th>
<th>Job Title</th>
<th>Email address</th>
</tr>
<tr>
<td>Anna Fitzgerald</td>
<td>Staff Writer</td>
<td>[email protected]</td>
</tr>
<tr>
<td>John Smith</td>
<td>Marketing Manager</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Zendaya Grace</td>
<td>CEO</td>
<td>[email protected]</td>
</tr>
</table>
Output:
9. Linking:
A hyperlink, often called a link, is a reference linking one resource to
another. It includes a clickable element like a word, phrase, image, or
icon.
And coding your own hyperlinks is easy. As long as you understand the
syntax of an anchor element (also known as an <a> tag).
Search engines also use anchor text to understand the page you’re
linking to. So good anchor text can improve your SEO.
The title attribute shows text when users hover over a link:
For example, tell users where they’ll end up if they click the link.
In this example, the title text could say something like, “click this
link for an in-depth guide on this topic at www.example.com.”
11. Embedding Multimedia Objects:
You can add audio and video in your web page by using the <AUDIO>
and <VIDEO> tags. Let us learn about them:
<AUDIO CONTROLS>
<SOURCE SRC=”Name of the Audio File” TYPE=”AUDIO/WAV”>
</AUDIO>
Example:
The text between the <video> and </video> tags will only be
displayed in browsers that do not support the <video> element.
Example:
When you style your HTML page, you need to tell CSS where and how
to apply those styles. After all, just because you want headers to be
blue doesn’t mean you also want paragraphs to be blue. You can select
which elements you want styled a certain way using selectors. There
are many different types of selectors. Let’s go over each one.
Tag selectors are used to select elements by their tag name. For
example, to select all <p> elements, you would use the following
selector:
Class selectors are
used to select elements
by their class. For example, to select all elements with the
class=”planet” class, you would use the following selector:
Class selectors start with a . and can be used in the same way as tag
selectors.
Syntax:
Selector {Property: Value}
Selector:
Selector signifies the HTML tag to which style will be applied.
Selector can be any tag like <H1>, <TABLE>, <P>, etc.
CSS provides a way to target those elements too. All you need to
do is append the attribute inside square brackets. For example,
to select all a elements with the href attribute, you would use the
following selector:
Step 1: Type the code and save file with .css extension.
Step 2: When the web page is opened, the following output is obtained:
Output:
Inline Style:
Example:
14. CSS Border:
The CSS border properties enable to specify the style, width and color
of a border.
Border Style
The border-style shorthand CSS property sets the line style for all four
sides of an element’s border. The ‘border-style’ property specifies the
outline style of the border. Some of the outline styles are:
Syntax to use Border-style:
<p style=”border-style: Name of the style”>
Text
</p>
Border Color
Example syntax:
Border-color: red green blue yellow;
In this example, the top border will be red, the right border will be
green, the bottom border will be blue, and the left border will be
yellow. If fewer than four values are provided, the missing values will
be taken from the opposite side in a clockwise order.
Border width
The `border-width` property in CSS is used to set the width of the
borders of an element. It can be applied to all four sides (top, right,
bottom, left) individually or in a shorthand notation for all sides.
● Individual Sides:
You can set the width of each border independently using the syntax:
Example:
Border-width: 2px 1px 3px 4px;
This sets the top border to 2 pixels, right border to 1 pixel, bottom
border to 3 pixels, and left border to 4 pixels.
●Shorthand Notation:
You can use a single value to set the same width for all borders or two,
three, or four values for a specific order (top, right, bottom, left).
●Long Description:
The `border-width` property provides flexibility in defining the
thickness of borders, allowing for customization at the individual side
level or using a shorthand notation for succinct declarations. This
versatility aids in creating visually appealing and structured layouts by
specifying precise border widths for different sides or applying uniform
thickness across all borders. The property’s syntax accommodates a
range of values, enabling developers to tailor the appearance of
borders with precision and efficiency in Cascading Style Sheets (CSS).
The margin CSS shorthand property sets the margin area on all four
sides of an element.
● Constituent properties
Margin-top
Margin-right
Margin-bottom
Margin-left
/*Global values /
Margin: inherit;
Margin: initial;
Margin: revert;
Margin: revert-layer;
Margin: unset;
The margin property may be specified using one, two, three, or four
values. Each value is a <length>, a <percentage>, or the keyword
auto. Negative values draw the element closer to its neighbors than it
would be by default.
• When one value is specified, it applies the same margin to all four
sides.
•When two values are specified, the first margin applies to the top and
bottom, the second to the left and right.
•When three values are specified, the first margin applies to the top,
the second to the right and left, the third to the bottom.
•When four values are specified, the margins apply to the top, right,
bottom, and left in that order (clockwise).
●Values
The size of the margin as a fixed value: length
The size of the margin as a percentage, relative to the inline size
(width in a horizontal language, defined by writing-mode) of the
containing block: percentage
The browser selects a suitable margin to use. For example, in certain
cases this value can be used to center an element: auto
●Description
This property can be used to set a margin on all four sides of an
element. Margins create extra space around an element, unlike
padding, which creates extra space within an element.
Outline differs from borders! Unlike border, the outline is drawn outside
the element’s border, and may overlap other content. Also, the outline
is NOT a part of the element’s dimensions; the element’s total width
and height is not affected by the width of the outline.The outline-style
property specifies the style of the outline, and can have one of the
following values:
Syntax:
</p>
CSS font properties are used to adjust the appearance of the text in an
HTML document. Using the CSS fonts properties, we can customize the
font family, size, weight, style, and color of text.
Font Family:
CSS font-family property is used to set the font face of the text on the
webpage. For example,
Syntax:
H1 {
Font-family: Courier, monospace;
}
Font Style:
The font-style property is mostly used to make the text ‘italic’. Other
types of font styles are normal and oblique.
Syntax:
h1.normal {
font-style: normal;
}
h1.italic {
font-style: italic;
}
h1.oblique {
font-style: oblique;
}
Output:
Font Size:
Syntax:
h1 {
/sets the font size of h1 element to 36px /
font-size: 42px;
}
p{
/*sets the font size to p element to 24px /
font-size: 24px;
}
Output:
THANK YOU