Professional Documents
Culture Documents
Lecture14 CSS DHTML
Lecture14 CSS DHTML
Lecture14 CSS DHTML
Lecture 14
© 2009, DCST
PGDCET/NWT Department of Computer Science & Technology
Objectives
To Learn & Understand:
• Styles for
• color, background, font, text etc.
• What is DHTML
• Features of Dynamic HTML
• Dynamically change text and style
<html> body {
<head> background-color: #FFCC66;
<title>CSS Example</title> background-image: url("scene.jpg");
<link rel="stylesheet" background-repeat: no-repeat;
type="text/css" background-attachment: fixed;
href="style.css" />
background-position: center right;
</head>
}
<body >
<H1> India Tourism </H1> h1 {
<h2> If there is Heaven on earth its
here, its here, its here.</h2> color: #990000;
</body> background-color: #FC9804;
</html> }
Example – Borders...
Style1.css
h1 { p{
border-width: thick; border-width: 1px;
border-style: double; border-style: dashed;
border-color: gold; border-color: blue;
} }
h2 { ul {
border-width: 20px; border-width: thin;
border-style: outset ; border-style: solid;
border-color: red; border-color: orange;
} }
Borders…
CSS example ul
{
height: auto;
width: 200px;
border: 1px solid black;
background: orange;
}
© 2009, DCST CSS and DHTML 14.12
PGDCET/NWT Department of Computer Science & Technology
Pseudo-classes
• Pseudo-classes are another form of
specification used in CSS
• They identify markup elements, and in some
cases, specific user actions, to which a
particular style is to be applied.
• Example:
– The :hover pseudo-class
– This applies a style only when the user 'points to'
the visible element with a mouse pointer
– It is appended to a selector as in a:hover or
#elementid:hover.
a:visited {
color: purple;
} a:visited for visited links.
a:active {
color:red
background-color: yellow; :active is used for links that are active.
}
a:hover {
color: green;
font-style: italic;
} a:hover is when the cursor is on the link.
PGDCET/NWT Department of Computer Science & Technology
Pseudo-element
• A pseudo-element makes a selection that may
consist of partial elements, such as :first-line or :first-
letter
• Example:
<html> <head>
<style type="text/css">
p:first-letter
{ color: #ff0000; font-size:xx-large; }
</style>
</head>
Style4.css
div {
color: red;
background-color: yellow;
font-style: Italic;
}
span {
color: blue;
background-color: lightgreen;
font-style: oblique;
}
element
Padding
Border
Dynamic HTML
DHTML Features
Dynamic Content – Content on the Web page can be
added, deleted, or modified dynamically.
Dynamic Style – It refers to the change in the
appearance of an element such as color, font, size and
visual effects (bold, italic, underline etc.)
Dynamic Positioning – It refers to change in the
position of an element dynamically. Features such as
Drag & Drop and animation are possible.
</body></html>
Container Properties
Property Content
innerText The textual content of the container.
</body>
</html>
Summary
Styles for
• color, background, font, text etc.
• What is DHTML
• Features of Dynamic HTML
• Dynamically change text and style