In: Computer Science
Use external CSS and Javascript files.
Use the HTML5 elements to layout the page.
In a sidebar include an advertisement that changes its image every three seconds. The can be created in paint and be very simple or more detailed.
Slidebar.html
<html>
<head>
<link href="slidebar.css" rel="stylesheet" type="text/css"> <!-- link css file -->
<body>
<center><h1>Sidebar</h1></center><!-- h1 heading tag and center tag for center alignment-->
<center> <div id="ad" name="ad"><!-- create division to store ad in it -->
<div id="sliderbox"><!-- create a div -->
<a href="#" target="_blank"><img src="ad1.png" > </a> <!-- write image tag within the <a> tag to make image clikable-->
<a href="#" target="_blank"> <img src="ad2.jpg" > </a><!-- write image tag within the <a> tag to make image clikable-->
<a href="#" target="_blank"><img src="ad3.jpg" > </a> <!-- write image tag within the <a> tag to make image clikable-->
<a href="#" target="_blank"> <img src="ad2.jpg" > </a><!-- write image tag within the <a> tag to make image clikable-->
</div><br clear="all"><!-- clear extra spaces-->
</div></center>
</body><!--close body tag-->
</head><!--close head tag-->
</html><!--close html tag-->
slidebar.css
@keyframes slider{/*create a animation for silde images (he @keyframes rule specifies the animation code)*/
/* from 0% to 20% show image one */
0%{
left:0px;
}
20%{
left:0px;
}
/* at 25 % slide image in left side by -950 px (Image dimention: 950*475) */
25%
{
left:-950px;
}
/* at 45 % slide image in left side by -950 px (Image dimention: 950*475) */
45%
{
left:-950px;
}
/* at 50 % slide image in left side by -1900px (950+950=1900) (Image dimention: 950*475) */
50%{
left:-1900px
}
/* at 70 % slide image in left side by -1900px (950+950=1900) (Image dimention: 950*475) */
70%{
left:-1900px;
}
/* at 75 % slide image in left side by -2850px (950+950+950=2850) (Image dimention: 950*475) */
75%{
left:-2850px;
}
}
#sliderbox{/* style the sliderbox division*/
position: relative;/* make position relative */
width: 4000px;/* create a width 4000px */
animation-name: slider;/* appy slider animation to it */
animation-duration: 15s;/* make animation duration 15s */
animation-iteration-count: infinite;/* run inimation infinite times */
}
#sliderbox img{/* style image which is placed in the sliderbox division*/
float:left;/* make it left (remove extra lines and space)*/
}
#ad{/* style ad division */
overflow: hidden;/*hide the overflow, So that only one image shown at a time*/
width: 950px;/* make a width same as image size (Image dimention: 950*475) */
background-color: aqua;/* give some background color */
margin-left: 50px;/* give space from left side */
margin-top: 80px;/* give space from top */
}
img{/*Style image*/
height: 300px;/* set height to 300 px */
width: 950px;/* set width to 950 px */
}
Output 1:
Output 2:
Saved file in system :
ad.png:
ad2.png
ad3.png
Note: Image dimention: 950*475