Copy link to clipboard
Copied
Hi,
I wonder if anyone could offer a solution to this:
I added images that change automatically as a slide show on a page, using the descriptive found here:
https://stackoverflow.com/questions/46519126/how-to-randomize-the-slideshow-image-in-html
The action works well. But the problem is that the 4 images, 350px wide, appear side by side in the page layout in Dreamweaver, and blow up the page layout. Adding more images would just be impossible.
I suspect that the action described above is based on images linked to an external website and not hosted locally, and therefore they do not show up in the layout. Mine are on my computer.
I wonder if there is a way to stack images in the preview, as there is for instance a possibility to reduce the code to one line for a set of lines in code view? I'm not very knowledgeable I must say.
Just as a note, although a Creative Cloud user, I'm still using DW CS6 due to many Spry collapsible panels in my pages.
Thank you.
Paul
1 Correct answer
OK. Start by fixing these 30 HTML Code Validation Errors
https://validator.w3.org/nu/?doc=https%3A%2F%2Fpaulschilliger.com%2FSanstitre-1.html
And 7 invalid CSS Properties
Or simply create a new, blank document.
Go to File > New > New Document > HTML > HTML5.
Hit the CREATE button.
In CODE view, Remove & Replace everything with this responsive layout code.
<!doctyp
...
Copy link to clipboard
Copied
There does not seem to be a problem using the code as per StackOverflow.
https://www.youtube.com/watch?v=CkHNoNfzZak
Copy link to clipboard
Copied
Thank you, I appreciate your effort in posting this!
Maybe I will add some screenshots later to explain what happens in my layout.
I suspect that I am building with blocks that are not supposed to work together, hence the stretch.
Copy link to clipboard
Copied
This is a quick sketch to show the problem I am running into. Images added to the container are displayed side by side. I cannot use a line breaker to distribute them in additional lines. Once viewed in the browser, everything is fine though and only the right frame in this case is displayed, with changing images.
Copy link to clipboard
Copied
What's the URL to your site where it's not working?
By default, <div> tags are treated as block-level elements by browsers.
If yours are displaying inline, then something else in your code is making that happen. That's not the slideshow's problem. That's a problem with where you're inserting it. Try testing the slideshow on a fresh, blank HTML page.
Copy link to clipboard
Copied
Oh I'm sorry, I may have not explained things correctly since all who read my question understand that it's not working. The script is actually working perfectly. My question is with fitting this slide show container in the DW page locally, without stretching the layout. The page still works and displays at the fixed width in the browser, but in the composition or layout view it overflows from the 800 px set for the page to quickly double the page width.
I wonder if there would be a way to add images to the slideshow without having that. Maybe just having them linked to the remote server as in the Stackoverflow example ?
Copy link to clipboard
Copied
Post your URL so we can see what's going on.
Copy link to clipboard
Copied
Thank you Nancy, here is a link. But as I mentioned, you probably won't see what is problematic unless you copy the contents in a blank page in DW and perhaps link substitute images, IMHO.
Copy link to clipboard
Copied
OK. Start by fixing these 30 HTML Code Validation Errors
https://validator.w3.org/nu/?doc=https%3A%2F%2Fpaulschilliger.com%2FSanstitre-1.html
And 7 invalid CSS Properties
Or simply create a new, blank document.
Go to File > New > New Document > HTML > HTML5.
Hit the CREATE button.
In CODE view, Remove & Replace everything with this responsive layout code.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Responsive Layout, CSS Grid</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
width: 85%;
margin: 0 auto;
background-color:antiquewhite;
color:#372602;
font-family: Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
font-size: calc(16px + 1vw);
line-height: calc(1.1em + 0.5vw);
}
/**linked text**/
a:link {color:darkred; text-decoration:none}
a:visited {color:darkgray;}
a:hover, a:active, a:focus {color:crimson; text-decoration: underline}
.grid-container {
display: grid;
grid-column-start: col 1;
grid-gap: 5px;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-rows: repeat(auto-fit, 1fr);
}
.grid-container img {
vertical-align: baseline;
max-width: 100%;
height: auto;
}
</style>
</head>
<body>
<main>
<div class="row">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum consequuntur numquam eaque deserunt repudiandae optio dolores soluta voluptate quaerat, incidunt assumenda aperiam vitae unde reprehenderit, voluptas minima ducimus tempore, etc.</p>
</div>
</main>
<h2>CSS Grid Test</h2>
<div class="grid-container">
<!--unordered list-->
<ul>
<li><a href="#">Linked Text</a></li>
<li><a href="#">Linked Text</a></li>
<li><a href="#">Linked Text</a></li>
</ul>
<!--Slideshow Slides-->
<div class="slideshow-container">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/EAE" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/FFF/555" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/F0F" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/FFF/F00" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/FF0" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/EAE" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/FFF/555" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/F0F" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/FFF/F00" alt="placeholder">
<img class="mySlides fade" src="https://dummyimage.com/650x490/000/FF0" alt="placeholder">
<!--end slideshow--></div>
<!--end container--></div>
<!--slideshow script-->
<script>
var slideIndex = 0;
showSlides();
function showSlides() {
var i;
var slides = document.getElementsByClassName("mySlides");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slideIndex++;
if (slideIndex> slides.length) {slideIndex = 1}
slides[slideIndex-1].style.display = "block";
setTimeout(showSlides, 6000); // Change image every 6 seconds
}
</script>
</body>
</html>
This works in LIVE or DESIGN View in Dreamweaver.
Live View
No tables were used & no animals were harmed.
Copy link to clipboard
Copied
Thank you for your hard work!
Yes, I've been dragging this site around for 20 years and it's certainly outdated and flawed...
I'm going to have to rebuild it on a current and healthy basis. And not forget the CSS. This will take me some time.
But just to encourage us, copying and pasting my page into a new HTML5 document solved the image piling problem! They now display in rows of 3 and no longer mess up the layout. So there was indeed some mismatch.
So great to have experts help and advice. Thank you!
Copy link to clipboard
Copied
copying and pasting my page into a new HTML5 document solved the problem...
By alpshiker
==========
Right. Because your previous code contained 37 errors -- denoted by the red X.
To render pages correctly, use valid code -- green checkmark ✓.
Bookmark these tutorials for reference:
- https://www.w3schools.com/html/
- https://www.w3schools.com/css/
- https://www.w3schools.com/js/
Copy link to clipboard
Copied
By the way, since friendly experts are ready to help, I have tried to ad a smooth transition to the slide show so that image change is not too brisk. But it seems that since I already have a -textpadding- for the images, I cannot ad a -transition ease- property in the CSS. One cancels the other. Should it be possible to use both simultaneously?
Copy link to clipboard
Copied
...since I already have a -textpadding- for the images, I cannot add a -transition ease- property in the CSS. One cancels the other.
By alpshiker
==========
Padding & Easing are wildly separate properties.
The former provides empty space around an element like this:
Easing specifies a transition's-timing-function — linear, slow to fast, fast to slow, etc...
See CSS references below for details and code examples.
https://www.w3schools.com/css/css_padding.asp
https://www.w3schools.com/cssref/css3_pr_transition-timing-function.php
Copy link to clipboard
Copied
Thank you. I had a look, but I have to find out how this can be implemented with the script
https://stackoverflow.com/questions/46519126/how-to-randomize-the-slideshow-image-in-html
It is getting late here but I will dip into it ASAP.
Many thanks!
and thanks for putting my previous post straight.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you again for your suggestions in helping me sort this layout problem I had with an image slide show. Since I am now asked by the forum community if my problem is solved, here is the short answer.
It was suggested that I start from new HTML5 page to see if this worked out better. Indeed, this solved the problem. In fact, after exploring the code, I realised that some of my pages lacked the introductory tag:
After adding the missing line, all my pages work now as they should, even if many elements are still outdated or marked as errors and should be renewed.
So yes, my problem is solved, and I thank you both wholeheartedly!

