Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

Monday, 30 October 2017

Working With The Appearance of The Scroll bars

We can apply CSS styles on scroll bars of the browser. Now Here we create a web page name is scrollbarpage.html to apply CSS styles on scroll bar.

<!doctype html>
<head>
<title>Working with CSS on Scroll Bars</title>
<style type="text/css">
html, body{
scrollbar-face-color:blue;
scrollbar-base-color:yellow;
scrollbar-arrow-color:black;
scrollbar-track-color:gray;
scrollbar-shadow-color:green;
scrollbar-hightlight-color:green;
scrollbar-3dlight-color:red;
scrollbar-darkshadow-color:red;
scrollbar-size:10px;
}
p{
width:600px;
}
</style>
</head>
<body bgcolor=#FFF0FT>
<h1>Applying CSS on scroll bars</h1>
<p>This is the simple paragraph for scrollbar Web page. This is the simple paragraph for scrollbar Web page. This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
<p>This is the simple paragraph for scrollbar Web page.</p>
</body>
</html>
We have Applied CSS styles on the scroll bars of the Web browser.
The output of the above Web page is:




Working With The Changing The Appearance of Horizontal Menus

Here we create a web page name is horizontalmenu.html to apply on a horizontal menu.
<!doctype html>
<head>
<style type="text/css">
.horimenu{
font-weight:bold;
width:100%
}
.horimenu menu{
padding:6px 0 7px 0;
margin:0;
}
.horimenu li{
display:inline;
}
.horimenu li{
color:red;
padding:6px 3px 4px 3px;
margin-right:20px;
text-decoration:none;
border-bottom:5px solid gray;
}
.horimenu li.hover{
border-bottom-color:black;
color:block;
}
<</style>
</head>
<body>
<h1>Working with Horizontal menu</h1>
<div class="horimenu">
<menu>
<li>HOME</li>
<li>ABOUT US</li>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>CONTACT</li>
<li>FEEDBACK</li>
</menu>
</div>
</body>
</html>

Now We have applied different CSS styles on the menu. The output of the above Web page is:

  

Working With Changing The Appearance of Vertical Menus in CSS

We can apply CSS styles on the menus in the html Web page. Now create a Web page  named verticalMenu.html to apply CSS style on menu.

<!doctype html>
<head>
<title>Working with changing the appearance of vertical menu</title>
<style type="text/css">
.vmenu{
list-style-type:none;
margin:0;
padding:0;
width:180px;
}
vmenu li{
background:#333 no-repeat right top;
font:bold 13px "Lucida Grande", "Trebuchect MS", Verdana;
display:block;
color:white;
width:auto;
padding:5px 0;
text-indent:8px;
text-decoration:none;
border-bottom:1px solid black;
width:180px;
}
.vmenu li{
background:#333 no-repeat right top;
font:bold 13px "Lucida Grande", "Trebuchet MS", Verdana;
display:block;
color:white;
width:auto;
padding:5px 0;
text-indent:8px;
text-decoration:none;
border-bottom:1px solid black;
}
.vmenu li:hover{
background-color:white;
color:black;
border-bottom:1px solid black;
}
</style>
</head>
<body>
<h1>Working With Vertical menus</h1>
<div class="vmenu">
<menu>
<li>HOME</li>
<li>ABOUT US</li>
<li>HTML</li>
<li>CSS</li>
<li>JAVASCRIPT</li>
<li>CONTACT</li>
<li>FEEDBACK</li>
</menu>
</div>
</body>
</html>
Here We have applied different CSS styles on a menu.
The output of the Above Web page:


Here We create second Web page named verticalmenusecond.html file.

<!doctype html>
<head>
<title>Working with changing the appearance of vertical menu</title>
<style type="text/css">
.vmenu{
list-style-type:none;
margin:0;
padding:0;
width:180px;
}
vmenu li{
background-color:green;
font-weight:bold;
display:block;
padding:2px 4px;
padding:5px 0;
text-indent:8px;
text-decoration:none;
border:2px solid green;
width:100%;
}

.vmenu li:hover{
background-color:green;
color:black;
border-style:outset;
}
</style>
</head>
<body>
<h1>Working With Vertical menus</h1>
<div class="vmenu">
<menu>
<li>HOME</li>
<li>ABOUT US</li>
<li>HTML</li>
<li>CSS</li>
<li>JAVASCRIPT</li>
<li>CONTACT</li>
<li>FEEDBACK</li>
</menu>
</div>
</body>
</html>

The output of the Above web page is:








Friday, 27 October 2017

Changing the Appearance of Buttons In CSS

We can apply special effects on buttons by applying various CSS styles. Now Create a Web page named Button.html to apply CSS style on buttons.

<!doctype html>
<head>
<title>Apply CSS style on buttons</title>
<style type="text/css">
#round{
border-radius:60px;
background:lime;
height:80px;
width:80px;
}
#square{
background:aqua;
didplay:block;
float:left;
font:normal 12px Arial;
line-height:15px;
height:23px;
padding-left:9px;
text-decoration:none;
width:100px;
}
#oval{
background:gray;
color:white;
display:block;
float:left;
font:normal 13px Tahoma;
line-height:24px;
padding-left:11px;
text-decoration:none;
width:100px;
border-radius:60px;
}
#bold{
padding:5px 7px;
border:1px solid #778;
color:white;
border:1px solid gray;
background:green;
border-radius:8px;
box-shadow:3px 3px 4px rgba(0, 0, 0, .5);
-webkit-box-shadow:3px 3px 4px rgba(0, 0, 0, .5);
background:-webkit-gradient(linear, center top, center bottom, from(#04ccec), color-stop(25%, #72a6d4), color-stop(45%, #3282c2), color-stop(85%, #357cbd), to(#72a6d4));
width:100px;
}
</style>
</head>
<body>
<h1>Applying CSS on Buttons</h1>
<h3>Round shaped Buttons</h3>
<BUTTON id="round">button 1</BUTTON>
<BUTTON id="round">button 2</BUTTON>
<br><hr>
<h3>Square Shaped button</h3>
<BUTTON id="square">button 1</BUTTON>
<BUTTON id="square">button 2</BUTTON>
<br>
<hr>
<h3>Oval shaped button</h3>
<BUTTON id="oval">button 1</BUTTON>
<BUTTON id="oval">button 2</BUTTON>
<br>
<hr>
<h3>Gradient buttons</h3>
<BUTTON id="bold">button 1</BUTTON>
<BUTTON id="bold">button 2</BUTTON>
</body>
</html>

We have applied different CSS styles on buttons. The output of the above Web page is:



Wednesday, 25 October 2017

Creating Frames Using CSS

CSS allow you to segregate the content of a Web page into different frames, which can appear on a web page in the form of a side bar header or footer. Note that the frames being a segregated content do not scroll when you scroll the Web page. There is no special property to create frames in CSS.

Now we create a web page named createframes.html to create a frames.

<!doctype html>
<head>
<title> Creating Frames using CSS</title>
<style type="text/css">
#frame{
position:absolute;
top:0px;
bottom:0px;

width:200px;
height:100px;
overflow:hidden;
background:black;
color:white;
}
#main{
position:fixed;
top:0px;
left:210px;
right:0;
bottom:0px;
overflow:auto;
}
</style>
</head>
<body>
<DIV id="frame">
<h1>This is the left frame</h1>
</DIV>
<DIV id="main">
<h1>Heading of the main content </h1>
<p>This is the creation of the frame.</p>
<img src="nature6.jpg" style="width:100%;height:100%;">
</DIV>
</body>
</html>

Here We have used two DIV elements. One is used as a frame in a Web page and another is used to display the main content.

The output of the Above web page is: 

Working With The Animation Effects in CSS

Optical illusions created by animating images and other element in a Web page are referred as animation. Now create a Web page named animation.html to learn to use the animation property of CSS.

<!doctype html>
<head>
<title>Animation effects</title>
<style type="text/css">
@-webkit-keyframes resize{
0%{
height:220px;
width:220px;
opacity:0.7;
}
50%{
height:240px;
width:240px;
opacity:0.4;
}
}
#heart:hover{
-webkit-animation-name:resize;
-webkit-animation-duration:1s;
-webkit-animation-iteration-count:2;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function:cubic-bezier(0,0.5,0,0);
}
#heartinf{
-webkit-animation-name:resize;
-webkit-animation-duration:1s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function:cubic-bezier(0,0.5,0,0);
position:absolute;
left:250px;
top:80px;
width:200px;
height:200px;
}
img{
height:200px;
width:200px;
opacity:1;
}
</style>
</head>
<body>
<h1>
Working with Animation </h1>
<img id="heart" src="heart.jpg">
<img id="heartinf" src="heart.jpg">
<p style="position:absolute;left:60px;top:280px;text-align:center">Hover on this image <br>to animate.</p>
<p style="position:absolute;left:300px;top:280px;text-align:center">Continuously animating <br>image</p>
</body>
</html>
We have applied animation effect on two images.One image animates at the time when we hover the mouse pointer over it, the other image continuously keep animating as we have set the animation-iteration-count property to infinite.

The output of the above Web page is:


The second output shown in figure is continuously animating. Now move your mouse pointer over the first image to start animating it.
As shown in output:

Apply The Transition Effect on The borders of an Element

We create a Web page named boredertransitioneffects.html file.
<!doctype html>
<head>
<title>Transition effect on the borders of an element</title>
<style type="text/css">
div{
background:green;
}
.area{
border-bottom:6px solid #ff34ff;
height:500px;
position:relative;
}
.item{
width:240px;
height:200px;
opacity:0.9;
border-radius:5px 5px 5px 5px;
}
.area.item{
-webkit-transition:all 0.5s linear;
}
.item:hover,
item:focus{
-webkit-border-radius:500px;
</style>
</head>
<body>
<DIV class="area">
<h1>Working with transition </h1>
<img class="item item-1" src="nature1.jpg">
<img class="item item-2" src="nature2.jpg"><br>
<img class="item item-3" src="nature3.jpeg">
<img class="item item-4" src="nature6.jpg">
</DIV>
</body>
</html>
Here we have displayed four image using the img element and applied the transition effect for changing the border radius on the mouse hover event.

The output of the above web page:



Now when we move the mouse pointer over an image the shape of the image changes from square to round. As shown in the output:


Tuesday, 24 October 2017

Working With The Transition Effects

The Passage of an act from one state to another is called Transition.Now create a Web page named transitioneffects.html to learn to use the transition feature of CSS.

<!doctype html>
<head>
<title>Transition effects</title>
<style type="text/css">
div{
background:url(nature1.jpg);
}
.area{
border-bottom:6px solid green;
height:500px;
position:relative;
}
.item{
background:red;
color:white;
margin:0 20px;
height:30px;
line-height:30px;
position:absolute;
text-align:center;
width:90px;
height:90px;
opacity:0.9;
}
.area.item{
-webkit-transition:all 1s linear;
}
.area.item-1{
bottom:10px;
-webkit-transition-duration:1.0s;
}
.area.item-2{
bottom:110px;
-webkit-transition-duration:.75s;
}
.area.item-3{
bottom:220px;
-webkit-transition-duration:.5s;
}
.area.item-4{
bottom:330px;
-webkit-transition-duration:.25s;
}
.item:hover,
.item:focus{
color:white;
width:400px;
opacity:0.6;
}
</style>
</head>
<body>
<DIV class="area">
<h1>Working With the Transition effects</h1>
<DIV class="item item-1">1.0 second</DIV><br>
<DIV class="item item-2">0.75 second</DIV><br>
<DIV class="item item-3">0.5 second</DIV><br>
<DIV class="item item-4">0.25 second</DIV><br>
</DIV>
</body>
</html>
Here we have applied the transition effects on different DIV elements.
The output of the above file:

Now when we move your mouse pointer on any of the red block it expanding towards the right side as shown in below output:

Monday, 23 October 2017

Working With The Transformation Effects

The transformation effect is used to change the position of the content of a web page or rotate the content. Now create a Web page named transformationeffects.html to learn how to apply the transformation effect.

<!doctype html>
<head>
<title>
Rotating Images</title>
<style type="text/css">
img {
width:300px;
height:200px;
}
#transform{
position:relative;
margin:10px auto;
width:300px;
height:200px;
-webkit-transform-style:preserve-3d;
-webkit-transition:all 1.0s linear;
}
#transform:hover{
-webkit-transform:rotateZ(35deg);
-webkit-box-shadow:-5px 5px 5px #aaa;
}
</style>
</head>
<body>
<h1>Working With Transformation</h1>
<DIV id="transform">
<img src="nature6.jpg"></DIV>
<DIV id="transform">
<img src="nature5.jpg"></DIV>
<DIV id="transform">
<img src="nature1.jpg">
</DIV>
</body>
</html>
The DIV and IMG elements are used to display images on the Web page. We can also see that we have applied the transformation effect on the mouse hover of the DIV element.

The Output of the Above Web page is:
When we move your mouse pointer over an image the image rotates to the 35 degree.





Working With Transparent Box and Writing Text in Transparent box

We can change the transparency of any element by using the opacity property. Now create a Web page named transparentbox.html to display the text on a transparent box.

<!doctype html>
<head>
<title> Transparent box </title>
<style type="text/css">
body{
background:url(nature1.jpg);
}
.trans{
width:500px;
height:400px;
margin:30px 50px;
background-color:#FFFFFF;
border:1px solid black;
opacity:0.5;
color:red;
font-weight:bold;
font-size:20px;
text-align:justify;
}
</style>
</head>
<body>
<h1>Working with Transparent box</h1>
<textarea class="trans" type="text">This is the example of the transparent box. This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.  This is the example of the transparent box.
</textarea>
</body>
</html>

Here We have added an image in the background of the body element. We have also added a textarea element and changed its transparency.
The output of the above Web page is : 

Sunday, 22 October 2017

Changing Image Transparency With Mouse Events

Transparency or opacity of an Image can be made to change with the invocations of mouse events. Now Create a Web page named mouseover.html to change the transparency of an image with the change in the mouse events.

<!doctype html>
<head>
<title>Applying Rounded Corners</title>
<style>
.trans{
border:1px solid #000;
border-radius:50px 0px 50px 0px;
background:gray;
}
img
{
opacity:0.3;
height:250px;
width:300px;
}
</style>
</head>
<body>
<h1 style="text-align:center">Working with image Trasparency</h1>
<img src="nature1.jpg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
<img src="nature2.jpeg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
<img src="nature3.jpeg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
<img src="nature4.jpeg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
<img src="nature5.jpeg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
<img src="nature6.jpg" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=20">
</body>
</html>

Here We have soecified that the opacity of the images change whenever the mouseover and mouseout events occur.

The output of the above Web page is :



Creating Frames Using CSS

Frames refer to elements that are used to divide a Web page into separate parts or portions. Dividing a Web page into frames enables you to display additional content or multiple documents in a single Web page. Earlier frames were created using the FRAME element provided by HTML, however this method has now become obsolete due to various reasons, such as problem in bookmarking the page or lack of proper support on Web browser. Nowadays, frames can be created using various properties of CSS.

For Example :
<!doctype html>
<head>
<DIV id="frame">This is a frame</DIV>
<STYLE type="text/css">
#frame{
position:absolute;
top:0px;
bottom:0px;
right:0;
width:100px;
height:100%;
background:white;
color:red;
}
</STYLE>
</head>
<body></body>
</html>

We have used a DIV element to be displayed as a frame in a Web page. We have also specified the position of a frame using the position, top, bottom, and right properties.

Wednesday, 18 October 2017

Different Types of Effects In CSS

Effects are the result of actions that are carried out to change the look and feel of HTML elements. CSS allows We to apply different types of effects on different types of HTML controls such as buttons, menu, images, and tables.
Types of  Effects:


  • Opacity effects - Modify the opacity of an HTML element. For Instance using these effects we can make an element transparent so that any other element or background behind that element gets visible.
for example:
img{
opacity:0.6;
}
  • Transition effects - Change the states of an element. Transition is a process of passing an act from one state to another. Generally, whenever the value of a CSS property changes, the result is instantly rendered on a web page. However when we apply transition effect on an element, it slowly transits from its old state to new.
For example:
transition-property- Specifies the property to which you apply the transition.
transition-duration - Specifies the time duration or the length of a transition.
transition-delay- Delays the transition
transition-timing-function -changes the speed of transitioning images.

DIV{
transition-property:opacity;
transition-duration:2s;
transition-timing-function:ese-in-out;
} 
  • Transformation effects-  Change the position or direction of the content of your web page.CSS allows you to apply this effect to the web content with the help of transform property. 
For example:
p{

-webkit-transform:rotate(45deg);
-webkit-perspective:1200px;
-webkit-perspective-origin:right;
}
  • Animation effect - Refer to optical illusions, which are created by animating images and elements in a web page.

For example:
img{
-webkit-animation-name:resize;
-webkit-animation-duration:Is;
-webkit-animation-iteration-cont:infinite;
-webkit-animation-direction:alternate;
-webkit-animation-timing-function:ease;
}

Working With The ::after Pseudo-Element

The :: after pseudo-element allows you to insert some content after the content of an element. The ::after pseudo-element is used in association with the content property to insert some content after the content of an element.
Now create a Web page named afterpe.html which shown the use of the ::after pseudo-element.

<!doctype html>
<head>
<style type="text/css">
body:after{
content:"The End";
display:block;
margin-top:2em;
text-align:center;
background-color:red;
color:white;
font-size:1em;
}
</style>
</head>
<body>
This is the example of the after pseudo-element.
</body>
</html>
The :: after pseudo-element inserts the content after the content in the Body element.

The output of the Web page is:



Working With The ::before Pseudo-Element

The ::before pseudo-element allows you to insert some content before any element. The ::before pseudo-element is used in association with the content property to insert content before an element. Now create a Web page named beforepe.html which shown the use of the ::before pseudo-element.

<!doctype html>
<head>
<style type="text/css">
p.note:before{content:"Note:"}
p.note {border: solid green;}
</style>
</head>
<body>
This is the example of the ::before Pseudo-Class
<p class="note">We are using google chrome browser </p>
<body>
</html>
The ::before pseudo-element inserts the content Note:, in a border before the content in the P element.

The output of the above Web page is:


Sunday, 15 October 2017

Working With The ::before Pseudo-Element

The ::before pseudo-element allows you to insert some content before any element. The ::before pseudo-element is used in association with the content property to insert content before an element.Now create a Web page named beforepe.html which shows the use of the ::before pseudo-element.

<!doctype html>
<head>
<style type="text/css">
p.note:before{
content:"Note:"}
p.note{
border: solid green;
}
</style>
</head>
<body>
This is the example of the Before pseudo-element.
This is the example of the Before pseudo-element.
This is the example of the Before pseudo-element.
This is the example of the Before pseudo-element.
<P class="note">For this document We are using google chrome browser.</P>
</body>
</html>
The ::before pseudo-element inserts the content, Note:, in a border before the content in the P element.

The Output of the Above Web Page is:


Working With The ::first-letter Pseudo-Element

The ::first-letter pseudo-element applies styling rules to the first letter of the text.
Now We create a Web page named first-letter-pe.htmlto understand how to use the ::first-letter pseudo-element.
<!doctype html>
<head>
<style type="text/css">
p:first-letter
{
color:#987651;
font-size:60px;
}
</style>
</head>
<body>
<P>This is the example of the first letter. This is the example of the first letter. This is the example of the first letter. This is the example of the first letter.</P>
</body>
</html>
The ::first-letter pseudo-element applies the #987651 color value and the 60px size to the first letter of the P element.

The Output of the Above Web page:



Working With The ::first-line Pseudo-Element

The ::first-line pseudo-element applies styling rules to the first line of text. Now create a Web page named firstlinepe.html to understand how to use the ::first-line pseudo-element.

<!doctype html>
<head>
<style type="text/css">
p:first-line
{color:green;
font-variant:small-caps;
}
</style>
</head><body style="background-color:#45ffaa;">
<P>First line<br>
Second line<br>
Third line</P>
</body>
</html>

The ::first-line pseudo-element sets the green color to the first line in the P element.

The Output of the Above Web Page is:


Working With The Negation Pseudo-Class

The :not(s) pseudo-class negates the effect of selected element. Now create a web page named negationpc.html which shows the use of the :not(s) pseudo-class.

<!DOCTYPE HTML>
<HEAD>
<TITLE>WORKING WITH NEGATION PSEUDO-CLASS</TITLE>
<STYLE type="text/css">
p
{background:orange;
border:1px solid red;
}
:not(p){
background:silver;
margin:30px;
}
a{
background:magenta;
color:blue;
}
a:not([href*=google])
{
background:green;
color:white;}
</STYLE>
</HEAD>
<BODY>
This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class.
<P>This is the paragraph element</P>
<UL>
<LI><A HREF="http://google.com">Gooogle</A></LI>
<LI><A HREF="http://www.webmasterworld.com">Web Master World</A></LI>
<LI><A HREF="http://google.co.uk">Gooogle UK</A></LI>
<LI><A HREF="http://www.rediff.com">Rediff</A></LI>
<LI><A HREF="http://www.yahoo.com">Yahoo</A></LI>
</UL>
This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class. This is the example of the the Negation pseudo-class.
<P>This is the paragraph element second</P>
</BODY>
</HTML>
:not(s) pseudo-class is used to apply a style to the elements that are not P elements and the links that are not Google links.

The output of Above Web Page is:



Friday, 13 October 2017

Working With structural Pseudo-Classes

We have learned that structural pseudo-classes allow the selection of elements on the basis of same extra information for instance the position of their child elements. Some examples of structural pseudo-classes are :first-child and :nth-last-child(N), where :first-child selects first child element of its parent and :nth-last-child(N) selects the specified child element by starting the counting from the last child.
Now create a Web page named structuralpc.html which shows the use of the structural pseudo-classes.

<!doctype html>
<head>
<style type="text/css">
:root{background:rgb(230, 238, 213);}
p:first-of-type{border:2px solid black;background:lime;}
p:last-of-type{border:2px solid black;background:orange;}
li:first-child{border:2px solid black;background:pink;}
p:nth-last-of-type(2){border:2px solid black:background:red;}
li:nth-last-child(2){border:2px solid black;background:aqua;}
</style>
</head>
<body>
<p>This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph This is the first paragraph</p>
<ul>
<li><a href="#block">link1</a></li>
<li><a href="#block">link2</a></li>
<li><a href="#block">link3</a></li>
<li><a href="#block">link4</a></li>
<li><a href="#block">link5</a></li>
</ul>
<p>
<h1>This is the second paragraph This is the second paragraph This is the second paragraph This is the second paragraph This is the second paragraph This is the second paragraph This is the second paragraph </h1></p>
<p>This is the third paragraph
<p>child 1</p>
<p>child 2</p>
<p>child 3</p>
<p>child 4</p>
<p>child 5</p></p>
</body>
</html>
The body element has three p element and one UL element the UL element contains five child LI elements.
The output of the above Web page: