html file like this:
<html>
<head>
<meta name="description" content="Department Events">
</head>
<title> Recent and Ongoing Events in the Department of Physics </title>
<body style="background-color:powderblue;">
<center>
<img style="width: 985px; height: 408px;" src="physics-1.jpg">
<h1 style="color:blue;">Department of Physics - Events and Activities</h1>
<hr>
</body>
</html>
Here I display image physics-1.jpg. But I want to display all images one by one from a folder photo so that each image is shown for 10 seconds and then changes to next images and ultimately back to first image and so on…
Could you please guide me what changes are needed in index.html page?
Thanks
a simple working example html code would be very helpful.
3
Answers
What you are trying to achieve is a typical slider, where images changes after some amount of time passed. You cannot create a slider just with HTML, you need to know about CSS or JavaScript to change the images dynamically.
This is slider just created with HTML and CSS, Check this out bro.
Link: https://codepen.io/saran_3012/pen/PogrQZZ
HTML
CSS
If you are a beginner, you can try learning CSS and JavaScript.
It can enhance your web.
And try to avoid inline styles (Do not embed the styles in HTML). It makes the debugging harder.
Plain HTML does not support such dynamic abilities. For that you need to use other mechanisms such as Javascript client-side code, something like :
And btw,
<center>
tag is outdated, unsupported in modern browsers, so you should usetext-align: center
CSS attribute of parent html node instead.