Cascading Style Sheets
Cascading Style Sheets
SASIKUMAR M
Image map
The <map> tag is used to define a client-side image-map. An
image-map is an image with clickable areas
<html>
<body>
<img src="book.png" alt=“books" usemap="#bookmap">
<map name="bookmap">
<area shape="poly" coords="76,0,35,28,50,72,100,75,112,128“
alt="poly" href="fig1.html">
<area shape="rect" coords="23,85,128,127" alt="rectangle"
href="fig2.html">
<area shape="circle" coords="74,168,30"
alt="circle" href="fig3.html">
</map>
</body>
</html>
Audio controls
<html>
<body>
<audio controls >
<source src="lion.mp3" type="audio/mpeg">
</audio>
</body>
</html>
Video frame
<html>
<body>
<video controls>
<source src="birthday songs.mp4"
type="video/mp4">
</video>
</body>
</html>
Iframe Example
<html> <head> <title>HTML Iframe Example </title> </head>
<body>
<iframe src="logo.html" height="100" width="1350"
title="Iframe Example" ></iframe><br>
<iframe src="ref.html" height="525" width="100"
title="Iframe1 Example" align="left"></iframe><br>
<iframe src="audioframe.html" height="200" width="100"
title="Iframe2 Example" align="right" ></iframe><br>
<iframe src="videoframe.html" height="400" width="200"
title="Iframe3 Example" align="right" ></iframe><br>
<iframe height="450" width="900“
title="Iframe4 Example" name="iframe_a"
align="center"></iframe>
</body>
</html>
Logo.html
<html>
<head>
<title> logo</title>
</head>
<body>
<marquee> welcome </marquee>
</body>
</html>
Ref.html
<html><head><title> reference </title> </head>
<body>
<a href="rose.html"
target="iframe_a">rose</a><br>
<a href="car.html" target="iframe_a">car</a><br>
<a href="breakfast.html"
target="iframe_a">breakfast</a><br>
<a href="vegetable.html"
target="iframe_a">vegetable</a><br>
<a href="dessert.html"
target="iframe_a">dessert</a><br>
</body>
</html>
Introduction to CSS
• CSS stands for Cascading Style Sheets
• CSS describes how HTML elements are to be displayed
on screen, paper, or in other media
• CSS saves a lot of work. It can control the layout of
multiple web pages all at once
• External style sheets are stored in CSS files
Why Use CSS?
• CSS is used to define styles for web pages, including
the design, layout and variations in display for
different devices and screen sizes.
CSS Syntax and Selectors
• A CSS rule-set consists of a selector and a declaration block:
larger Sets the font-size to a larger size than the parent element
</style>
</head>
<body>
<h1>Hello World!</h1>
<h2> Hai Welcome</h2>
</body>
</html>
Group selectors
<html>
<head>
<title> Grouping Selectors </title>
<style type="text/css">
h1,h2,p { color: #foo;
font-weight: normal;
letter-spacing: .4em;
margin-bottom: 1em;
text-transform: lowercase; }
</style>
</head>
<body>
<h1>18X107 Web Design Laboratory</h1>
<h2> Hai Welcome</h2>
<p> BSC COMPUTER SYSTEMS and DESIGN </p>
</body>
</html>
• Three Ways to Insert CSS
–External style sheet
–Internal style sheet
–Inline style
Inline styles
• An inline style may be used to apply a unique
style for a single element.
• To use inline styles, add the style attribute to
the relevant element. The style attribute can
contain any CSS property.
<h1 style="color:blue;margin-left:30px;">
This is a heading
</h1>
Inline style sheets
<html>
<head>
<title> Inline Cascading Style Sheets </title>
</head>
<body>
<h1 style="color:blue; margin-left:230px;">
Welcome to HTML page
</h1>
<h2> Hai, How Are You?</h2>
<p> This session is Web Design Lab Design </p>
<ul type="circle">
<li> coffee </li>
<li> tea </li>
</ul>
</body>
</html>
Internal Style Sheet
• An internal style sheet may be used if one single
page has a unique style.
• Internal styles are defined within the <style>
element, inside the <head> section of an HTML page:
<head>
<style type=“text/css”>
body { background-color: red; }
h1 { color: maroon; margin-left: 40px; }
</style>
</head>
External Style Sheet
• With an external style sheet, change the look of an
entire website by changing just one file.
• Each page must include a reference to the external
style sheet file inside the <link> element.
• The <link> element goes inside the <head>
section:
<head>
<link rel="stylesheet" type="text/css"
href="mystyle.css“ >
</head>
Mystyle.css
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
Html page 1
<html>
<head>
<title> External Style Sheet1
</title>
<link rel="stylesheet" type="text/css"
href="mystyle.css">
</head>
<body>
<h1> Welcome to HTML page </h1>
<h2> Hai, How Are You?</h2>
</body>
</html>
Html page2
<html>
<head>
<title> External Style Sheet2
</title>
<link rel="stylesheet" type="text/css"
href="mystyle.css">
</head>
<body>
<h1> Web Design lab session </h1>
<h2> Hai, How Are You?</h2>
</body>
</html>
Html page3
<html>
<head>
<title> External Style Sheet3
</title>
<link rel="stylesheet" type="text/css"
href="mystyle.css">
</head>
<body>
<h1> Welcome Ist year BSC CSD students </h1>
<h2> Hai, How Are You?</h2>
</body>
</html>
CSS Comment
<html> <head>
<style type=“text/css”>
p { color: red;
<!-- This is a single-line comment -->
text-align: center; }
</style>
</head>
<body> <p>Hello World!</p>
<!-- HTML comment -not displayed in browser -->
</body> </html>
CSS - Measurement Units
Properties:
• background-color
• background-image
• background-repeat
• background-attachment
• background-position
<html>
<head>
<style>
body {
background-image: url("img_tree.png");
background-repeat: no-repeat; // repeat-x | repeat-y
background-position: right top;
margin-right: 200px;
background-attachment: fixed; // fixed | relative
}
</style>
</head>
<body>
Border styles
• The border-style property specifies what kind of border to display.
– dotted - Defines a dotted border
– dashed - Defines a dashed border
– solid - Defines a solid border
– double - Defines a double border
– groove - Defines a 3D grooved border. The effect depends on the border-
color value
– ridge - Defines a 3D ridged border. The effect depends on the border-
color value
– inset - Defines a 3D inset border. The effect depends on the border-color
value
– outset - Defines a 3D outset border. The effect depends on the border-
color value
– none - Defines no border
– hidden - Defines a hidden border
Example
p.dotted {border-style: dotted;}
p.dashed {border-style: dashed;}
p.solid {border-style: solid;}
p.double {border-style: double;}
p.groove {border-style: groove;}
p.ridge {border-style: ridge;}
p.inset {border-style: inset;}
p.outset {border-style: outset;}
p.none {border-style: none;}
p.hidden {border-style: hidden;}
p.mix {border-style: dotted dashed solid
double;}
<html> <head> <style>
p.dotted {border-style: dotted;} p.dashed {border-style: dashed;}
p.solid {border-style: solid;} p.double {border-style: double;}
p.groove {border-style: groove;} p.ridge {border-style: ridge;}
p.inset {border-style: inset;} p.outset {border-style: outset;}
p.none {border-style: none;} p.hidden {border-style: hidden;}
p.mix {border-style: dotted dashed solid double;}
</style> </head> <body>
<h2>The border-style Property</h2>
<p>This property specifies what kind of border to display:</p>
<p class="dotted">A dotted border.</p>
<p class="dashed">A dashed border.</p>
<p class="solid">A solid border.</p>
<p class="double">A double border.</p>
<p class="groove">A groove border.</p>
<p class="ridge">A ridge border.</p>
<p class="inset">An inset border.</p> <p class="outset">An outset border.</p>
<p class="none">No border.</p> <p class="hidden">A hidden border.</p>
<p class="mix">A mixed border.</p> </body> </html>
Border Width
• The border-width property specifies the width of the
four borders.
• The width can be set as a specific size (in px, pt, cm, em,
etc) or by using one of the three pre-defined values:
thin, medium, or thick.
• The border-width property can have from one to four
values (for the top border, right border, bottom border,
and the left border).
border-style: solid;
border-width: 5px;
border-width: 2px 10px 4px 20px;
border-color: red green blue yellow;
border-radius: 5px; //rounded border
CSS Border Properties
Property Description
Border Sets all the border properties in one declaration
border-bottom Sets all the bottom border properties in one declaration
border-bottom-color Sets the color of the bottom border
border-bottom-style Sets the style of the bottom border
border-bottom-width Sets the width of the bottom border
border-color Sets the color of the four borders
border-left Sets all the left border properties in one declaration
border-left-color Sets the color of the left border
border-left-style Sets the style of the left border
border-left-width Sets the width of the left border
border-radius Sets all the four border-*-radius properties for rounded corners
border-right Sets all the right border properties in one declaration
border-right-color Sets the color of the right border
border-right-style Sets the style of the right border
border-right-width Sets the width of the right border
border-style Sets the style of the four borders
border-top Sets all the top border properties in one declaration
border-top-color Sets the color of the top border
border-top-style Sets the style of the top border
border-top-width Sets the width of the top border
border-width Sets the width of the four borders
Margin - Individual Sides
• CSS has properties for specifying the margin for each side of an
element:
– margin-top
– margin-right
– margin-bottom
– margin-left
• All the margin properties can have the following values:
– auto - the browser calculates the margin
– length - specifies a margin in px, pt, cm, etc.
– % - specifies a margin in % of the width of the containing element
– inherit - specifies that the margin should be inherited from the parent element
Example
p{
margin: 25px 50px 75px 100px;
}
Example
<html> <head>
<style>
div {
border: 1px solid black;
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: lightblue;
}
</style> </head>
<body>
<h2>Using individual margin properties</h2>
<div>This div element has a top margin of 100px, a right margin of 150px, a
bottom margin of 100px, and a left margin of 80px.</div>
</body> </html>
CSS padding
• The CSS padding properties are used to generate space
around an element's content, inside of any defined borders.
• With CSS, full control over the padding. There are properties
for setting the padding for each side of an element (top,
right, bottom, and left).
– padding-top
– padding-right
– padding-bottom
– padding-left
• All the padding properties can have the following values:
– length - specifies a padding in px, pt, cm, etc.
– % - specifies a padding in % of the width of the containing element
– inherit - specifies that the padding should be inherited from the
parent element
Example
<html> <head> <style>
div {
border: 1px solid black;
background-color: lightblue;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
</style> </head>
<body>
<h2>Using individual padding properties</h2>
<div>This div element has a top padding of 50px, a right padding of 30px, a
bottom padding of 50px, and a left padding of 80px.</div>
</body> </html>
CSS Dimension Properties
Property Description
Height Sets the height of an element
max-height Sets the maximum height of an element
max-width Sets the maximum width of an element
min-height Sets the minimum height of an element
min-width Sets the minimum width of an element
Width Sets the width of an element
• div {
max-width: 500px;
height: 100px;
background-color: powderblue;
}
Box Model
• All HTML elements can be considered as boxes. 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:
• Different parts in Box Model:
– Content - The content of the box, where text and images appear
– Padding - Clears an area around the content. The padding is
transparent
– Border - A border that goes around the padding and content
– Margin - Clears an area outside the border. The margin is
transparent
Example
<html><head> <style>
div {
background-color: lightgrey;
width: 300px;
border: 25px solid green;
padding: 25px;
margin: 25px;
}
</style> </head> <body>
<h2>Demonstrating the Box Model</h2>
<p>The CSS box model is essentially a box that wraps around every HTML
element. It consists of: borders, padding, margins, and the actual
content.</p>
<div>This text is the actual content of the box. We have added a 25px padding,
25px margin and a 25px green border. </div>
</body> </html>
Outline Style
• The outline-style property specifies the style of the outline, and can
have one of the following values:
– dotted - Defines a dotted outline
– dashed - Defines a dashed outline
– solid - Defines a solid outline
– double - Defines a double outline
– groove - Defines a 3D grooved outline
– ridge - Defines a 3D ridged outline
– inset - Defines a 3D inset outline
– outset - Defines a 3D outset outline
– none - Defines no outline
– hidden - Defines a hidden outline
– outline-width: thin;// medium|thick|thin
• outline-offset: 15px;//The outline-offset property adds space between
an outline and the edge/border of an element.
• The space between an element and its outline is transparent.
<html> <head> <style>
p.ex1 {
border: 1px solid black; outline-style: solid; outline-
color: red;}
p.ex2 { border: 1px solid black; outline-style: double;
outline-color: green;}
p.ex3 {
border: 1px solid black; outline-style: outset;
outline-color: yellow;}
</style> </head> <body>
<h2>The outline-color Property</h2>
<p class="ex1">A solid red outline.</p>
<p class="ex2">A double green outline.</p>
<p class="ex3">An outset yellow outline.</p>
</body> </html>
Text Decoration
• The text-decoration property is used to set or remove decorations
from text.
• The value text-decoration: none; is often used to remove
underlines from links:
<html> <head> <style>
h1 { text-decoration: overline; }
h2 { text-decoration: line-through; }
h3 { text-decoration: underline; }
</style> </head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
</body>
</html>
Text-decoration
<html> <head> <style>
div.a { text-decoration-line: underline; text-decoration-style: solid; }
div.b { text-decoration-line: underline; text-decoration-style: wavy; }
div.c { text-decoration-line: underline; text-decoration-style: double; }
div.d { text-decoration-line: overline underline; text-decoration-style:
wavy; text-decoration-color: blue; }
</style>
</head>
<body>
<h1>The text-decoration-style Property</h1>
<div class="a">This is some text with a solid underline.</div> <br>
<div class="b">This is some text with a wavy underline.</div> <br>
<div class="c">This is some text with a double underline.</div> <br>
<div class="d">This is some text with a wavy over- and underline.</div>
</body></html>
Text Transformation
• The text-transform property is used to specify uppercase and
lowercase letters in a text.
• It can be used to turn everything into uppercase or lowercase
letters, or capitalize the first letter of each word:
<html> <head> <style>
p.uppercase { text-transform: uppercase; }
p.lowercase { text-transform: lowercase; }
p.capitalize { text-transform: capitalize; }
</style> </head>
<body>
<p class="uppercase">This is some text.</p>
<p class="lowercase">This is some text.</p>
<p class="capitalize">This is some text.</p>
</body>
</html>
Text Indentation
• The text-indent property is used to specify the indentation of the
first line of a text:
<html><head> <style>
p{
text-indent: 50px;
}
</style> </head> <body>
<h1> Welcome paragraph Indentation</h1>
<p> Hai,How Are you </p>
<h1> sub section paragraph Indentation</h1>
<p>In my younger and more vulnerable years my father gave
me some advice
that I've been turning over in my mind ever since.
</p></body>
</html>
Letter Spacing
• The letter-spacing property is used to specify the
space between the characters in a text.
• The following example demonstrates how to
increase or decrease the space between characters:
<html> <head> <style>
h1 { letter-spacing: 3px; }
h2 { letter-spacing: -3px; }
</style> </head> <body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
</body> </html>
Line Height
• The line-height property is used to specify the space between
lines:
<html> <head> <style>
p.small { line-height: 0.7; }
p.big { line-height: 1.8; }
</style> </head>
<body>
<p> This is a paragraph with a standard line-height.<br>
The default line height in most browsers is about 110% to
120%.<br> </p>
<p class="small"> This is a paragraph with a smaller line-
height.<br>
This is a paragraph with a smaller line-height.<br> </p>
<p class="big"> This is a paragraph with a bigger line-height.<br>
This is a paragraph with a bigger line-height.<br> </p>
</body> </html>
Text Direction
• The direction property is used to change the
text direction of an element:
<html> <head> <style>
p.ex1 { direction: rtl; }
</style> </head>
<body>
<p>This is the default text direction.</p>
<p class="ex1"><bdo dir="rtl"> This is right-to-
left text direction</bdo></p>
</body> </html>
word-spacing
• The word-spacing property is used to specify
the space between the words in a text.
<html> <head> <style>
h1 { word-spacing: 10px; }
h2 { word-spacing: -5px; }
</style> </head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
</body> </html>
Text-shadow
• The text-shadow property adds shadow to text.
• The following example specifies the position of the
horizontal shadow (3px), the position of the vertical
shadow (2px) and the color of the shadow (red):
<html> <head> <style>
h1 { text-shadow: 3px 2px red; }
</style> </head>
<body>
<h1>Text-shadow effect</h1>
<p><b>Note:</b> Internet Explorer 9 and earlier do not
support the text-shadow property.</p>
</body>
</html>
Font
• The font-family property should hold several font names as a "fallback" system. If the browser
does not support the first font, it tries the next font, and so on.
• p{
font-family: georgia, garamond, serif;">
}
• h1 {
font-size: 40px; //em
}
h2 {
font-size: 30px;
}
p{
font-size: 14px;
}
• p.normal {
font-weight: normal; //bold/italic
}
p.thick {
font-weight: bold;
}
• p.normal {
font-style: normal;
}
p.italic {
font-style: italic;
}
p.oblique {
font-style: oblique;
}
Font Variant
• The font-variant property specifies whether or not a text should
be displayed in a small-caps font.
• In a small-caps font, all lowercase letters are converted to
uppercase letters. However, the converted uppercase letters
appears in a smaller font size than the original uppercase letters
in the text.
• p.normal {
font-variant: normal;
}
p.small {
font-variant: small-caps;
}
Font Awesome Icons
• <html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/
libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
</body>
</html>
Bootstrap Icons
• <html>
<head>
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/
bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
</body>
</html>
Google Icons
• <html>
<head>
<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>
</body>
</html>
Links
• four links states are:
• a:link - a normal, unvisited link
• a:visited - a link the user has visited
• a:hover - a link when the user mouse over it
• a:active - a link the moment it is clicked
Example
<html> <head> <style>
/* unvisited link */
a:link { color: red; }
/* visited link */
a:visited { color: green; }
/* mouse over link */
a:hover { color: hotpink; }
/* selected link */
a:active { color: blue; }
</style>
</head><body>
<p><b><a href=“fig1.html “>This is a link</a></b></p>
<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS
definition in order to be effective.</p>
<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in
order to be effective.</p>
</body> </html>
<style>
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
</style>
<style>
a:link {
background-color: yellow;
}
a:visited {
background-color: cyan;
}
a:hover {
background-color: lightgreen;
}
a:active {
background-color: hotpink;
}
</style>
lists
<html> <head> <style>
ul.a { list-style-type: circle; }
ul.b { list-style-type: square; }
ol.c { list-style-type: upper-roman; }
ol.d { list-style-type: lower-alpha; }
</style> </head>
<body>
<p>Example of unordered lists:</p>
<ul class="a"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul>
<ul class="b"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li>
</ul>
<p>Example of ordered lists:</p>
<ol class="c"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol>
<ol class="d"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol>
</body> </html>
List-style-type values
Value Description
disc Default value. The marker is a filled circle
armenian The marker is traditional Armenian numbering
circle The marker is a circle
cjk-ideographic The marker is plain ideographic numbers
decimal The marker is a number
decimal-leading-zero The marker is a number with leading zeros (01, 02, 03, etc.)
• @keyframes
• animation-name
• animation-duration
• animation-delay
• animation-iteration-count
• animation-direction
• animation-timing-function
• animation-fill-mode
• animation
Example
<html>
<head>
<style>
div {
width: 100px; height: 100px; background-color: #ff0000;
animation-name: example; animation-duration: 4s;
animation-iteration-count: 3; animation-direction: reverse;
}
@keyframes example {
from {background-color: #ff0000;}
to {background-color: #00ff00;}
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier
versions.</p>
<div></div>
<p><b>Note:</b> When an animation is finished, it changes back to its original style.</p>
</body>
</html>
Example
<html>
<head>
<style>
div {
width: 100px; height: 100px; background-color: red;
position: relative; animation-name: example; animation-duration: 4s;
animation-delay: 2s; animation-direction: reverse;
}
@keyframes example {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:blue; left:200px; top:200px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>
<div></div>
</body>
</html>
Animation direction
• The animation-direction property specifies
whether an animation should be played
forwards, backwards or in alternate cycles.
– normal - The animation is played as normal
(forwards). This is default
– reverse - The animation is played in reverse
direction (backwards)
– alternate - The animation is played forwards first,
then backwards
– alternate-reverse - The animation is played
backwards first, then forwards
Animation
<html> <head> <style>
div {
width: 100px; height: 50px; background-color: red; font-weight: bold; position: relative;
animation: mymove 5s infinite; }
#div1 {animation-timing-function: linear;}
#div2 {animation-timing-function: ease;}
#div3 {animation-timing-function: ease-in;}
#div4 {animation-timing-function: ease-out;}
#div5 {animation-timing-function: ease-in-out;}
<div id="div1">linear</div>
<div id="div2">ease</div>
<div id="div3">ease-in</div>
<div id="div4">ease-out</div>
<div id="div5">ease-in-out</div>
</body>
</html>
Animation -Fullmode
• CSS animations do not affect an element before the first keyframe is
played or after the last keyframe is played. The animation-fill-mode
property can override this behavior.
• The animation-fill-mode property specifies a style for the target element
when the animation is not playing (before it starts, after it ends, or both).
• The animation-fill-mode property can have the following values:
• none - Default value. Animation will not apply any styles to the element
before or after it is executing
• forwards - The element will retain the style values that is set by the last
keyframe (depends on animation-direction and animation-iteration-
count)
• backwards - The element will get the style values that is set by the first
keyframe (depends on animation-direction), and retain this during the
animation-delay period
• both - The animation will follow the rules for both forwards and
backwards, extending the animation properties in both directions
Animation-Full property
<html>
<head>
<style>
div {
width: 100px; height: 100px; background: red;
position: relative; animation-name: example; animation-duration: 3s;
animation-fill-mode: forwards;
}
@keyframes example {
from {top: 0px;}
to {top: 200px; background-color: blue;}
}
</style>
</head>
<body>
<p>Let the div element retain the style values from the last keyframe when the animation ends:</p>
<div></div>
<p><strong>Note:</strong> The animation-fill-mode property is not supported in Internet Explorer 9 and
earlier versions.</p>
</body>
</html>
User Interface -Resize
<html>
<head>
<style>
div {
border: 2px solid;
padding: 20px;
width: 300px;
resize: both;
overflow: auto;
}
</style>
</head>
<body>
<div>Welcome to PSG TECH</div>
</body>
</html>
User Interface
<html>
<head>
<style>
div {
margin: 100px; padding: 10px; width: 300px;
height: 200px; border: 5px solid pink;
outline: 5px solid green; outline-offset: 55px;
}
</style>
</head>
<body>
<div>Welcome to PSG TECH</div>
</body>
</html>
Property
CSS Animation
Description
Properties
@keyframes Specifies the animation code
animation A shorthand property for setting all the animation properties
animation-delay Specifies a delay for the start of an animation
animation-direction Specifies whether an animation should be played forwards,
backwards or in alternate cycles
animation-duration Specifies how long time an animation should take to complete
one cycle
animation-fill-mode Specifies a style for the element when the animation is not
playing (before it starts, after it ends, or both)
animation-iteration-co Specifies the number of times an animation should be played
unt
animation-name Specifies the name of the @keyframes animation
animation-play-state Specifies whether the animation is running or paused
animation-timing-funct Specifies the speed curve of the animation
ion
Tooltip text
<html>
<style>
.tooltip { position: relative; display: inline-block; border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden; width: 120px; background-color: black;
color: #fff; text-align: center; border-radius: 6px; padding: 5px 0;
/* Position the tooltip */
position: absolute; z-index: 1; }
.tooltip:hover .tooltiptext { visibility: visible; }
</style>
<body style="text-align:center;">
<p>Move the mouse over the text below:</p>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>
<p>Note that the position of the tooltip text isn't very good. Go back to the tutorial and
continue reading on how to position the tooltip in a desirable way.</p>
</body>
</html>
Vertical Menu
<html> <head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style> .vertical-menu { width: 200px; }
.vertical-menu a { background-color: #eee; color: black; display: block; padding:
12px; text-decoration: none; }
.vertical-menu a:hover { background-color: #ccc; }
.vertical-menu a.active { background-color: #4CAF50; color: white; }
</style>
</head>
<body>
<h1>Vertical Menu</h1>
<div class="vertical-menu">
<a href="#" class="active">Home</a>
<a href=“fig1.html">Link 1</a>
<a href=“fig2.html">Link 2</a>
<a href=“fig3.html">Link 3</a>
</div>
</body>
</html>
Horizontal Menu
<html> <head>
<style>
ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden;
background-color: #333; }
li { float: left; }
li a { display: block; color: white; text-align: center; padding: 14px 16px; text-
decoration: none; }
li a:hover { background-color: #111; }
</style>
</head>
<body>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="fig1.html">News</a></li>
<li><a href="fig2.html">Contact</a></li>
<li><a href="fig3.html">About</a></li>
</ul>
</body>
</html>
Entity Character reference
Result Description Entity Name Entity Number
non-breaking space  
< less than < <
> greater than > >
& ampersand & &
" double quotation mark " "