UNIT3-DHTML Introduction
UNIT3-DHTML Introduction
DHTML stands for Dynamic HTML, it is totally different from HTML. The
browsers which support the dynamic HTML are some of the versions of
Netscape Navigator and Internet Explorer of version higher than 4.0. The
DHTML is based on the properties of the HTML, javascript, CSS, and DOM
(Document Object Model which is used to access individual elements of a
document) which helps in making dynamic content. It is the combination of
HTML, CSS, JS, and DOM. The DHTML make use of Dynamic object model to
make changes in settings and also in properties and methods. It also makes
uses of Scripting and it is also part of earlier computing trends.
DHTML allows different scripting languages in a web page to change their
variables, which enhance the effects, looks and many others functions after the
whole page have been fully loaded or under a view process, or otherwise static
HTML pages on the same. But in true ways, there is noting that as dynamic in
DHTML, there is only the enclosing of different technologies like CSS, HTML,
JS, DOM, and different sets of static languages which make it as dynamic.
DHTML is used to create interactive and animated web pages that are
generated in real-time, also known as dynamic web pages so that when such a
page is accessed, the code within the page is analyzed on the web server and
the resulting HTML is sent to the client’s web browser.
Advantages:
Size of the files are compact in compared to other interactional media like
Flash or Shockwave, and it downloads faster.
It is supported by big browser manufacturers like Microsoft and Netscape.
Highly flexible and easy to make changes.
Viewer requires no extra plug-ins for browsing through the webpage that
uses DHTML, they do not need any extra requirements or special software
to view it.
User time is saved by sending less number of requests to the server. As it is
possible to modify and replace elements even after a page is loaded, it is not
required to create separate pages for changing styles which in turn saves
time in building pages and also reduces the number of requests that are sent
to the server.
It has more advanced functionality than a static HTML. it is capable of
holding more content on the web page at the same time.
Disadvantages:
It is not supported by all the browsers. It is supported only by recent
browsers such as Netscape 6, IE 5.5, and Opera 5 like browsers.
Learning of DHTML requires a lot of pre-requisites languages such as
HTML, CSS, JS, etc should be known to the designer before starting with
DHTML which is a long and time-consuming in itself.
Implementation of different browsers are different. So if it worked in one
browser, it might not necessarily work the same way in another browser.
Even after being great with functionality, DHTML requires a few tools and
utilities that are some expensive. For example, the DHTML text editor,
Dreamweaver. Along with it the improvement cost of transferring from HTML
to DHTML makes cost rise much higher.
Difference between HTML and DHTML:
HTML is a markup language while DHTML is a collection of technologies.
HTML is used to create static webpages while DHTML is capable of creating
dynamic webpages.
DHTML is used to create animations and dynamic menus but HTML not
used.
HTML sites are slow upon client-side technologies whereas DHTML sites
are comparatively faster.
Web pages created using HTML are rather simple and have no styling as it
uses only one language whereas DHTML uses HTML, CSS, and Javascript
which results in a much better and way more presentable webpage.
HTML cannot be used as server side code but DHTML used as server side
code.
DHTML needs database connectivity but not in case of HTML.
Files in HTML are stored using .htm or .html extension while DHTML
uses .dhtm extension.
HTML requires no processing from the browser but DHTML does.
Inline CSS
Internal or Embedded CSS
External CSS
Inline CSS: Inline CSS contains the CSS property in the body section attached
with element is known as inline CSS. This kind of style is specified within an
HTML tag using the style attribute.
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS</title>
</head>
<body>
<p style = "color:#009900; font-size:50px;
font-style:italic; text-align:center;">
computer
</p>
</body>
</html>
Output:
Computer
Internal or Embedded CSS: This can be used when a single HTML document
must be styled uniquely. The CSS rule set should be within the HTML file in the
head section i.e the CSS is embedded within the HTML file.
Example: <!DOCTYPE html>
<html>
<head>
<title>Internal CSS</title>
<style>
.main {
text-align:center;
}
.GFG {
color:#009900;
font-size:50px;
font-weight:bold;
}
.geeks {
font-style:bold;
font-size:20px;
}
</style>
</head>
<body>
<div class = "main">
<div class ="GFG">GeeksForGeeks</div>
<div class ="geeks">
A computer science portal for geeks
</div>
</div>
</body>
</html>
Output:
body {
background-color:powderblue;
}
.main {
text-align:center;
}
.GFG {
color:#009900;
font-size:50px;
font-weight:bold;
}
#geeks {
font-style:bold;
font-size:20px;
}
Below is the HTML file that is making use of the created external style sheet
link tag is used to link the external style sheet with the html webpage.
href attribute is used to specify the location of the external style sheet file.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="geeks.css"/>
</head>
<body>
<div class = "main">
<div class ="GFG">GeeksForGeeks</div>
<div id ="geeks">
A computer science portal for geeks
</div>
</div>
</body>
</html>
Output: