I'm trying to make a dropdown menu with mouse hover effects, using the label element.
When tag arrow shape slides on the menu image, it has an unexpected gap.
.mask {
width: 100%;
height: 100%;
position: absolute;
transform: translateX(-120%);
top: 0;
background-color: rgba(255,255,255,0.8);
-webkit-transition: all 0.6s ease;
transition: all 0.6s ease;
display: flex;
justify-content: flex-end;
align-items: center;
}
.mask:before {
content: "";
position: absolute;
top: 0%;
left: 100%;
margin-top: 0px;
width: 20%;
height: 100%;
background:
linear-gradient(to bottom left, transparent 50%, rgba(255,255,255,0.8) 51%) no-repeat top left/30% 50%,
linear-gradient(to top left, transparent 50%, rgba(255,255,255,0.8) 51%) no-repeat bottom left/30% 50%;
}
jsfiddle
I hope this helps someone.
Do it differently using clip-path
.testmenu {
max-width: 100%;
margin-bottom: 2vh;
}
.testmenu a {
display: block;
text-decoration: none;
color: transparent;
padding-top: calc(100%*168/1218);
}
label {
display: block;
margin: 0;
line-height: 1;
color: #fff0;
cursor: pointer;
width: 100%;
padding-top: calc(100%*200/1218);
background-position: left top;
background-repeat: no-repeat;
background-size: 100% auto;
}
label[for="testmenu_bar01"] {
background-image: url(https://placehold.jp/1218x218.png);
}
input {
display: none;
}
.testmenu ul {
margin: 0;
padding: 0;
background: #f4f4f4;
list-style: none;
}
.testmenu li {
height: 0;
overflow: hidden;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
background-size: contain;
}
.testmenu li.testmenu01-li-01 {
background-image: url("https://placehold.jp/1218x168.png");
background-position: left top;
background-repeat: no-repeat;
background-size: 100% auto;
}
.testmenu li.testmenu01-li-02 {
background-image: url("https://placehold.jp/1218x168.png");
background-position: left top;
background-repeat: no-repeat;
background-size: 100% auto;
}
#testmenu_bar01:checked~#links01 li {
height: 0;
padding-bottom: calc(100%*168/1218);
opacity: 1;
}
#testmenu_bar01:checked+#links01 li.testmenu01-li-01 {
margin-top: 2vh;
}
.sizing-mask {
position: relative;
overflow: hidden;
}
.mask {
width: 100%;
height: 100%;
position: absolute;
transform: translateX(-120%);
top: 0;
background-color: rgba(255, 255, 255, 0.8);
transition: all 0.6s ease;
display: flex;
justify-content: flex-end;
align-items: center;
clip-path:polygon(0 0,90% 0%, 100% 50%, 90% 100%,0% 100%);
}
.mask:after {
content: "";
width: 10%;
height: 100%;
}
.testmenu:hover .mask {
transform: translateX(-61%);
border-right: hidden;
}
<div id="onlineshop" class="testmenu">
<div class="sizing-mask">
<div class="mask">
<div class="test-caption">
<p style="color: rgba(0,0,0,1);font-size: 1vw;text-transform: inherit;letter-spacing: 1px;" class="eihe-title">text<span class="break"></span>text</p>
</div>
</div>
<label for="testmenu_bar01"></label>
</div>
<input type="checkbox" id="testmenu_bar01" class="accordion">
<ul id="links01">
<li class="testmenu01-li-01">
</li>
<li class="testmenu01-li-02">
</li>
</ul>
</div>
Related
I currently doing an Image galery, but I don't like the current design.
I'm looking to use a Modern-Card to show the image and when hover, shows the text linked to that image (either transparent or on a dark background).
Each methode I tried, the image just take the place of the darkbackground and the hover doesn't work anymore.
or disalign to it.
css :
.card {
-background: linear-gradient(to left, #f7ba2b 0%, #ea5358 100%);
width: 190px;
height: 254px;
padding: 5px;
border-radius: 1rem;
overflow: visible;
background: #f7ba2b;
background: var(--background);
position: relative;
z-index: 1;
}
.card::after {
position: absolute;
content: "";
top: 30px;
left: 0;
right: 0;
z-index: -1;
height: 100%;
width: 100%;
transform: scale(0.8);
filter: blur(25px);
background: #f7ba2b;
background: var(--background);
transition: opacity .5s;
}
.card-info {
\--color: #181818;
background: var(--color);
color: var(--color);
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
overflow: visible;
border-radius: .7rem;
}
.card .title {
font-weight: bold;
letter-spacing: .1em;
}
/*Hover*/
.card:hover::after {
opacity: 0;
}
.card:hover .card-info {
color: #f7ba2b;
transition: color 1s;
}
Html :
<div class="card">
<div class="card-info">
<p class="title">Magic Card</p>
</div>
</div>
from this website : https://uiverse.io/alexruix/heavy-elephant-39
Adding a in between the div and adjusting some css
I want to insert the image with a border that isn't overlapping the image since I want to see 100% of it. While being able to hover and see the customize text of each one.
I think this is what you mean.
#edit
I change from background-size: 190px 254px; to background-size: 180px 244px;
.card {
--background: linear-gradient(to left, #f7ba2b 0%, #ea5358 100%);
width: 190px;
height: 254px;
padding: 5px;
border-radius: 1rem;
overflow: visible;
background: #f7ba2b;
background: var(--background);
position: relative;
z-index: 1;
}
.card::after {
position: absolute;
content: "";
top: 30px;
left: 0;
right: 0;
z-index: -1;
height: 100%;
width: 100%;
transform: scale(0.8);
filter: blur(25px);
background: #f7ba2b;
background: var(--background);
transition: opacity .5s;
}
.card-info {
--color: #181818;
background: var(--color);
background-image: url('https://images.pexels.com/photos/337909/pexels-photo-337909.jpeg?auto=compress&cs=tinysrgb&w=1600');
background-size: 180px 244px;
background-repeat: no-repeat;
background-position-x: center;
background-position-y: center;
color: var(--color);
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
overflow: visible;
border-radius: .7rem;
}
.card .title {
font-weight: bold;
letter-spacing: .1em;
opacity:0;
}
/*Hover*/
.card:hover::after {
opacity: 0;
}
.card:hover .title {
color: #f7ba2b;
transition: color 1s, opacity 1s;
opacity:1;
}
<div class="card">
<div class="card-info">
<p class="title">Magic Card</p>
</div>
</div>
circle over two buttons
I want to have a circle between two buttons and show a half circle on one and a half on other using CSS. I have searched this but nothing appeared to be similar to this. I have to do this only with HTML and CSS.
So far I'm able to do this but Circle is not showing over the right-side button.[What I have done][2]
I have tried everything in my knowledge and search but it seems to be difficult for me.
Any possible solution? I need a solution only using CSS and HTML.
.container {
margin: 50px;
}
.button1 {
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display: inline-block;
margin-right: 5px;
background: linear-gradient(to right, #142f42 50%, #ff511a 50%);
background-size: 200% 100%;
background-position: right bottom;
transition: all .5s ease-out;
}
.button1:hover {
background: linear-gradient(to right, #142f42 100%, #ff511a 100%);
background-position: left bottom;
}
.text1 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: black;
transition: all .6s ease-out;
display: block;
}
.text1:hover {
color: white;
}
.button2 {
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display:inline-block;
position: absolute;
bottom: -3px;
margin-left: 5px;
background: linear-gradient(to left, #ff511a 50%, #142f42 50%);
background-size: 200% 100%;
background-position: left bottom;
transition: all .5s ease-out;
}
.button2:hover{
background: linear-gradient(to left, #ff511a 100%, #142f42 100%);
background-position: right bottom;
}
.text2 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: white;
transition: all .6s ease-out;
display: block;
}
.text2:hover {
color: black;
}
.circle{
z-index: 100;
background-color: #fff;
position: relative;
margin-left: -16px;
height: 8px;
width: 8px;
align-self: baseline;
display: inline-block;
white-space: nowrap;
vertical-align: middle;
padding: 0.675rem 0.75rem;
font-size: 1rem;
line-height: 1.8;
border-radius: 50%;
box-shadow: 0 0 0 0.3rem #c0c0c0;
}
<div class="container">
<div class="button1">
<div class="text1">Order</div>
</div>
<div class="circle" />
<div class="button2">
<div class="text2">Order</div>
</div>
</div>
You did not close circle div correctly <div class="circle" /> is wrong. It makes button two being rendered inside circle. I have corrected that.
Then I make the following changes to your css:
/* css */
.button2 {
/* remove or unset bottom */
bottom:unset;
/* move button2 to the right */
left: 250px;
}
.container {
margin: 50px;
}
.button1 {
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display: inline-block;
margin-right: 5px;
background: linear-gradient(to right, #142f42 50%, #ff511a 50%);
background-size: 200% 100%;
background-position: right bottom;
transition: all .5s ease-out;
}
.button1:hover {
background: linear-gradient(to right, #142f42 100%, #ff511a 100%);
background-position: left bottom;
}
.text1 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: black;
transition: all .6s ease-out;
display: block;
}
.text1:hover {
color: white;
}
.button2 {
left: 250px;
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display:inline-block;
position: absolute;
margin-left: 5px;
background: linear-gradient(to left, #ff511a 50%, #142f42 50%);
background-size: 200% 100%;
background-position: left bottom;
transition: all .5s ease-out;
}
.button2:hover{
background: linear-gradient(to left, #ff511a 100%, #142f42 100%);
background-position: right bottom;
}
.text2 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: white;
transition: all .6s ease-out;
display: block;
}
.text2:hover {
color: black;
}
.circle{
z-index: 100;
background-color: #fff;
position: relative;
margin-left: -16px;
height: 8px;
width: 8px;
align-self: baseline;
display: inline-block;
white-space: nowrap;
vertical-align: middle;
padding: 0.675rem 0.75rem;
font-size: 1rem;
line-height: 1.8;
border-radius: 50%;
box-shadow: 0 0 0 0.3rem #c0c0c0;
}
<div class="container">
<div class="button1">
<div class="text1">Order</div>
</div>
<div class="circle"></div>
<div class="button2">
<div class="text2">Order</div>
</div>
</div>
This is a clue <div class="circle"></div>
.container {
margin: 50px;
}
.group-button {
position: relative;
}
.button1 {
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display: inline-block;
margin-right: 5px;
background: linear-gradient(to right, #142f42 50%, #ff511a 50%);
background-size: 200% 100%;
background-position: right bottom;
transition: all .5s ease-out;
}
.button1:hover {
background: linear-gradient(to right, #142f42 100%, #ff511a 100%);
background-position: left bottom;
}
.text1 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: black;
transition: all .6s ease-out;
display: block;
}
.text1:hover {
color: white;
}
.button2 {
border: 1px solid black;
border-radius: 3px;
width: 180px;
height: 34px;
display: inline-block;
bottom: -3px;
margin-left: 5px;
background: linear-gradient(to left, #ff511a 50%, #142f42 50%);
background-size: 200% 100%;
background-position: left bottom;
transition: all .5s ease-out;
}
.button2:hover {
background: linear-gradient(to left, #ff511a 100%, #142f42 100%);
background-position: right bottom;
}
.text2 {
text-align: center;
font-size: 16px;
line-height: 30px;
color: white;
transition: all .6s ease-out;
display: block;
}
.text2:hover {
color: black;
}
.circle {
z-index: 100;
background-color: #fff;
position: relative;
margin: -16px;
height: 8px;
width: 8px;
align-self: baseline;
display: inline-block;
white-space: nowrap;
vertical-align: middle;
padding: 0.475rem;
font-size: 1rem;
line-height: 1.8;
border-radius: 50%;
box-shadow: 0 0 0 0.3rem rgba(192, 192, 192, 0.5);
}
<div class="container">
<div class="group-button">
<div class="button1">
<div class="text1">Order</div>
</div>
<div class="circle"></div>
<div class="button2">
<div class="text2">Order</div>
</div>
</div>
I have a div with a background image, what I would like to do, is when I hover over it, the hidden part of background-image to display like in the example below:
My jsfiddle example:
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg);
background-size: cover;
width: 70px;
height: 70px;
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 100px;
}
.test:hover{
transform: scale(1.2);
}
body {
text-align: center;
}
<div class="test">
</div>
As you can see, in my example the image is just getting larger, instead I want to display another 20px of the image (without compromising border-radius).
Example with one html element:
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg) no-repeat 50% 50%;
background-size: 140px;
width: 70px;
height: 70px;
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 100px;
transform-origin: center center;
}
.test:hover{
width: 90px;
height: 90px;
margin-left: -10px;
margin-top: -10px;
}
body {
text-align: center;
}
<div class="test">
</div>
Example with clip-path and shape-inside:
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg) no-repeat 50% 50%;
background-size: cover;
shape-inside: circle(30% at 50% 50%);
clip-path: circle(30% at 50% 50%);
-webkit-clip-path: circle(30% at 50% 50%);
width: 70px;
height: 70px;
background-position: center;
display: inline-block;
transition: all 1s;
position: absolute;
top: 100px;
transform-origin: center center;
}
.test:hover{
shape-inside: circle(50% at 50% 50%);
clip-path: circle(50% at 50% 50%);
-webkit-clip-path: circle(50% at 50% 50%);
}
body {
text-align: center;
}
<div class="test">
</div>
you might oversize a bit the background image
(background-size:auto 90px;) and add some padding and reset position on hover (.test:hover{padding:10px; margin:-10px;})
those rules are suppose to be understood by most of actual browsers if not all.
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg);
background-size:auto 90px;
width: 70px;
height: 70px;
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 100px;
}
.test:hover{
padding:10px;
margin:-10px;;
}
body {
text-align: center;
}
<div class="test">
</div>
another possibility is to use an inset shadow
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg);
background-size: auto 90px;
width: 90px;
height: 90px;
/* hide buggy ff render */
background-clip: content-box;
padding: 1px;
/* end fix ff */
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 90px;
box-shadow: inset 0 0 0 10px white;
}
.test:hover {
box-shadow: inset 0 0 0 0px white;
}
body {
text-align: center;
}
<div class="test">
</div>
There is also : padding, box-sizing and background-clip
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg) ;
background-size: auto 90px;
width: 90px;
height: 90px;
padding: 10px;
background-clip:content-box;
box-sizing:border-box;
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 90px;
}
.test:hover {
padding:0px;
}
/* show transparency */
html {
min-height:100%;
text-align: center;
background:linear-gradient(45deg, gray, yellow,purple,lime,pink,turquoise, gray, yellow,purple,lime,pink,turquoise);
}
<div class="test"></div>
You are missing to remove border-radius property on the hover event:
div.test {
background: url(http://media2.intoday.in/indiatoday/images/Photo_gallery/emraan_012315020812.jpg);
background-size: cover;
width: 70px;
height: 70px;
background-position: center;
border-radius: 100%;
display: inline-block;
transition: all 1s;
position: absolute;
top: 100px;
}
.test:hover{
transform: scale(1.2);
border-radius: 0px;
}
body {
text-align: center;
}
<div class="test">
</div>
I am having a tricky(at least for me) problem with a div which is a flip card done purely in css. The front of the card shows an image and the back has a different image and a button. The problem is due to the fluid design I had to set the padding. Which places all of the text below the div
.card {
margin: 0 auto;
position: relative;
float: left;
padding-bottom: 25%;
width: 100%;
max-width: 600px;
}
.card__front,
.card__back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.card__front,
.card__back {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 0.7s;
transition: transform 0.7s;
}
.card__front {
background-image: url("http://i58.tinypic.com/mmu649.jpg");
padding-top: 56.25%;
background-size: cover;
-moz-background-size: cover;
background-position: center;
}
.card__back {
background-image: url("http://i58.tinypic.com/mmu649.jpg");
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
padding-top: 56.25%;
background-size: cover;
-moz-background-size: cover;
background-position: center;
}
.card.effect__hover:hover .card__front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.card.effect__hover:hover .card__back {
-webkit-transform: rotateY(0);
transform: rotateY(0);
}
.card__text {
width: auto;
text-align: center;
height: 100%;
margin-top: -32%;
}
.button {
background-color: #000000;
text-indent: 0;
border: 1px solid #000000;
display: inline-block;
color: #ffffff;
font-family: Arial;
font-size: 21px;
font-weight: normal;
font-style: normal;
height: 69px;
line-height: 69px;
width: 200px;
text-decoration: none;
text-align: center;
opacity: 0.8;
}
.button:hover {
background: -webkit-gradient(linear, left top, left bottom, color- stop(0.05, #000000), color-stop(1, #000000));
background: -moz-linear-gradient(center top, #000000 5%, #000000 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#000000');
background-color: #000000;
}
.button:active {
position: relative;
top: 1px;
}
<div class="card effect__hover">
<div class="card__front">
<div class="card__text"></div>
</div>
<div class="card__back">
<div class="card__text"> see more
</div>
</div>
</div>
<!-- /card -->
Here is the preview of the code: http://jsfiddle.net/j29mvoLm/
All I am trying to get is to center the same button in every card like div.
Is it possible to do it without using negative margin?
This should do you justice:
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
or
display: table-cell;
vertical-align: middle;
It is possible. See snippet. This answer uses nested relative and absolute positioned elements and also utilized box-sizing:border-box; and padding to maintain aspect ratio.
If you need to to set a max-width, add another wrapper element around your card and set the max-width on that element.
.card-wrapper {
margin: auto;
max-width: 600px;
}
.card {
box-sizing: border-box;
margin: auto;
padding: 28.125% 50%; /* 16:9 aspect ratio */
position: relative;
width: 100%;
}
.card__front, .card__back {
bottom: 0;
height: 100%;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
width: 100%;
}
.card__front, .card__back {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 0.7s;
transition: transform 0.7s;
}
.card__front {
background-image: url("http://i58.tinypic.com/mmu649.jpg");
background-size: cover;
-moz-background-size: cover;
background-position: center;
}
.card__back {
background-image: url("http://i58.tinypic.com/mmu649.jpg");
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
background-size: cover;
-moz-background-size: cover;
background-position: center;
}
.card.effect__hover:hover .card__front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.card.effect__hover:hover .card__back {
-webkit-transform: rotateY(0);
transform: rotateY(0);
}
.card__text {
height: 100%;
position: relative;
text-align: center;
width: 100%;
}
.button {
background-color: #000000;
border: 1px solid #000000;
bottom: 0;
color: #ffffff;
display: block;
font-family: Arial;
font-size: 21px;
font-style: normal;
font-weight: normal;
height: 69px;
left: 0;
line-height: 69px;
margin: auto;
opacity: 0.8;
position: absolute;
right: 0;
text-align: center;
text-decoration: none;
text-indent: 0;
top: 0;
width: 200px;
}
.button:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #000000) );
background:-moz-linear-gradient( center top, #000000 5%, #000000 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#000000');
background-color:#000000;
}
.button:active {
position:relative;
top:1px;
}
<div class="card-wrapper">
<div class="card effect__hover">
<div class="card__front">
<div class="card__text"></div>
</div>
<div class="card__back">
<div class="card__text"> see more </div>
</div>
</div><!-- /card -->
</div>
I'm trying to make the image on the left of the following page resize like the images on the right when the browser window is made smaller/bigger:
http://www.hugoproject.com/test.html
I am using a sprite for the image on the left. My code is as follows:
HTML
<div id="home-projects">
<div id="projects">
<div class="project-group">
<div class="project">
Arrow<span></span>
</div>
</div>
</div>
CSS
#home-projects {
text-align: center;
overflow: hidden;
position: relative;
}
#projects {
width: 100%;
}
.project-group {
width: 100%;
height: 100%;
position: absolute;
}
.project {
float: left;
text-align: center;
width: 33.3%;
}
.project-link {
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-color: #adadad;
position: relative;
overflow: hidden;
display: inline-block;
width: 80%;
}
.circle .project-link, .circle .project-link .hover {
border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
}
.project-link .hexagon-top {
content: '';
display: block;
position: absolute;
left: 0;
border-style: solid;
border-bottom-color: transparent;
border-left-color: #dfdfdf;
border-right-color: #dfdfdf;
width: 0;
height: 0;
z-index: 2;
}
.project-link .hexagon-bottom {
content: '';
display: block;
position: absolute;
left: 0;
bottom: 0;
border-style: solid;
border-top-color: transparent;
border-left-color: #dfdfdf;
border-right-color: #dfdfdf;
width: 0;
height: 0;
z-index: 2;
}
.project-link .hover {
position: absolute;
width: 100%;
height: 100%;
font-size: 14px;
text-align: center;
color: #fff;
background: #ec6136;
text-decoration: none;
text-transform: uppercase;
display: block;
opacity: 0;
transition: all .3s;
-moz-transition: all .3s;
-webkit-transitin: all .3s;
}
.project-link .hover-text {
display: block;
margin-top: 45%;
}
.project-link .hover-text:after {
content: '>';
font-family: 'icon';
font-size: 12px;
margin-left: 15px;
}
.project-link:hover > .hover {
opacity: .9;
}
.HS {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 283px;
height: 213px;
background: url(http://www.hugoproject.com/ftp1/images/icons.png) no-repeat;
}
.HS span {
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background: url(http://www.hugoproject.com/ftp1/images/icons.png) no-repeat;
background-position: 0 -214px;
opacity: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
}
.HS:hover span {
opacity: 1;
}
What am I doing wrong?
This resizes it like you want (in Firefox at least, haven't tested elsewhere). Mainly have to use %'s, not fixed size in order to scale.
.HS {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 100%;
height: 75%;
background-image: url("http://www.hugoproject.com/ftp1/images/icons.png");
background-position: 0px 0px;
background-size: 800%;
}
.HS span {
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background-image: url("http://www.hugoproject.com/ftp1/images/icons.png");
background-position: 0px -100%;
opacity: 0;
width: 100%;
height: 100%;
background-size: 800%;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
}
.project {
float: left;
text-align: center;
width: 33.3%;
height:100%;
}
Another, possibly better, option would be to actually crop your PNG into separate images rather than selecting the position so that you can use the same CSS as with your other images.