So far only the middle slide has correct arrow pointing to the left on the left side and arrow pointing to the right on the right side. But i cannot manage to make when you are on either left or right slide the arrows to be pointing to the right way.
Thank you!
http://codepen.io/anon/pen/WvZGdb
HTML
<div id="slides">
<input type="radio" name="slider" id="slide1" class="set"/>
<input checked type="radio" name="slider" id="slide2" class="set"/>
<input type="radio" name="slider" id="slide3" class="set"/>
<div class="mask">
<div class="overflow">
<div class="slide"><img src="../images/work.png"/></div>
<div class="slide"><img src="../images/work.png"/></div>
<div class="slide"><img src="../images/work.png"/></div>
</div>
</div>
<div id="controls" onclick="">
<label for="slide1">1</label>
<label for="slide2">2</label>
<label for="slide3">3</label>
</div>
</div>
</div>
CSS
input.set {
display:none;
}
#slide1:checked ~ .mask .overflow { margin-left:0; }
#slide2:checked ~ .mask .overflow { margin-left:-640px; }
#slide3:checked ~ .mask .overflow { margin-left:-1280px; }
#slides {
margin:auto;
width:760px;
position:relative;
background-color:#096;
}
#slides .mask {
width:640px;
overflow:hidden;
margin:auto;
}
#slides .overflow {
width:300%;
-webkit-transition: ease-out 0.5s;
}
#slides .slide {
width: 640px;
height:480px;
float:left;
background: silver;
}
#controls label {
display:none;
width:60px;
height:60px;
opacity:0.5;
position:absolute;
top:50%;
margin-top:-30px;
cursor:pointer;
background:#0C0;
}
#controls label:hover {
opacity:1;
}
#slide1:checked ~ #controls label:nth-child(2), #slide2:checked ~ #controls label:nth-child(3), #slide3:checked ~ #controls label:nth-child(2) { right:0; display:block; }
#slide2:checked ~ #controls label:nth-child(1), #slide3:checked ~ #controls label:nth-child(2) { left:0; display:block; }
I don't know if I got you right but I can try. From what I read you want the arrow on the last slide to "shift" backward ("<").
There are few approaches to this solution.
First way
You add a class when it's on the last div and simply rotate if for 180 deg.
#slide3:checked ~ #controls label:nth-child(2) {
transform: rotate(180deg);}
Second way
As in the first way you add a class for this last scenario and you flip it with matrix.
#slide3:checked ~ #controls label:nth-child(2) {
transform: matrix(-1,0,0,1,0,0);}
Third way
For me maybe the best way. You can use :before and content:"" to a letter, icon or symbol to a label. So labels are empty and you "fill" them with before.
Browser Support
For the first two ways you need to use prefixes.
IE > 9 (IE 9 requires prefix)
Firefox > 3 ( FF < 15 requires prefix)
Chrome (Chrome < 35 requires prefix)
Safari (requires prefix)
Opera > 10 (Opera < 22 requires prefix)
For more info Can I use
Related
I am trying to display tabs content in pure css, but i am unable to fix this height for parent. if content is more in tabs content parent content(red area) not expanding. please help to to expanding the parent (red area) when content is more and after clicking on other tab, previous tab content not hidden. please need help in two cases.
.tabs-container {
background: red;
padding: 30px;
height: 100%;
}
.tabs {
position: relative;
clear: both;
margin: 25px 0;
}
.tab {
display: block;
width: 220px;
}
.tab label {
background: #eee;
padding: 10px;
border: 1px solid #ccc;
border-right: none;
margin-left: -1px;
position: relative;
left: 1px;
width: 200px;
display: inline-block
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: 0px;
left: 220px;
background: white;
right: 0;
padding: 20px;
border: 1px solid #ccc;
overflow: hidden;
}
.content > * {
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-100%);
-o-transform: translateX(-100%);
-webkit-transition: all 0.6s ease;
-moz-transition: all 0.6s ease;
-ms-transition: all 0.6s ease;
-o-transition: all 0.6s ease;
}
[type=radio]:checked ~ label {
background: white;
border-bottom: 1px solid #ccc;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
}
[type=radio]:checked ~ label ~ .content > * {
opacity: 1;
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
}
<div class="tabs-container">
<div class="tabs">
<!--tabs-->
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked="">
<label for="tab-1">Tab One</label>
<!--tabs-content-->
<div class="content">
<p>Our expert team allows us to offer Protective Coating services, which is famous for its variety of benefits such as offering universal strainers for light shades, offers breath ability for preventing moisture, curing a tough flexible & abrasion
resistant coating, resistant to chalking and flaking and offering strong bonding on cement concrete, asbestos & mild steel. Our range of services finds its application in various areas like chajjas, external vertical walls, china mosaic tiles,
water tanks (externally), sloppy roofs, asbestos roof, roof terraces and stone walls. These services consist of acrylic elastomeric dust proof coating and polyurethane waterproof coatings. Protective Coating Our expert team allows us to offer
Protective Coating services, which is famous for its variety of benefits such as offering universal strainers for light shades, offers breath ability for preventing moisture, curing a tough flexible & abrasion resistant coating, resistant to
chalking and flaking and offering strong bonding on cement concrete, asbestos & mild steel. Our range of services finds its application in various areas like chajjas, external vertical walls, china mosaic tiles, water tanks (externally), sloppy
roofs, asbestos roof, roof terraces and stone walls. These services consist of acrylic elastomeric dust proof coating and polyurethane waterproof coatings.</p>
</div>
<!--tabs-content end-->
</div>
<!--tabs-->
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1" checked="">
<label for="tab-2">Tab One</label>
<!--tabs-content-->
<div class="content">
<p>Stuff for Tab One</p>
</div>
<!--tabs-content end-->
</div>
<!--tabs-->
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1" checked="">
<label for="tab-3">Tab One</label>
<!--tabs-content-->
<div class="content">
<p>Protective Coating
</p>
</div>
<!--tabs-content end-->
</div>
</div>
</div>
working codepen link
for your issue (hope it is inside html and body) then
.tabs-container {background: red;padding: 30px;height: 100%;overflow:auto;}
will work for you.
jsbin link
If i understood maybe it
html,
body {
height: 100%;
}
I have some images that I use CSS to make a darker background.
This makes the images darken on hover. It can be seen at rtsb.co.uk on the main images.
However when viewing the images, the background is shown slightly behind the images, seen as a grey stripe under each image. the images are 600px height, but for some reason, the code for 'outerLink' makes it 607px height and so the bar appears, this can be seen using Chrome dev tools when viewing the page.
.outerLink {
background-color: #e8e8e8;
display: block;
opacity: 1;
filter: alpha(opacity=100);
}
img.darkableImage {
opacity: 1;
filter: alpha(opacity=100);
}
<a href="/collections/sale" class="outerLink">
<img src="//cdn.shopify.com/s/files/1/1234/4330/t/6/assets/promo_image_1.jpg?12217915569807539649" alt="Sale" class="darkableImage" onmouseout="this.style.opacity=1;" onmouseover="style.opacity=0.7;">
</a>
I've tried looking at everything to find where this added 7px comes from but I can't find it anywhere.
Even if I change the name of the CSS to .outerLinktest, the tag above still seems to pick up a height of 19px from somewhere.
I cannot add a height CSS attribute to .outerLink as the page is dynamic for mobiles etc and the images resize due to this so won't always be 600px high.
Have you tried to put
display:flex;
instead of
display:block;
in outerLink?
.outerLink {
background-color: #e8e8e8;
display: flex;
opacity: 1;
filter: alpha(opacity=100);
}
I've tried it with the inspector and it works.
Snippet:
.outerLink {
background-color: #e8e8e8;
display: flex;
opacity: 1;
filter: alpha(opacity=100);
}
img.darkableImage {
opacity: 1;
filter: alpha(opacity=100);
display: block;
}
<a href="/collections/sale" class="outerLink">
<img src="//cdn.shopify.com/s/files/1/1234/4330/t/6/assets/promo_image_1.jpg?12217915569807539649" alt="Sale" class="darkableImage" onmouseout="this.style.opacity=1;" onmouseover="style.opacity=0.7;">
</a>
also make the image display:block;
img.darkableImage
{
opacity:1;
filter:alpha(opacity=100);
display:block; /*<----*/
}
or change outerlink background color into white maybe...
Use display:block; on img class.
img.darkableImage
{
opacity:1;
filter:alpha(opacity=100);
display:block;
}
Snippet:
.outerLink
{
background-color:#e8e8e8;
display:block;
opacity:1;
filter:alpha(opacity=100);
}
img.darkableImage
{
opacity:1;
filter:alpha(opacity=100);
display:block;
}
<a href="/collections/sale" class="outerLink">
<img src="//cdn.shopify.com/s/files/1/1234/4330/t/6/assets/promo_image_1.jpg?12217915569807539649" alt="Sale" class="darkableImage" onmouseout="this.style.opacity=1;" onmouseover="style.opacity=0.7;">
</a>
Check Fiddle
You may set position attributes to your classes :
.outerLink
{
background-color:#000;
display:block;
opacity:1;
filter:alpha(opacity=100);
position:absolute;
}
img.darkableImage
{
opacity:1;
filter:alpha(opacity=100);
position: relative;
top:0;
left:0;
}
I have a div and I want that on click an other div slides in. I want to achieve this with css3 :target.
Like you can see in the code snippet the :hover works. When hovered an animation start to fade some info in. When you click on the image I want that an other div fades in on the top by calling the same animations as used on hover.
Can somebody help with getting the :target working?
body{
margin: 0px;
}
.image{
position: relative;
width:300px;
height:auto;
}
.image img{
width:100%;
}
.download{
position: absolute;
top:0px;
left:0px;
height:80%;
width:100%;
background-color: gray;
display:none;
}
.info{
position: absolute;
bottom:0px;
left:0px;
height:20%;
width:100%;
background-color: green;
opacity: 0;
}
.info p{
padding: 5px;
margin: 0px;
}
.image:hover .info{
-webkit-animation: show 0.5s; /* Chrome, Safari, Opera */
animation: show 0.5s;
opacity: 1;
}
.image:target .download{
-webkit-animation: show 0.5s; /* Chrome, Safari, Opera */
animation: show 0.5s;
opacity: 1;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes show {
from {opacity: 0;}
to {opacity: 1;}
}
/* Standard syntax */
#keyframes show {
from {opacity: 0;}
to {opacity: 1;}
}
<div class="image"><!-- I detect everything on this div-->
<img src="http://3.bp.blogspot.com/-gaBTIWFTWOo/UTeneLuwWyI/AAAAAAAABJE/E1GQBY4TJ8k/s1600/post-apocalypse-new-york.jpg">
<div class="download"><!-- this div should fade in on click (:target)-->
download
</div>
<div class="info"> <!-- this div should fade in on hover-->
<p>Image 1</p>
</div>
</div>
This can be achieved via jquery: http://jsfiddle.net/swm53ran/13/
$('.image').on('click', function(){
$(this).find('.download').fadeIn(500);
});
i know you want to achieve this with :target, but you can do both animations through jquery to keep consistent if you would like. just another option...
i think i got it the way you wanted with css:
added anchor tag surrounding image, added id #dl to download div...heres the fiddle http://jsfiddle.net/swm53ran/14/
:target {
display:block;
-webkit-animation: show 0.5s; /* Chrome, Safari, Opera*/
animation: show 0.5s;
opacity: 1;
}
<div class="image"><!-- I detect everything on this div-->
<a href="#dl">
<img src="http://3.bp.blogspot.com/-gaBTIWFTWOo/UTeneLuwWyI/AAAAAAAABJE/E1GQBY4TJ8k/s1600/post-apocalypse-new-york.jpg"/>
<div class="download" id="dl"><!-- this div should fade in on click (:target)-->
download
</div>
<div class="info"> <!-- this div should fade in on hover-->
<p>Image 1</p>
</div>
</a>
</div>
Hopefully tis is a reallllly easy fix that I'm just not seeing, but I've been trying every solution I could find that arched even close to this in previously submitted questions and I'm just getting nowhere.
The short of it: I've got a CSS tab setup working that's great, EXCEPT for when it comes to styling the actual labels on the tabs. It works great with a single style, but as soon as I try to introduce a secondary font style (bringing the font size down to 11px), the right hand side of the tab disappears.
And unfortunately I NEED to be able to have those two different font sizes/styles displayed in the tab label. I've tried using span, div, etc. treatments but everything makes the right border of the tab go away. Any help is HUGELY appreciated!
Here's a fiddle: http://jsfiddle.net/wKtPL/
Here's my sample HTML:
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked>
<label for="tab-1">Library <div class='tab-count'> 123</div></label>
<div class="content">
content goes here
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1">
<label for="tab-2">Institution’s Subscriptions</label>
<div class="content">
content goes here
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1">
<label for="tab-3">Copyright Agent</label>
<div class="content">
content goes here
</div>
</div>
<div class="tab">
<input type="radio" id="tab-4" name="tab-group-1">
<label for="tab-4">Internet Archive</label>
<div class="content">
content goes here
</div>
</div>
<div class="tab">
<input type="radio" id="tab-5" name="tab-group-1">
<label for="tab-5">HathiTrust</label>
<div class="content">
content goes here
</div>
</div>
And the CSS behind it:
.tabs {
position: relative;
min-height: 550px;
clear: both;
margin: 25px 0;
}
.tab {
float: left;
}
.tab label {
background: #dadcde;
color: #3f4b54;
padding: 10px;
border: 1px solid #ccc;
margin-left: -1px;
position: relative;
left: 1px;
-moz-border-radius-topright:3px;
-webkit-border-top-right-radius:3px;
border-top-right-radius:3px;
-moz-border-radius-topleft:3px;
-webkit-border-top-left-radius:3px;
border-top-left-radius:3px;
font-size: 14px;
font-weight:bold;
margin-right:5px;
}
.tab-count {
font-size: 11px;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: 28px;
left: 0;
background: white;
right: 0;
bottom: 0;
padding: 20px;
border: 1px solid #ccc;
overflow: hidden;
}
.content > * {
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-100%);
-o-transform: translateX(-100%);
-webkit-transition: all 0.6s ease;
-moz-transition: all 0.6s ease;
-ms-transition: all 0.6s ease;
-o-transition: all 0.6s ease;
}
[type=radio]:checked ~ label {
background: white;
border-bottom: 3px solid white;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
}
[type=radio]:checked ~ label ~ .content > * {
opacity: 1;
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
}
By secondary font style do you mean the div nested in the label? If that's the one with class .tab-count you could set float:right. That will keep it in the same line.
.tab-count {
font-size: 11px;
float:right;
}
A couple of things, firstly the 123 is being hidden under the .content so you need a taller top value.
Secondly, your labels, while being position: relative; are still only being implicitly rendered as display: inline;, so it's hiding the 123 div underneath the label itself.
http://jsfiddle.net/wKtPL/1/
.tab label {
[ ... ]
display: inline-block;
min-height: 2.5em;
}
.content {
[ ... ]
top: 60px;
}
... and muck with styling as you need.
This is caused by the usage of a block element inside your label element, which is an inline element. To fix this, change your <div class='tab-count'> 123</div> to <span class='tab-count'> 123</span>. Here is a demo of it.
If you want to allow block-level elements to be placed within inline elements, you could like #setek said, use the alternative inline-block which is a kind of hybrid of block elements and inline elements.
You should never use block elements inside inline elements, since that will cause problems like this one. What was happening was that the styles for the inline <label> tag were being dragged across 2 lines, since the <div> was taking up an extra line. That dragged the left border down a line too, which is why you didn't see it anymore (it was below the other tabs).
Transition rotate causes chrome to flash black screen. Is it a Chrome bug (works fine in Safari) or it can be fixed with some clever css.
div {
width:200px;
height:200px;
position:relative;
background:#ddd;
}
span {
display:inline-block;
position:absolute;
top:40px;
left:40px;
width:20px;
background:#007;
height:10px;
-webkit-transition: all .5s;
}
div:hover > span {
-webkit-transform: rotate(180deg);
}
<div>
<span></span>
</div>
Example fiddle here.
The problem with this problem is that it doesn't occur every time so you'll have to hover the gray square several times and you should see the screen blinking in black.
Tested in:
Chrome 16.0.912.75
Chrome Canary 18.0.1010.0
Works fine on:
Safari 5.1.2 (6534.52.7)
All test on Snow Leopard
You can fix this by forcing compositing to stay on by giving -webkit-transform: translate3D(0, 0, 0) to the parent of the transformed element.
div { width:200px; height:200px; position:relative; background:#ddd; -webkit-transform: translate3D(0, 0, 0)}
span { display:inline-block; position:absolute; top:40px; left:40px; width:20px; background:#007; height:10px; -webkit-transition: -webkit-transform .5s; }
div:hover > span { -webkit-transform: rotate(180deg); }
<div>
<span></span>
</div>
Check out the fiddle: http://jsfiddle.net/UHLFF/