CSS slider not workin in IE - html

I am using a CSS slider on my ebay page (as ebay won't let you upload scripts, etc) but I found that it won't work in IE. Coyldn't figure out how to fix it. Is there a way around it? Or is there a slider with no scripts and that works in IE8+?
Here is the css:
img {
border: none;
}
a {
outline: none;
}
/* Fades in the slideshow. Hides the initial animation on the li tag.*/
#-webkit-keyframes fadeIn {
0% {
opacity: 0;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
ul#slider {
-webkit-border-radius: 10px;
margin: 0px;
padding: 0px;
list-style: none;
position: relative;
width: 700px;
height: 438px;
overflow: hidden;
}
ul#thumb {
overflow: none;
margin: 0px 0px 0px 0px;
padding: 0px;
list-style: none;
position: relative;
background: #000;
overflow: auto;
width: 700px;
}
ul#thumb a {
-webkit-transition: opacity .2s ease-in-out;
border: 1px solid #979797;
width: 70px;
height: 50px;
display: block;
overflow: hidden;
float: right;
margin: 10px 0px 0px 10px;
opacity: 0.75;
}
ul#thumb a:hover {
opacity: 1;
}
ul#slider li {
width: 700px;
height: 438px;
position: absolute;
}
ul#slider li p {
position: absolute;
bottom: -1px;
left: 0;
z-index: inherit;
color: #fff;
background: rgba(0, 0, 0, .5);
width: 100%;
}
ul#slider li p span {
line-height: 0.5em;
padding: 10px;
display: block;
}
/* Animation for the :target image. Slides the image in. */
#-webkit-keyframes moveTarget {
0% {
left:-700px;
}
100% {
left:0px;
}
}
ul#slider li:target {
-webkit-animation-name: moveTarget;
-webkit-animation-duration: .5s;
-webkit-animation-iteration-count: 1;
top:0px;
left: 0px;
z-index: 10;
}
/*
Animation for the current image. Slides it out the frame and back to the starting position.
Adds a lower z-index than the now current image.
*/
#-webkit-keyframes moveIt {
0% {
left:0px;
}
50% {
left:700px;
}
100% {
left:-700px;
z-index: 5;
}
}
ul#slider li:not(:target) {
-webkit-animation-name: moveIt;
-webkit-animation-duration: 1.5s;
-webkit-animation-iteration-count: 1;
top:0px;
left: 0px;
}
And HTML:
<ul id="slider"> <li id="1"> <img src="(image link)" alt="" width="700" height="438" />
</li><li id="2"> <img src="(image link)" alt="" width="700" height="438" />
</li>
<li id="3"> <img src="(image link)" alt="" width="700" height="438" />
</li>
<li id="4"> <img src="(image link)" alt="" width="700" height="438" />
</li>
<li id="5"> <img src="(image link)" alt="" width="700" height="438" />
</li>
</ul>
<ul id="thumb">
<li><img src="(image link)" alt="" width="70" height="50" /></li>
<li><img src="(image link)" alt="" width="70" height="50" /></li>
<li><img src="(image link)" alt="" width="70" height="50" /></li>
<li><img src="(image link)" alt="" width="70" height="50" /></li>
<li><img src="(image link)" alt="" width="70" height="50" /></li>
</ul>
</div>

Maybe you should check out canIuse.com to see browser compatibilities. It could be helpful!

Unfortunately a cross browser, pure CSS image slider is not cur­rently a real­istic option. Using this slider is going to cause issues in earlier ver­sions of Internet Explorer no mat­ter what you do. If you need reas­on­able browser sup­port then you will have to look at a slider that uses Javascript.

All of those -webkit prefixes indicate that whatever CSS you copied and pasted is intended to work only with webkit browsers (Google Chrome, Safari, etc...)
Unfortunately, without webkit, I can't think of many CSS-only gallery solutions.

Related

fade in opacity when img spans [duplicate]

This question already has answers here:
Transitions on the CSS display property
(37 answers)
Closed 8 months ago.
I'm making a portfolio for my graphic design activity.
I'm trying to make a home page where hover a link reveals an image and it works. I'm simply looking for a way to make the image fade in as it reveals itself.
I've added a snippet below.
If anyone can help, it would be greatly appreciated :) have a nice one
#container { width: 100%; margin-top: 0px; height: auto; float: left; font-size: 30px; padding-bottom: 4px; border: 1px solid green;}
#container a { float: left; color: #ff4d00; text-decoration: none; height: auto; margin-top: 0px; }
#container a:hover span { display: block; position: absolute; top: 20%; left: 10%; right: 10%; bottom: 20%; }
#container a span { display: none; z-index: 4; margin: 0; }
img { opacity: 1; transition: 1s; }
.center { display: block; margin-left: auto; margin-right: auto; width: auto; }
<div id="container">
<a href="Project 1.html">
<p>Project 1.</p><br>
<span><img src="https://img.freepik.com/photos-gratuite/mur-beton-blanc_53876-92803.jpg?w=2000g" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
<a href="Project 2.html">
<p>Project 2.</p>
<span><img src="https://images.unsplash.com/photo-1629197520635-16570fbd0bb3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8Z3JlZW4lMjB0ZXh0dXJlfGVufDB8fDB8fA%3D%3D&w=1000&q=80" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
<a href="Project 3.html">
<p>Project 3.</p>
<span><img src="https://img.freepik.com/photos-gratuite/mur-beton-blanc_53876-92803.jpg?w=2000" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
Do you mean transition fade on the image when you hover links? If that's what you mean you can't do it using display: none; to display: block; This is not allowed. However you can solve the problem in a different way, the visibility parameter allows you to do this. I leave you an example below.
#container {
width: 100%;
margin-top: 0px;
height: auto;
float: left;
font-size: 30px;
padding-bottom: 4px;
border: 1px solid green;
}
#container a {
float: left;
color: #ff4d00;
text-decoration: none;
height: auto;
margin-top: 0px;
}
#container a span {
position: absolute;
top: 40%;
left: 10%;
right: 10%;
bottom: 0%;
z-index: 4;
margin: 0;
visibility: hidden;
opacity: 0;
transition: visibility 0.2s, opacity 0.2s;
}
#container a:hover span {
visibility: visible;
opacity: 1;
transition: visibility 0.2s, opacity 0.2s;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
}
<div id="container">
<a href="Project 1.html">
<p>Project 1.</p><br>
<span><img src="https://img.freepik.com/photos-gratuite/mur-beton-blanc_53876-92803.jpg?w=2000g" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
<a href="Project 2.html">
<p>Project 2.</p>
<span><img src="https://images.unsplash.com/photo-1629197520635-16570fbd0bb3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8Z3JlZW4lMjB0ZXh0dXJlfGVufDB8fDB8fA%3D%3D&w=1000&q=80" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
<a href="Project 3.html">
<p>Project 3.</p>
<span><img src="https://img.freepik.com/photos-gratuite/mur-beton-blanc_53876-92803.jpg?w=2000" class="center" width="100%" height="100%" margin-top="25px" margin-bottom="25px"/>
</span>
</a>
</div>

Slider code in email - Want it to work for Gmail

I have asked questions regarding this code before. It is working fine. The only issue is that I would like to use it so the it works in the Gmail web client. It seems to work on Gmail mobile but not desktop and normal online HTML works. I know email clients limit CSS functionality but any help in getting functionality like this working would be great.
WORKING SNIPPET:
body {
margin: 0;
padding: 0;
}
.container {
display:flex;
width:600px;
flex-wrap:wrap;
justify-content:space-between;
}
.slider-holder {
order:-1;
width: 600px;
height: 280px;
background-color: yellow;
text-align: center;
overflow: hidden;
}
.image-holder {
width: 3000px;
background-color: red;
height: 280px;
clear: both;
position: relative;
transition: left 7000s; /*Use a big value to block the image change*/
left: 0;
}
.slider-image {
float: left;
margin: 0px;
padding: 0px;
position: relative;
}
a[href="#slider-image-0"]:hover~.slider-holder .image-holder {
left: 0.5px; /*Yes it's not 0px here, we need something different from the initial state to be able to trigger the transition (Yes I know it's not intuitive ..)*/
transition: left 1s;
}
a[href="#slider-image-1"]:hover~.slider-holder .image-holder {
left: -600px;
transition: left 1s;
}
a[href="#slider-image-2"]:hover~.slider-holder .image-holder {
left: -1200px;
transition: left 1s;
}
a[href="#slider-image-3"]:hover~.slider-holder .image-holder {
left: -1800px;
transition: left 1s;
}
a[href="#slider-image-4"]:hover~.slider-holder .image-holder {
left: -2400px;
transition: left 1s;
}
.button-holder>a>img {
padding-left: 35px;
padding-right: 35px;
}
<div class="container">
<img src="https://via.placeholder.com/70x70" alt="" width="70" style="border-width:0 !important;outline-style:none !important;">
<img src="https://via.placeholder.com/70x70" alt="" width="70" style="border-width:0 !important;outline-style:none !important;">
<img src="https://via.placeholder.com/70x70" alt="" width="70" style="border-width:0 !important;outline-style:none !important;">
<img src="https://via.placeholder.com/70x70" alt="" width="70" style="border-width:0 !important;outline-style:none !important;">
<img src="https://via.placeholder.com/70x70" alt="" width="70" style="border-width:0 !important;outline-style:none !important;">
<div class="slider-holder">
<div class="image-holder">
<img src="https://via.placeholder.com/600x280/ff0000" class="slider-image" />
<img src="https://via.placeholder.com/600x280/00ff00" class="slider-image" />
<img src="https://via.placeholder.com/600x280/f0f0f0" class="slider-image" />
<img src="https://via.placeholder.com/600x280/0000ff" class="slider-image" />
<img src="https://via.placeholder.com/600x280" class="slider-image" />
</div>
</div>
</div>
You should use table layout, inline css and avoid using images as replace of content. Here is great guide: https://litmus.com/blog/a-guide-to-css-inlining-in-email
here is the list of CSS supported by email clients link.
Try to add you CSS classes in head section of HTML.

Is there a way to modify this without JS or Jquery?

I found this image carousel here I'm wondering if there is a way to make it not auto scroll but instead have navigation buttons, as well as make it responsive. Is there a way to do this but still keep it Css only?
<h1>css3 carousel</h1>
<div class="carousel">
<div class="holder">
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/300x200" alt="" />
<img src="http://fakeimg.pl/400x300" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/500x400" alt="" />
<img src="http://fakeimg.pl/210x105" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/250x150" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
<img src="http://fakeimg.pl/200x100" alt="" />
</div>
</div>
#import url(http://fonts.googleapis.com/css?family=PT+Sans);
body {
font-family: 'PT Sans', Arial, Verdana;
background-color: #eee;
}
h1 {
text-align: center;
font-size: 48px;
text-transform: uppercase;
letter-spacing: 3px;
color: #222;
}
img {
display: inline-block;
width: 200px;
height: 100px;
}
.carousel {
width: 830px;
height: 120px;
overflow: hidden;
padding: 8px;
box-sizing: border-box;
border: 2px solid #999;
box-shadow: 0 0 4px #000;
margin: 0 auto;
border-radius: 5px;
}
.holder {
animation: carousel 25s linear infinite;
white-space: nowrap;
will-change: transform;
&:hover {
animation-play-state: paused;
}
}
#keyframes carousel {
0% {
transform: translateX(0);
}
50% {
transform: translateX(-100%);
}
100% {
transform: translateX(0);
}
}
Changing your CSS slightly will add a basic hover functionality to start the slider form a stopped position.
.holder {
animation: carousel 25s linear;
white-space: nowrap;
will-change: transform;
animation-play-state: paused;
&:hover {
animation-play-state: running;
}
}
Making it responsive would be easy with 'media queries'.
But considering you want to make it responsive then you will need 'click events' to make it work on mobile (as mobile has no hover functionality). CSS can't do click events so you will need javascript or jQuery. But this should be fairly straight forward, you'll only be changing minor CSS with a simple click event. However considering the endless amount of free and basic carousel plugins out there, I would opt for one of them. What you have here seems to be a demonstration on CSS animations, and without some kind of javascript, you will always be limited when it comes to CSS animation control.

CSS Centering An Image

Yes, I know this has been asked countless times and I've read just about every posting I can find but still no solution to my specific issue. On a classified ad site with thumbnail hovers to view the larger image, I need the hovered images to be centered horizontally on the page and vertically within the browser window. So far, when I get it centered horizontally in the browser, the vertical is centered on the page which is often far longer than the window so the images appear either off the screen or at the top edge. If I center it vertically, then it follows the hover horizontally and goes off the screen that way too.
The images, though similar in the HTML example below, are being loaded dynamically and can have varying heights which is part of the problem as I can't simply specify a height. It boils down to the last two CSS blocks with absolute, which causes the vertical centering to work but not the horizontal. Using fixed aligns horizontally but then it's often off the screen vertically. Any ideas?
<p><div class="image-container">
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2079.jpg" alt="hpim2079.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2079.jpg" alt="hpim2079.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2080.jpg" alt="hpim2080.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2080.jpg" alt="hpim2080.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2081.jpg" alt="hpim2081.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2081.jpg" alt="hpim2081.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2082.jpg" alt="hpim2082.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2082.jpg" alt="hpim2082.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2083.jpg" alt="hpim2083.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2083.jpg" alt="hpim2083.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2084.jpg" alt="hpim2084.jpg" width="69" height="52" /><img class="large-image-style" src="/images/classifieds/68/hpim2084.jpg" alt="hpim2084.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2115.jpg" alt="hpim2115.jpg" width="70" height="53" /><img class="large-image-style" src="/images/classifieds/68/hpim2115.jpg" alt="hpim2115.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2116.jpg" alt="hpim2116.jpg" width="70" height="53" /><img class="large-image-style" src="/images/classifieds/68/hpim2116.jpg" alt="hpim2116.jpg" width="323" height="244" /></a>
<a class="mouseover-thumbnail-holder" ontouchstart=""><img src="/images/classifieds/68/thumbnails/hpim2117.jpg" alt="hpim2117.jpg" width="70" height="53" /><img class="large-image-style" src="/images/classifieds/68/hpim2117.jpg" alt="hpim2117.jpg" width="323" height="244" /></a>
</div>
The CSS is fairly straightforward with
#media screen and (orientation: portrait) {
img.ri { max-width: 90%; }
}
#media screen and (orientation: landscape) {
img.ri { max-height: 90%; }
}
.image-container {
display: block;
margin: 0 auto 25px auto;
text-align: center;
width: 85%;
}
a.mouseover-thumbnail-holder {
position: relative;
}
.large-image-style {
position: relative;
top: auto; bottom: auto; left: 0; right: 0;
margin: auto;
background-color: #000000;
border-radius: 25px;
border: 10px double #FF0000;
}
a.mouseover-thumbnail-holder .large-image-style {
position: absolute;
display: inline-block;
z-index: 50;
opacity: 0;
pointer-events: none;
top: 50%;
left: 50%;
width: auto;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transition: all 2s ease;
-webkit-transition: all 2s ease;
-ms-transition: all 2s ease;
-moz-transition: all 2s ease;
-o-transition: all 2s ease;
}
a.mouseover-thumbnail-holder:hover .large-image-style , a.mouseover-thumbnail-holder:active .large-image-style {
position: absolute;
z-index: 100;
opacity: 1;
}
All you have to do is use margin: 0 auto; but make sure it has a width on the image
I think this might work for you. Instead of setting position: relative on the a.mouseover-thumbnail-holder element that encloses the image, let the positioning use the root element as the reference point by setting position: fixed on .large-image-style.
If you set all the offsets to zero and then use margin: auto on the image, it will center itself vertically and horizontally in the view port.
.image-container {
display: block;
margin: 0 auto 25px auto;
text-align: center;
width: 85%;
border: 1px dotted blue;
}
a.mouseover-thumbnail-holder .large-image-style {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
opacity: 0;
background-color: #000000;
border-radius: 25px;
border: 10px double #FF0000;
pointer-events: none;
transition: all 2s ease;
}
a.mouseover-thumbnail-holder:hover .large-image-style,
a.mouseover-thumbnail-holder:active .large-image-style {
opacity: 1;
}
.filler {
height: 500px;
border: 1px dotted blue;
}
<div class="filler">Top Filler...</div>
<div class="image-container">
<a class="mouseover-thumbnail-holder">
<img src="http://placehold.it/69x52" />
<img class="large-image-style" src="http://placehold.it/323x244" />
</a>
<a class="mouseover-thumbnail-holder">
<img src="http://placehold.it/69x52" />
<img class="large-image-style" src="http://placehold.it/523x244" />
</a>
<a class="mouseover-thumbnail-holder">
<img src="http://placehold.it/69x52" />
<img class="large-image-style" src="http://placehold.it/323x444" />
</a>
</div>
<div class="filler">Bottom Filler...</div>

One list, simple float left, different cell sizes

I have a nice challenge for you. Here you have the next code (live example: http://inturnets.com/test/test.html):
<!DOCTYPE html><html><head><title></title>
<style type="text/css">* {
margin: 0;
padding: 0;}a, a:hover {
text-decoration: none;
}
.grid {
width: 984px;
margin: 0 auto;
list-style: none;
height: 666px;
}
.grid li {
float: left;
position: relative;
}
.small + .small {
position: relative;
clear: left;
}
.large, .large a {
width: 393px;
height: 222px;
}
.small, .small a {
width: 198px;
height: 111px;
}
.small a, .large a {
display: block;
cursor: pointer;
color: #fff;
}
.overlay {
background: #000;
width: 100%;
height: 22px;
color: #fff;
opacity: 0;
position: absolute;
top: 0;
}
</style>
</head>
<body>
<ul class="grid">
<li class="item small"><div class="overlay">Title 1</div><img src="img/squares.png" border="0" width="198" height="111" /></li>
<li class="item small"><div class="overlay">Title 2</div><img src="img/space.png" border="0" width="198" height="111" /></li>
<li class="item large"><div class="overlay">Title 3</div><img src="img/arch.png" border="0" width="393" height="222" /></li>
<li class="item large"><div class="overlay">Title 4</div><img src="img/tree.png" border="0" width="393" height="222" /></li>
<li class="item large"><div class="overlay">Title 5</div><img src="img/arch.png" border="0" width="393" height="222" /></li>
<li class="item large"><div class="overlay">Title 6</div><img src="img/tree.png" border="0" width="393" height="222" /></li>
<li class="item small"><div class="overlay">Title 7</div><img src="img/squares.png" border="0" width="198" height="111" /></li>
<li class="item small"><div class="overlay">Title 8</div><img src="img/space.png" border="0" width="198" height="111" /></li>
<li class="item large"><div class="overlay">Title 9</div><img src="img/tree.png" border="0" width="393" height="222" /></li>
<li class="item small"><div class="overlay">Title 10</div><img src="img/squares.png" border="0" width="198" height="111" /></li>
<li class="item small"><div class="overlay">Title 11</div><img src="img/space.png" border="0" width="198" height="111" /></li>
<li class="item large"><div class="overlay">Title 12</div><img src="img/arch.png" border="0" width="393" height="222" /></li>
</ul>
</body>
</html>
Tasks:
one single list (ok)
simple float:left for the LI's (ok)
align the cells like on the next picture (not yet done)
Tips:
as you see the second .small class has position relative
you don't need anything special on the second small one
you need to do some other things
so you then need to push the item back into it's correct position
and then you need to fix the empty space it leaves
#hun i Try from my side may be that's help you:
.small + .small {
position: relative;
margin-left:-198px;
margin-top:111px
}
I'm not sure how to do it using floats.
Here's a solution using display: inline-block instead.
The only difference I can see between the display of my code and your goal picture is that the order of the two small images on the right is inverted.
However, I'm not going to try to fix it, because the order of images in your goal picture is wrong (or so I think):
Your source code has:
Image 6 - img/tree.png
Image 7 - img/squares.png
Image 8 - img/space.png
But in your goal picture, space is on top of squares, which is inconsistent with the other instances of the "two small images".
Without further ado:
The changes:
I removed the whitespace between the <li> tags. You could workaround having to do this.
New CSS:
.grid li {
position: relative;
display: inline-block;
vertical-align: top;
*display: inline;
zoom: 1
}
.small + .small {
position: relative;
clear: left;
top: 111px;
margin-left: -198px
}
I included the hacks required to make display: inline-block work in IE7.
Tested in IE7/8, and recent versions of: Chrome, Firefox, Safari, Opera.
I have created a working demo.
I stripped your appearing title divs, a bit shortened the HTML, and kept everything to a minimum, so the final CSS looks like this:
ul,li { margin: 0; padding: 0; }
a, a:hover { text-decoration: none; }
.grid { width: 984px; margin: 0 auto; list-style: none; height: 666px; }
.grid li { float: left; position: relative; }
.small + .small { margin: 111px 0 0 -198px; }
.large, .large a, .large img { width: 393px; height: 222px; }
.small, .small a, .small img { width: 198px; height: 111px; }
.item a { display: block; cursor: pointer; color: #fff; }
From this base, it seems to be safe to add those title divs and stuff.
Tested only on Firefox, but I don't really see a reason why it would not work on other browsers (tell me if I'm wrong). Well, except the + selector, but it was in your original CSS either.