Professional Documents
Culture Documents
Sodapdf
Sodapdf
Sodapdf
Training Report
submitted
in partial fulfillment
Bachelor of Technology
in
Supervisor: Submitted
By:
of Technology
Rajasthan
Technical
University,
October, 2022
CANDIDATE’S DECLARATION
I hereby declare that the work, which is being presented in the Industrial Training
Report, entitled “Hypertext Markup Language & Cascading Style Sheet” in partial
fulfillment for the award of Degree of “Bachelor of Technology” in Department of
Computer Engineering with specialization in Computer Science and Engineering,
and submitted to the Department of Computer Engineering, Modi Institute of
Technology, Rajasthan Technical University is a record of my own investigations
carried under the Guidance of Assistant Professor, CSE Mr. Ankush Sharma, Dept. of
Computer Engineering.
I have not submitted the matter presented in this Industrial Training Report anywhere for
the award of anyother Degree.
Yash Chauhan
Computer Science
and Engineering
ROLL NO. :
21EMICS062
Modi Institute of Technology, Kota.
Cou
nter
Sig
ned
By:
Sup
ervi
sor:
CERTIFICATE
This is to certify that this Industrial Training Report entitled “Hypertext Markup
Language & Cascading Style Sheet” has been successfully carried out by Mr.Yash
Chauhan (Enrolment No.: 21E1MICSM30P062), under my supervision and guidance,
in partial fulfillment of the requirement for the award of Bachelor of Technology
Degree in Computer Science & Engineering from Modi Institute of Technology, Kota.
Supervisor:
Mr. Ankush Sharma
ACKNOWLEDGMENT
I would also like to give my special thanks to the Principal, Dr. Vikas Soni, Modi
Institute of Technology, for providing the opportunity to me to undertake this work.
I would like to thank my Assistant Professor and TPO, Mr. Ankush Sharma, for his
valuable guidance. I appreciate his presence for giving all discussions, suggestions and
the time for me whenever I neededhim.
Two Persons who deserves a First and Foremost mention are my Mother Mrs. Pushpa
Devi and My Father Mr. Manoj Kumar, whose strong belief in my abilities and moral
support uplifted my spirits.
Without their encouragement, I would have never imagined achieving this height in my career.
I cannot forget to mention the name of my best friends for her relentless help and motivation all
through.
Finally, I would like to thank everybody who was important to the successful realization
of this thesis, as well as expressing my apology that I could not mention personally one
by one.
Yash Chauhan
Computer Science
and Engineering
ROLL No.:
21EMICS062
TABLE OF CONTENTS
S.NO. TOPIC NAME Page.NO
Chapter 1. HTML 1
• introduction 1
• what is HTML? 1
Chapter 2. BASICS OF HTML
• HTML headings
• HTML paragraphs
• HTML entities
• HTML links
• HTML images
2-5
2
4
4
• Href attribute
• Srcattribute
• The Width and height attribute
• Alt attribute
• style attribute
• Lang attribute
• Title attribute
6-10
10
10
• Bold text
• Strong text
• Italic text
• Emphasized text
• Marked/highlightedtext
• Underlined text
• Superscript text
• subscript text
• deleted text
• smaller text
• larger text
• PHRASE TAGS
• Emphasis Tag
• Marked Tag
• Strong Tag
• Abbreviation Tag
• Acronym Tag
• Text Direction Tag
• Special Terminology or Definition Tag
• Quotation Tag
• Short Quote Tag
• Text Citation Tag
• Code Tag
• Keyboard Tag
• Address Tag
11-27
11
12
13
13
14
14
15
15
16
17
18
18
19
19
20
21
22
22
23
23
24
25
25
26
26
27
28-30
28
29
• Table Cells
• Table Rows
• Table Headers (th)
• Cell Padding
• Cell Spacing
• Colspan
• Rowspan
33-36
33
33
33
34
34
35
35
35
36
• HTML Blocks
• Inline Elements
39-41
39
41
• background-color
• background-image
42-48
42
43
• background-repeat 44
• background-attachment 44
• background-position 45
• HTML Fonts
• HTML Forms
49-52
49
50
Chapter 13. HTML HEAD ELEMENT
53-55
53
53
53
54
55
• Using CSS
• Inline CSS
• Internal CSS
• External CSS
• CSS Border
• CSS Padding
56-64
56
56
56
57
58
59
60
61
• CSS Margin 62
65-73
65
74-75
74
76-77
76
76
76
77
78-81
78
80
82-86
82
83
85
92-97
92
93
95
LIST OF TABLES
LIST OF FIGURES
22.1 Screenshot 1 98
22.2
Screenshot 2 99
22.3
Screenshot 3 100
• Screenshot 4 101
• Screenshot 5 102
• Introduction
HTML
CHAPTER 1
HTML stands for Hyper Text Markup Language, which is the most
widely used language on the Web to develop web pages. HTML was
created by Bernera-Lee in late 1991 but
―HTML 2.0‖ was the first standard HTML specification which was
published in 1995. HTML 4.01 was a major version of HTML and it was
published in late 1999, though the Html 4.01 version is widely used,
currently we are having the HTML-5 version which is an extension to
HTML 4.01, and this version was published in 2012. Originally, HTML
was developed with the intent of defining the structure of documents like
headings, paragraphs, lists, and so forth to facilitate the sharing of
scientific information between researchers. Now, HTML is being widely
used to format web pages with the help of different tags available in
HTML language.
• WHAT IS HTML?
BASICS OF HTML
CHAPTER 2
Ex:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
HTML headings are defined with the <h1> to <h6> tags.
Ex:
<h1>Heading1</h1>
<h2>Heading2</h2>
<h3>Heading3</h3>
<h4>Heading4</h4>
<h5>Heading5</h5>
<h6>Heading 6</h6>
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Example
The <hr> tag is an empty tag, which means that it has no end tag.
Example
The <br> tag is an empty tag, which means that it has no end tag.
Example
Example
<pre>
Text in a pre element
is displayed
in a fixed-
widthfont,
and it
preserves
bot
h spaces andline breaks
</pre>
If you use the less than (<) or greater than (>) signs in your
text, the browsermight mix them with tags.
this:
&
m
e
&#entity_number;
<a href="https://www.mitkota.com
HYPERLINK
"http://www.mitkota.com/"">This is a
• HTML Images:- HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are
provided asattributes:
Example
CHAPTER 3
HTML - ATTRIBUTES
All HTML elements can have attributes. Attributes provide additional
information about elements. Attributes are always specified in the start tag.
Attributes usually come in name/value pairs like: name="value"
• Href attribute
The <a> tag defines a hyperlink. The href attribute specifies the URL
of the page thelink goes to:
Example:
<!DOCTYPE html>
<html>
<body>
<p>HTML links are defined with the a tag. The link address is specified in the
hrefattribute:</p>
</body>
</html>
Example:
<!DOCTYPE html>
<html>
<body>
<p>HTML images are defined with the img tag, and the filename of
the image sourceis specified in the src attribute:</p>
</body>
</html>
There are two ways to specify the URL in the src attribute:
Tip: It is almost always best to use relative URLs. They will not break
if you change domain.
Example:
<!DOCTYPE html>
<html>
<body>
<p>The width and height attributes of the img tag, defines the width
and height of theimage:</p>
</body>
</html>
• The alt Attribute:- The required alt attribute for the <img> tag
specifies an alternate text for an image, if the image for some reason
cannot be displayed. This can be due to a slow connection, or an error
in the src attribute, or if the user uses a screen reader.
Example:
<!DOCTYPE html>
<html>
<body>
<p>The alt attribute should reflect the image content, so users who
cannot see theimage get an understanding of what the image
contains:</p>
</body>
</html>
• The style Attribute
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang=‖en‖>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
</body>
<
>
:
CHAPTER 4
HTML FORMATTING
HTML Formatting is a process of formatting text for better look and feel.
HTML provides us the ability to format text without using CSS. There are
many formatting tags in HTML. These tags are used to make text bold,
italicized, or underlined.
• BOLD Text:
The HTML <b> element is a physical tag which display text in bold font,
without any logicalimportance. If you write anything within <b>. </b>
element, is shown in bold letters.
Example
• STRONG Text:
• ITALIC Text:
Example
• . EMPHASIZED Text:
The HTML <em> tag is a logical element, which will display the
enclosedcontent in italic font, with added semantics importance.
Example
• . MARKED/HIGHLIGHTED Text:
Example
This will produce the following result:
• UNDERLINED Text:
Example
• SUPERSCRIPT Text:
Example
• SUBSCRIPT Text:
Example
This will produce the following result:
• DELETED Text:
as deleted text.Example
INSERTED Text:
as inserted text.Example
• Smaller Text:
Example
The content of the <big>...<big> element is displayed one font size larger
than the rest ofthe text surrounding it as shown below:
Example
• PHRASE TAGS
HTML phrase tags are unique purpose tags designed to use indefinite
cases, even thoughthey're implemented in the same manner as other tags
are used.
• Emphasis Tag
• Marked Tag
• Strong Tag
• Abbreviation Tag
• Acronym Tag
• Text Direction Tag
• Special Terminology/Definition Tag
• Quotation Tag
• Short Quote Tag
• Text Citation Tag
• Code Tag
• Keyboard Tag
• Programming Variable Tag
• Program Output Tag
• Address Tag
• Emphasis Tag
Emphasis Tag emphasizes or stresses the texts within its opening and
closing tags, that is,anything that appears within <em>...</em>element is
displayed as emphasized text.
Example:
• Marked Tag
The mark tag defines text with a highlighted yellow background that
should be marked or highlighted. Anything that appears with-in
<mark>...</mark>element, is displayed as marked with yellow ink.
Example:
• Strong Tag
The mark tag defines the appearance of the text as solid or bold, which
should be more significant.Anything that appears within
<strong>...</strong>element is displayed as important text.
Example:
This will produce the following result:
• Abbreviation Tag
Example:
• Acronym Tag
Acronym Tag is used to show that the text within the opening<acronym>
and closing tag</acronym>is an acronym. This tag is not supported in
HTML5.At present, the major browsers do not change the appearance of
the content of the <acronym>element.
Example:
• Text DirectionTag
Example:
go left to
right. This
text will go
right to left.
Typically, you would use the <dfn> element the first time you introduce a
key term. Most recent browsers render the content of a <dfn> element in
an italic font.
Example:
• Quotation Tag
Example:
The following description of XHTML is taken from the W3C Web site:
XHTML 1.0 is the W3C's first Recommendation for XHTML, following
on from earlierwork on HTML 4.01, HTML 4.0, HTML 3.2 and HTML
2.0.
Short Quote Tag is used for adding a double quote to your statement on
your web page.Text to be quoted should be placed in <q>...</q>element.
Example:
If you are quoting a text, you can indicate the source placing it between an
opening
<cite>tag andclosing</cite>tag
Example:
• Code Tag
Code Tag is used for making text visualization as mono-spaced font, just
like most of the programming books display code text. Any programming
code to appear on a Web page should be placed inside
<code>...</code>tags.
Example:
This will produce the following result:
• Keyboard Tag
The HTML <kbd> tag defines text as input from a keyboard such as the
Ctrl key, Enter,etc. Browsersrender text within <kbd> tags in monospace
font.
When you are talking about computers, if you want to tell a reader to enter
some text, youcan use the <kbd>...</kbd>element to indicate what should
be typed in.
Example:
• Programming VariablesTag
Example:
document.write("user-name")
• Program OutputTag
Example:
This will produce the following result:
• Address Tag
The address tag is used to specify and emphasize that a set of text is an
address.The<address>...</address>element is used to contain any address.
Example:
CHAPTER 5
<meta> tags always go inside the <head> element, and are typically used
to specify character set, page description, keywords, author of the
document, and viewport settings.
There is a method to let web designers take control over the viewport (the
user's visible area of a web page), through the <meta> tag (See "Setting
The Viewport" examplebelow).
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
Output:
Attributes:-
• Global Attributes
The <meta> tag also supports the Global
web page:
Setting the viewport to make your website look good on all devices:
The viewport is the user's visible area of a web page. It varies with the
device - it will besmaller on a mobile phone than on a computer screen.
You should include the following <meta> element in all your web pages:
This gives the browser instructions on how to control the page's dimensions and
scaling.
The width=device-width part sets the width of the page to follow the
screen-width of thedevice (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is
first loaded by thebrowser.
HTML COMMENTS
CHAPTER 6
HTML comments are not displayed in the browser, but they can help
document yourHTML source code.
You can add comments to your HTML source by using the following syntax:
Notice that there is an exclamation point (!) in the start tag, but not in the end tag.
Note: Comments are not displayed by the browser, but they can help
document your HTMLsource code.
Add Comments
HTML code:Example:
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
</body>
<
>
CHAPTER 7
HTML IMAGE LINKS
To use an image as a link, just put the <img> tag inside the <a> tag:
Example:
<!DOCTYPE html>
<html>
<body>
<h2>Image as a Link</h2>
<p>The image below is a link. Try to click on it.</p>
</body>
</html>
Output:
HTML TABLES
CHAPTER 8
HTML tables allow web developers to arrange data into rows and columns. A
table in HTMLconsists of table cells inside rows and columns.
Syntax:
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
• Table Rows
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Each table row starts with a <tr> and ends with a </tr> tag. Here tr stands for table
row.
Syntax:-
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr><table>
Sometimes you want your cells to be table header cells. In those cases
use the <th> taginstead of the <td> tag:
When you add a border to a table, you also add borders around each table cell:
Border
Collapsed Border
table, th, td {
border: 1px solid black;
}
table, th, td {
border: 1px solid black; border-collapse: collapse;
Style Border
Round TableBorders
}
th, td {
background-color: #96D4D4;
}
table, th, td {
border: 1px solid black;border-radius: 10px;
Dotted TableBorders
With the border-style property, you canset the appearance of the border.
}
th, td {
border-style: dotted;
}
Example:
t
h
,
t
d
p
a
d
d
i
n
g
:
1
5
p
x
;
}
Cell padding is the space between the cell edges and the cell
content. By default thepadding is set to 0. To add padding on table
cells, use the CSS padding property.
• Cell Spacing
Cell spacing is the space between each cell. By default the space is set to
2 pixels. To change the space between table cells, use the CSS
border-spacing property on the table element.
Example:
table {
border-spacing: 30px;
}
• Colspan
Example:
<table><tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr></table>
• Rowspan
Example:
<table><tr>
<th rowspan="2">Phone</th>
<td>555-1234</td>
</tr></table>
To make a cell span over multiple rows, use the rowspan attribute.
If you want to style the two first columns of a table, usethe <colgro
Example:
<colgroup>
<col span="2" style="background-color: #D6EEEE">
</colgroup>
Output:
CHAPTER 9
HTML—LISTS
HTML lists allow web developers to group a set of
• Item
• Item
• Item
• Item
• An ordered HTML list:
• First item
• Second item
• Third item
• Fourth item
Example :
<!DOCTYPE html>
<body>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output :
CH
APTER 10HTML LINKS - THE TARGET
ATTRIBUTE
By default, the linked page will be displayed in the current browser
window. To changethis, you must specify another target for the link.
_self - Default. Opens the document in the same window/tab as it was clicked
Use target="_blank" to open the linked document in a new browser window or tab:
• Html Blocks
Block-level Elements:
element.
Example
<p>Hello World</p>
<div>Hello World</div>
CODE:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
OUTPUT:
• Inline Elements
paragraph.
Example
<span>Hello World</span>
CODE:
<!DOCTYPE html>
<html>
<body>
<p>The SPAN element is an inline element, and will not start on a new
line and only takesup as much width as necessary.</p>
</body>
<
>
U
T
CHAPTER 11
CSS BACKGROUNDS
The CSS background properties are used to add background
• background-color
• background-image
• background-repeat
• background-attachment
• background-position
• background (shorthand property)
11.1CSS background-color
Example:-
Output:-
• CSS background-image
Example:-
Output:-
• CSS background-repeat
Example:-
Output:-
Example:-
<!DOCTYPE html>
<html>
<head>
<
s
t
y
l
e
>
b
o
d
y
{
background-image:
url("img_tree.png");
background-repeat: no-
repeat; background-
position: right top;
margin-right:
200px;
background-
attachment:
fixed;
}
</style>
</head>
<body>
<p><strong>Tip:</strong> If you do not see any scrollbars, try to resize the browser
window.</p>
</body>
</html>
Output:-
Instead of writing:
Example:-
Output:
• HTML Fonts
CHAPTER 12
The CSS font-family property defines the font to be used for an HTML element:
Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
OUTPUT:
• HTML Forms
An HTML form is used to collect user input. The user input is most often
sent to a serverfor processing.
Example
First name:
Last name:
The <form> Element
The HTML <form> element is used to create an HTML form for user input:
<form>
.
form elements
.
</form>
Radio Buttons
Example
<form>
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
language:
H
T
M
L
C
S
S
JavaScript
Checkboxes
Checkboxes let a user select ZERO or MORE options of a limited number of choices.
A Example
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
This is how the HTML code above will be
h
a
v
e
c
a
r
h
a
v
e
b
o
a
t
The action attribute defines the action to be performed when the form is submitted.
Usually, the form data is sent to a file on the server when the user
clicks on the submitbutton.
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<objectclass
width="200"heig
ht="200">
<paramname="code"value="applet.class">
</object>
CHAPTER 13
The <head> element is a container for metadata (data about data) and is
placed betweenthe <html> tag and the <body> tag.
HTML metadata is data about the HTML document. Metadata is not displayed.
Metadata typically define the document title, character set, styles, scripts,
and other metainformation.
The <title> element defines the title of the document. The title must be
text-only, and it isshown in the browser's title bar or in the page's tab.
Example
<!DOCTYPE html>
<html>
<head>
<title>A Meaningful Page Title</title>
</head>
<body>
</body>
</html>
Result:
The <link> tag is most often used to link to external style sheets:
Example
<link rel="stylesheet"
href="mystyle.css">Result:
( background-color)
Thi
s is
Hea
din
Thi
s is
para
gra
ph.
Example
Specify a default URL and a default target for all links on a page:
<head>
<base href="https://www.w3schools.com/" target="_blank">
</head>
<body>
<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>
CHAPTER 14
CSS stands for Cascading Style Sheets.CSS saves a lot of work. It can
control the layout of multiple web pages all at once.
With CSS, you can control the color, font, the size of text, the spacing
between elements, how elements are positioned and laid out, what
background images or background colors are to be used, different displays
for different devices and screen sizes, and much more!
• Using CSS
CSS can be added to HTML documents in 3 ways:
The most common way to add CSS, is to keep the styles in external CSS
files. However, in this tutorial we will use inline and internal styles,
because this is easier to demonstrate, and easier for you to try it yourself.
• Inline CSS
an HTML element.
The following example sets the text color of the <h1> element to blue,
and the text colorof the <p> element to red:
Example:
• Internal CSS
The following example sets the text color of ALL the <h1> elements (on
that page) to blue, and the text color of ALL the <p> elements to red. In
addition, the page will be displayed with a "powderblue" background
color:
Example:
Output:
• External CSS
An external style sheet is used to define the style for many HTML pages.
The external style sheet can be written in any text editor. The file must
not contain anyHTML code, and must be saved with a .css extension.
"styles.css":
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p{
color: red;
}
Tip: With an external style sheet, you can change the look of an
entire web site, bychanging one file!
to be used.Example:
Output:
• CSS Border
Example:
Output:
• CSS Padding
The CSS padding property defines a padding (space) between the text
Output:
• CSS Margin
Output:
14.10. Link to External CSS
External style sheets can be referenced with a full URL or with a path
relative to thecurrent web page.
Example:
Example:
This example links to a style sheet located in the html folder on the current web site:
Example: »
This example links to a style sheet located in the same folder as the current page:
CHAPTER 15
HTML CLASS ATTRIBUTE
15.1. INTRODUCTION:
The class attribute is often used to point to a class name in a style sheet. It
can also be used by JavaScript to access and manipulate elements with the
specific class name.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.city {
backgroun
d-color:
tomato;
color:
white;
border:
2px
solid
black;
margin:
20px;
padding: 20px}
</style>
</head>
<body>
<div class="city">
<h2>London</h2>
</div>
<div class="city">
<h2>Paris</h2>
</div>
<div class="city">
<h2>Tokyo</h2>
</div>
</body>
</html>
Output:
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.city {
backgroun
d-color:
tomato;
color:
white;
padding: 10px;
</style>
</head>
<body>
<h2 class="city">London</h2>
<h2 class="city">Paris</h2>
<h2 class="city">Tokyo</h2>
</body>
</html>
Output:
HTML elements can belong to more than one class.
To define multiple classes, separate the class names with a space, e.g.
<div class="citymain">. The element will be styled according to all the
classes specified.
In the following example, the first <h2> element belongs to both the city
class and also tothe main class, and will get the CSS styles from both of
the classes:
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.city {
backgroun
d-color:
tomato;
color:
white;
padding: 10px;}
.main {
text-align: center;
</style>
</head>
<body>
<h2>Multiple Classes</h2>
<h2 class="city">Paris</h2>
<h2 class="city">Tokyo</h2>
</body>
</html>
Output:
Different HTML elements can point to the same class name.
In the following example, both <h2> and <p> point to the "city" class
and will share thesame style:
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.city {
backgroun
d-color:
tomato;
color:
white;
padding: 10px;
</style>
</head>
<body>
<p>Even if the two elements do not have the same tag name, they can
both point to thesame class, and get the same CSS styling:</p>
<h2 class="city">Paris</h2>
</html>
Output:
JavaScript can access elements with a specific class name withthe getElem
Example:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to hide all elements with class name "city":</p>
<h2 class="city">London</h2>
<h2 class="city">Paris</h2>
<h2 class="city">Tokyo</h2>
<script>
function myFunction() {
var x =
document.getElementsByClassNam
i++) {
x[i].style.display = "none";
</script>
</body>
</html>
Output:
CHAPTER 16
HTML ID ATTRIBUTE
The HTML id attribute is used to specify a unique id for an HTML element.
You cannot have more than one element with the same id in an HTMLdocument.
The syntax for id is: write a hash character (#), followed by an id name.
Then, define the CSS properties within curly braces {}.
In the following example we have an <h1> element that points to the
id name . This <h1> element will be styled according to the #myHeader
style definition in the head section:
Example:
<!DOCTYPE html>
<html>
<head>
<
s
t
y
l
e
>
#
m
y
H
e
a
d
e
r
{
background-
color:
lightblue;
color: black;
p
a
d
di
n
g:
4
0
p
x;
te
xt
-
al
ig
n:
ce
nt
er
;
}
</style>
</head>
<body>
</body>
</html>
Output:
The value of the id attribute must be unique within the HTML document
JavaScript can access an element with a specific id with the getElementById() method
CHAPTER 17
HTML IFRAMES
An HTML iframe is used to display a web page within a web page.
An inline frame is used to embed another document within the current HTML
document.
Syntax
Example
Or you can add the style attribute and use the CSS height and width properties:
To remove the border, add the style attribute and use the CSS border property:
Example
Example"></iframe>With CSS, you can also change the size, style and
Example
The target attribute of the link must refer to the name attribute of the iframe:
CHAPTER 18
In CSS, the term ―box model‖ is used when talking about design and layout.
The CSS box model is essentially a box that wraps around every HTML
element. It consists of: margins, borders, padding, and the actual content.
The image below illustrates the box model:
Explanation of the different parts:
The box model allows us to add a border around elements, and to define
space betweenelements.
Example :
<!DOCTYPE html>
<html>
<head>
<
>
Background-
color:
lightgrey;
Width:
300px;
Border:
15px
solid
green;
Padding:
50px;
Margin: 20px;
</style>
</head>
<body>
<p>The CSS box model is essentially a box that wraps around every
HTML element. Itconsists of: borders, padding, margins, and the actual
content.</p>
</body>
<
/
h
>
Example :
<!DOCTYPE html>
<html>
<head>
<
>
width:
320px;
paddin
g:
10px;
border:
5px
solid
gray;
margin
: 0;
</style>
</head>
<body>
<div>The picture above is 350px wide. The total width of this element
is also350px.</div>
</body>
<
>
O
CSS BORDERS
CHAPTER 19
The Border Properties allow you to specify how the border of the box
representing anelement should look. There are three properties of a border
you can change:
border-color:#009900; /* Green */
</style>
<p class="example1">
</p>
<p class="example2">
result:
</p>
</p>
</p>
</p>
</p>
</p>
</p>
style:hidden;">This is a hidden
border.
</p>
You can individually change the width of the bottom, top, left, and right
borders of an element using the following properties:
</p>
</p>
<p style="border-width:medium;
border-style:solid;">This is a solid
</p>
</p>
</p>
The border property allows you to specify color, style, and width of lines in one
property:
The following example shows how to use all the three properties into a
single property.This is the most frequently used property to set border
around any element.
result:
CSS ICONS
CHAPTER 20
Icons can easily be added to your HTML page, by using an icon library.
The simplest way to add an icon to your HTML page, is with an icon
library, such asFont Awesome.
Add the name of the specified icon class to any inline HTML element (like
<i> or
<span>).
All the icons in the icon libraries below, are scalable vectors that can be
customized withCSS (size, color, shadow, etc.)
To use the Font Awesome icons, go to fontawesome.com, sign in, and get
a code to add inthe <head> section of your HTML page:
<script
src=https://kit.fontawesome.com/yourcode.jscrossorigin=”anonymous”>
</script>
Example :
<!DOCTYPE html>
<html>
<head>
<script
src=https://kit.fontawesome.com/a076d05399.jscrossorigin=‖anonymous‖
></script>
</head>
<body>
</body>
<
>
• Bootstrap Icons
To use the Bootstrap glyphicons, add the following line inside the <head>
section of yourHTML page:
<link rel=‖stylesheet‖
href=‖https://maxcdn.bootstrapcdn.com/Example
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Icons</title>
<link
rel=‖stylesh
eet‖
href=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css>
</head>
<body class=‖container‖>
<I class=‖glyphiconglyphicon-cloud‖></i>
<I class=‖glyphiconglyphicon-remove‖></i>
<I class=‖glyphiconglyphicon-user‖></i>
<I class=‖glyphiconglyphicon-envelope‖></i>
<I class=‖glyphiconglyphicon-thumbs-up‖></i>
<br><br>
</body>
<
>
• Google Icons
To use the Google icons, add the following line inside the <head> section
of your HTMLpage:
<link rel=‖stylesheet‖
href=https://fonts.googleapis.com/icon?family=Material+Icons> Example
<!DOCTYPE html>
<html>
<head>
<title>Google Icons</title>
<link rel=‖stylesheet‖
href=https://fonts.googleapis.com/icon?family=Material+Icons>
</head>
<body>
<I class=‖material-icons‖>cloud</i>
<I class=‖material-icons‖>favorite</i>
<I class=‖material-icons‖>attachment</i>
<I class=‖material-icons‖>computer</i>
<I class=‖material-icons‖>traffic</i>
<br><br>
<p>Styled Google icons (size and color):</p>
</body>
<
>
t
Demo: Navigation BarsVertical
CHAPTER 21
With CSS you can transform boring HTML menus into good-looking navigation bars.
In our examples we will build the navigation bar from a standard HTML list.
A navigation bar is basically a list of links, so using the <ul> and <li>
elements makesperfect sense:
Example
Output:-
21.1. Vertical Navigation Bar
To build a vertical navigation bar, you can style the <a> elements
inside the list, inaddition to the code from the previous page:
Example
<!DOCTYPE html>
<html>
<head>
<
s
t
y
l
e
>
u
l
{
l
i
s
t
-
s
t
y
l
e
-
t
y
p
e
:
n
o
n
e
;
m
a
r
g
i
n
:
0
;
p
a
d
d
i
n
g
:
0
;
w
i
d
t
h
:
2
0
0
p
x
;
backgr
ound-
color:
#f1f1f
1;
border
: 1px
solid
#555;
}
li a {
d
i
s
p
l
a
y
:
b
l
o
c
k
;
c
o
l
o
r
:
#
0
0
0
;
p
a
d
d
i
n
g
:
8
p
x
1
6
p
x
;
text-decoration: none;
}
li {
text-align: center;
border-bottom: 1px solid #555;
}
li:last-child {
border-bottom: none;
}
li a.active {
backgrou
nd-color:
#04AA6D
;color:
white;
}
li
a:ho
ver:n
ot(.a
ctive
){
back
grou
nd-
color
:
#555
;
color
:
whit
e;
}
</style>
</head>
<body>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
Output:-
21.3. Horizontal Navigation Bar
Example
<!DOCTYPE html>
<html>
<head>
<
s
t
y
l
e
>
u
l
{
list-
styl
e-
typ
e:
non
e;
mar
gin:
0;
p
a
d
d
i
n
g
:
0
;
o
v
e
r
f
l
o
w
:
h
i
d
d
e
n
;
background-color: #333;
}
li {
float: left;
}
li a {
d
i
s
p
l
a
y
:
b
l
o
c
k
;
c
o
l
o
r
:
w
h
i
t
e
;
text-
align
:
cent
er;
padd
ing:
14px
16px
;
text-
deco
ratio
n:
none
;
}
li a:hover {
background-color: #111;
}
</style>
</head>
<body>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
Output:-
CHAPTER 22
MY PROJECTS
Fig.22.1 Screenshot 1
Fig.22.2 Screenshot 2
Fig.22.3 Screenshot 3
Fig.22.4 Screenshot 4
Fig.22.5 Screenshot 5