Center disolay slide show, Center a container in the web window |
Center disolay slide show, Center a container in the web window |
marius |
Jul 19 2019, 04:39 AM
Post
#1
|
Group: Members Posts: 3 Joined: 19-July 19 Member No.: 26,937 |
I have the folloowing html code and the container is displayed to the left of the page. How do I center the slide show display?
<html> <head> <style> .container{ position:relative; top: 300px; // 100px from top relative to its old position left: 600px; // 100px from left width:50%; height:400px; border-radius:5px; overflow:hidden; } </style> </head> <body> <div id="imgGallary" class="container"> <img src="c\websites\test\1.jpg" alt="" width="50%" height="400" /> <img src="c:\websites\test\2.jpg" alt="" width="50%" height="400" /> <img src="c:\websites\test\3.jpg" alt="" width="50%" height="400" /> <img src="c:\websites\test\1.jpg" alt="" width="50%" height="400" /> </div> <script> (function(){ var imgLen = document.getElementById('imgGallary'); var images = imgLen.getElementsByTagName('img'); var counter = 1; if(counter <= images.length){ setInterval(function(){ images[0].src = images[counter].src; console.log(images[counter].src); counter++; if(counter === images.length){ counter = 1; } },4000); } })(); </script> </body> </html> |
Lo-Fi Version | Time is now: 16th April 2024 - 02:14 AM |