This way you can make a slider automatic.:
Step 1: create the background of the slider. I created a box first of all using the HTML and CSS code below.
Step 2: Add image to slider. Now we will add the image in that box.
Step 3: Determine the size of the image.
Step 4: Add Next and prev buttons.