CSS zoom effect background hover - css

I am trying to archieve a zoom in my background's in divs. I don't want the div to be bigger, but I want the image to zoom on hover, without growing the div. I have tried everything, but I can't seem to get it to work.
CSS:
/* Theme */
html {
margin-top: 0px !important;
}
/* DO NOT EDIT OR MONKEYS WILL BITE YOU */
.frame_holder {
position: absolute;
top: 8px;
bottom: 50px;
/* left: 50px; */
right: 150px;
background: #ffffff;
}
.my_frame {
width: 149%;
height: 108%;
/* border: 1px solid #e0e0e0; */
}
body {
background-color: #f0ede9;
margin-top: 0px;
position: relative;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.clearfix {
clear: both;
}
p {
font-family: Roboto;
padding: 1px;
}
#body.layout-1 {
background: #f0ede9 url(../images/border.gif) 640px top repeat-y scroll;
background-color: #f0ede9;
background-image: url(../images/border.gif), url(../images/border-2.gif);
background-repeat: repeat-y, repeat-y;
background-position: 640px top, 0px top;
}
a:hover, a:visited, a:link, a:active {
text-decoration: none;
color: #bababa;
font-family: Roboto;
}
#wrapper {
width: 1200px;
margin: 0 auto;
}
#header {
width: 100%;
height: 80px;
background: #2a2727;
margin-top: 20px;
color: #fff;
}
.top-logo-container {
display: block;
height: 100px;
width: 100px;
text-indent: -9999px;
background: url(http://favoritefm.com/wp-content/themes/FavClear/img/logo.png) 5% 50% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100px;
}
#main {
margin-left: 2px;
}
.presenter-ribbon {
display: block;
position: absolute;
left: -5px;
top: 20px;
color: #fff;
background-color: #de1f26;
font-size: 12px;
line-height: 30px;
padding: 0 20px 0 30px;
font-family: 'Roboto Condensed',sans-serif;
font-weight: 700;
text-shadow: 0 -1px 0 rgba(0,0,0,.2);
text-transform: uppercase;
z-index: 20;
text-decoration: none;
box-shadow: 0 1px 2px 0 rgba(0,0,0,.25);
}
#presenter {
margin-top: 40px;
width: 100%;
height: 100%;
}
.box-link {
display: block;
position: absolute;
overflow: hidden;
box-sizing: border-box;
padding: 60px 20px 10px;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-size: cover;
background-position: center center;
-webkit-transition: all .1s linear;
-moz-transition: all .1s linear;
-ms-transition: all .1s linear;
-o-transition: all .1s linear;
}
.box-link .box-overlay {
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,.15);
z-index: 10;
box-shadow: 5px 5px 10px 0 rgba(0,0,0,.2) inset;
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
}
.box-link .box-overlay:hover {
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,.15);
z-index: 10;
box-shadow: 5px 5px 10px 0 rgba(0,0,0,.2) inset;
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
}
.box-link .box-visual {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-size: cover;
background-position: center center;
z-index: 5;
max-width: 100%;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.box-link .box-visual:hover {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-size: cover;
background-position: center center;
z-index: 5;
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
opacity: 0.7;
}
.box-link h4 {
display: block;
color: #fff;
text-decoration: none;
text-shadow: 0 1px 2px rgba(0,0,0,.8);
z-index: 20;
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
margin-bottom: 0;
}
.box-link h4 {
font-size: 22px;
line-height: 34px;
}
.presenter-one {
display: block;
height: 49.65%;
width: 50%;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
}
.presenter-two {
float: left;
position: relative;
display: block;
height: 25%;
width: 25%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-three {
position: relative;
display: block;
height: 25%;
width: 25%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-four {
position: relative;
display: block;
height: 25.4%;
width: 25%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-five {
position: relative;
display: block;
height: 25.4%;
width: 25%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
}
#media screen and (min-width: 737px) and (max-width: 1200px) {
#wrapper {
width: 100%
}
}
#media screen and (min-width: 737px) and (max-width: 1200px) {
#wrapper {
width: 100%
}
}
#media screen and (max-width: 736px) and (min-width: 415px) {
#wrapper {
width: 100%
}
#header {
width: 100%;
background: #2a2727;
color: #fff;
margin-top: 0px;
height: 100px;
}
.top-logo-container {
display: block;
height: 120px;
width: 120px;
background: url(http://favoritefm.com/wp-content/themes/FavClear/img/logo.png) 5% 50% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 120px;
}
#main {
margin-left: 2px;
}
#presenter {
margin-top: 40px;
width: 100%;
height: 100%;
}
.presenter-one {
display: block;
height: 50%;
width: 100%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-two {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-three {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-four {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-five {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
}
#media screen and (max-width: 414px) and (min-width: 1px) {
#wrapper {
width: 100%
}
#header {
width: 100%;
background: #2a2727;
color: #fff;
margin-top: 0px;
height: 100px;
}
.top-logo-container {
display: block;
height: 120px;
width: 120px;
background: url(http://favoritefm.com/wp-content/themes/FavClear/img/logo.png) 5% 50% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 120px;
}
#main {
margin-left: 2px;
}
#presenter {
margin-top: 40px;
width: 100%;
height: 100%;
}
.presenter-one {
display: block;
height: 50%;
width: 100%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-two {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-three {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-four {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-five {
display: block;
height: 50%;
width: 50%;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
}
https://jsfiddle.net/9b7fvfk6/
HTML:
<meta name="viewport" content="width=device-width" />
<div id="wrapper">
<div id="header"></div>
<div id="main">
<div id="presenter">
<div class="presenter-one"><a class="presenter-ribbon" href="/Testcategorie" ng-if="element.ribon">Testcategorie</a><a class="box-link" href="/airfield"><h4 class="ng-binding">Dit is een testregel!</h4><span class="box-overlay"></span> <span class="box-visual" style="background-image: url('http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg')"></span></a></div>
<div class="presenter-two"><a class="presenter-ribbon" href="/Testcategorie" ng-if="element.ribon">Testcategorie</a><a class="box-link" href="/airfield"><h4 class="ng-binding">Dit is een testregel!</h4><span class="box-overlay"></span> <span class="box-visual" style="background-image: url('http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg')"></span></a></div>
<div class="presenter-three"><a class="presenter-ribbon" href="/Testcategorie" ng-if="element.ribon">Testcategorie</a><a class="box-link" href="/airfield"><h4 class="ng-binding">Dit is een testregel!</h4><span class="box-overlay"></span> <span class="box-visual" style="background-image: url('http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg')"></span></a></div>
<div class="presenter-four"><a class="presenter-ribbon" href="/Testcategorie" ng-if="element.ribon">Testcategorie</a><a class="box-link" href="/airfield"><h4 class="ng-binding">Dit is een testregel!</h4><span class="box-overlay"></span> <span class="box-visual" style="background-image: url('http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg')"></span></a></div>
<div class="presenter-five"><a class="presenter-ribbon" href="/Testcategorie" ng-if="element.ribon">Testcategorie</a><a class="box-link" href="/airfield"><h4 class="ng-binding">Dit is een testregel!</h4><span class="box-overlay"></span> <span class="box-visual" style="background-image: url('http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg')"></span></a></div>
</div>
</div>
Is there anyone who can help me? I thought I would have to make a box-visual:hover, but that's not doing anything either. :-(

Change the hover to the .box-link should makes it working. Example:
.box-link:hover .box-visual {
transform: scale(1.1);
}
See Updated Fiddle

If you don't want the image to cross the borders of the div, set the div CSS property to overflow: hidden;
.container {
border: 2px solid black;
height: 300px;
width: 300px;
overflow: hidden;
}
img:hover {
transform: scale(1.5);
}
<div class="container">
<img src="http://goo.gl/1ex50e"/>
</div>

Related

how can I add hover here?

This is the current code I made, the rotations and animations are okay, but I can't make a hover text in the image of the planet or the orbit of the planet.
<html>
<head>
<style>
body {
background-image: url(bg.jpg);
background-size: cover;
}
I can't make a hover with this while the planets were animating.
.sun {
left:700px;
top:300px;
height: 170px;
width: 170px;
background-image: url("sun.png");
background-repeat: cover;
background-size: 100%;
position: absolute;
margin: 0;
}
the planet or the orbit of the planet when you hover it, it should show the text or the name of the planet itself.
.mercury {
left:680px;
top:343px;
height: 40px;
width: 40px;
background-image: url("mercury.png");
background-repeat: no-repeat;
background-size: 100%;
position: absolute;
transform-origin: 280% 90%;
animation: rotate 1.5s infinite linear;
}
.mercuryOrbit {
left:690px;
top:285px;
height: 190px;
width: 190px;
background-color: transparent;
border-radius: 50%;
border-style: dashed;
border-color: gray;
position: absolute;
border-width: 1px;
margin: 0px;
padding: 0px;
}
.venus {
left:600px;
top:330px;
height: 50px;
width: 50px;
background-image: url("venus.png");
background-repeat: no-repeat;
background-size: 100%;
position: absolute;
transform-origin: 370% 80%;
animation: rotate 3.84s infinite linear;
}
.venusOrbit {
left:620px;
top:210px;
height: 330px;
width: 330px;
background-color: transparent;
border-radius: 50%;
border-style: dashed;
border-color: gray;
position: absolute;
border-width: 1px;
margin: 0px;
padding: 0px;
}
.earth {
left:535px;
top:300px;
height: 70px;
width: 70px;
background-image: url("earth.png");
background-repeat: no-repeat;
background-size: 100%;
position: absolute;
transform-origin: 350% 100%;
animation: rotate 6.25s infinite linear;
}
.earthOrbit {
left:570px;
top:160px;
height: 430px;
width: 430px;
background-color: transparent;
border-radius: 50%;
border-style: dashed;
border-color: gray;
position: absolute;
border-width: 1px;
margin: 0px;
padding: 0px;
}
#keyframes rotate {
100% {
transform: rotate(-360deg);
}
}
</style>
</head>
<body>
<div class=“solarsys”>
<div class="sun"></div>
<div class="mercuryOrbit"></div>
<div class="mercury"></div>
<div class="venusOrbit"></div>
<div class="venus"></div>
<div class="earthOrbit"></div>
<div class="earth"></div>
</div>
</body>
</html>
How can I add hover effect on the image so that the name of the planet will show? I don't know how to add it.
This issue may stem from the orbits overlapping on your planets. Try adding z-index : 1 for example to one of your planet class and test the hovering again.
Here is an example:
.mercury {
/* rest of your class here */
position: relative;
z-index: 1;
}
.mercury::after {
content: "Hello world";
position: absolute;
font-size: 0.8rem;
background-color: #3f3f3f;
border-radius: 3px;
padding: 0.2rem;
bottom: 100%;
left: 0;
color: white;
display: none;
}
.mercury:hover.mercury::after {
display: block;
}
For more informations on z-index:
https://developer.mozilla.org/en-US/docs/Web/CSS/z-index

Responsive doesn't work in phone

I create a website and I make hem responsive with #media, All things are right, when I slimming with Mozilla I don't have any problem
but when I see my site with my phone all things are lost, I see a disaster :'(
I make Mozilla size {
1280px, 980px, 800px, 768px, 360px, 320px
}
#media only screen and (max-width : 992px) {
body {
background:url(img/Saad.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.logo {
background: transparent url("img/logo.png") no-repeat scroll center top;
width: 212px;
height: 89px;
position: absolute;
top: 85px;
margin-left: 702px;
}
.gauche {
margin-top : -253px;
float: left;
width: 250px;
height: 75px;
position: absolute;
margin-left: 15px;
}
.rs li {
float: left;
width: 47px;
height: 47px;
margin:0px 4px 0px 0px;
}
.players {
width: 700px;
margin: 321px auto;
display: block;
position: relative;
height: 90px;
}
.hicham{
display: block;
margin: -563px 140px 79px 130px;
position: absolute;
}
.hand{
display: block;
margin: -495px 0px 94px 357px;
}
.basket{
margin: -906px 0px 98px 260px;
}
.foot, .hicham, .hand, .basket{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.foot:hover, .hicham:hover {
-webkit-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-o-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);
transform: rotate(-10deg);
}
.hand:hover, .basket:hover{
-webkit-transform: rotate(10deg);
-moz-transform: rotate(10deg);
-o-transform: rotate(10deg);
-ms-transform: rotate(10deg);
transform: rotate(10deg);
}
a li{
list-style: none;
}
.fb {
background: transparent url("icon/facebook.png") no-repeat center top;
}
.twitter {
background: transparent url("icon/twitter.png") no-repeat scroll center top;
}
.instagram {
background: transparent url("icon/icon4.png") no-repeat scroll center top;
}
.youtube {
background: transparent url("icon/youtube.png") no-repeat scroll center top;
}
.sponsors {
display: block;
width: auto;
height: 65px;
background: #FFF url("img/pubb.png") no-repeat scroll center top;
margin-top: 320px;
}
.copyright {
font-family: monospace;
color: #FFF;
text-transform: inherit;
display: block;
text-align: center;
margin-top: 30px;
font-weight: bold;
font-size: 12px;
}
}
/* Medium Devices, Desktops */
#media only screen and (max-width : 800px) {
body {
background:url(img/Saad.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.logo {
background: transparent url("img/logo.png") no-repeat scroll center top;
width: 212px;
height: 89px;
position: absolute;
top: 85px;
margin-left: 555px;
}
.gauche {
margin-top : -253px;
float: left;
width: 250px;
height: 75px;
position: absolute;
margin-left: 15px;
}
.rs li {
float: left;
width: 47px;
height: 47px;
margin:0px 4px 0px 0px;
}
.players{
width: 700px;
margin: 354px auto;
display: block;
position: relative;
height: 90px;
}
.hicham{
display: block;
margin: -563px 140px 79px 130px;
position: absolute;
}
.hand{
display: block;
margin: -495px 0px 94px 357px;
}
.basket{
margin: -906px 0px 98px 260px;
}
.foot, .hicham, .hand, .basket{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.foot:hover, .hicham:hover {
-webkit-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-o-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);
transform: rotate(-10deg);
}
.hand:hover, .basket:hover{
-webkit-transform: rotate(10deg);
-moz-transform: rotate(10deg);
-o-transform: rotate(10deg);
-ms-transform: rotate(10deg);
transform: rotate(10deg);
}
a li{
list-style: none;
}
.fb {
background: transparent url("icon/facebook.png") no-repeat center top;
}
.twitter {
background: transparent url("icon/twitter.png") no-repeat scroll center top;
}
.instagram {
background: transparent url("icon/icon4.png") no-repeat scroll center top;
}
.youtube {
background: transparent url("icon/youtube.png") no-repeat scroll center top;
}
.sponsors {
display: block;
width: auto;
height: 65px;
background: #FFF url("img/pubb.png") no-repeat scroll center top;
margin-top: 320px;
}
.copyright {
font-family: monospace;
color: #FFF;
text-transform: inherit;
display: block;
text-align: center;
margin-top: 30px;
font-weight: bold;
font-size: 12px;
}
}
/* Small Devices, Tablets */
#media only screen and (max-width : 768px) {
body {
background:url(img/Saad.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.logo {
background: transparent url("img/logo.png") no-repeat scroll center top;
width: 212px;
height: 89px;
position: absolute;
top: 85px;
margin-left: 526px;
}
.gauche {
margin-top : -237px;
float: left;
width: 250px;
height: 75px;
position: absolute;
margin-left: 15px;
}
.rs li {
float: left;
width: 47px;
height: 47px;
margin:0px 4px 0px 0px;
}
.players{
width: 700px;
margin: 353px auto;
display: block;
position: relative;
height: 90px;
}
.hicham{
display: block;
margin: -563px 140px 79px 130px;
position: absolute;
}
.hand{
display: block;
margin: -495px 0px 94px 357px;
}
.basket{
margin: -906px 0px 98px 260px;
}
.foot, .hicham, .hand, .basket{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.foot:hover, .hicham:hover {
-webkit-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-o-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);
transform: rotate(-10deg);
}
.hand:hover, .basket:hover{
-webkit-transform: rotate(10deg);
-moz-transform: rotate(10deg);
-o-transform: rotate(10deg);
-ms-transform: rotate(10deg);
transform: rotate(10deg);
}
a li{
list-style: none;
}
.fb {
background: transparent url("icon/facebook.png") no-repeat center top;
}
.twitter {
background: transparent url("icon/twitter.png") no-repeat scroll center top;
}
.instagram {
background: transparent url("icon/icon4.png") no-repeat scroll center top;
}
.youtube {
background: transparent url("icon/youtube.png") no-repeat scroll center top;
}
.sponsors {
display: block;
width: auto;
height: 65px;
background: #FFF url("img/pubb.png") no-repeat scroll center top;
margin-top: 320px;
}
.copyright {
font-family: monospace;
color: #FFF;
text-transform: inherit;
display: block;
text-align: center;
margin-top: 30px;
font-weight: bold;
font-size: 12px;
}
}
/* Custom, iPhone Retina */
#media only screen and (max-width : 360px) {
body {
background:url(img/Saad.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.logo {
background: transparent url("img/logo.png") no-repeat scroll center top;
width: 212px;
height: 89px;
position: absolute;
top: 22px;
margin-left: 70px;
}
.gauche {
visibility: hidden;
}
.players{
margin: 100px 0px 0px -374px;
}
.foot{
margin: -1px 0px 0px 417px;
}
.hicham{
display: block;
position: absolute;
visibility: hidden;
}
.hand{
display: block;
visibility: hidden;
}
.basket{
visibility: hidden;
}
.sponsors {
display: block;
width: auto;
height: 65px;
background: #FFF url("img/pubb1.png") no-repeat scroll center top;
margin-top: 320px;
}
.copyright {
font-family: monospace;
color: #FFF;
text-transform: inherit;
display: block;
text-align: center;
margin-top: 20px;
font-weight: bold;
font-size: 12px;
}
}
/* Extra Small Devices, Phones */
#media only screen and (max-width : 320px) {
body{
background:url(img/Saad.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
overflow-x:hidden;
}
.players {
margin: 131px 0px 0px -405px;
}
.logo {
margin: -9px 0px 0px 49px;
}
.gauche {
visibility: hidden;
}
.sponsors {
display: block;
width: auto;
height: 25px;
background: #FFF url("img/pubb1.png") no-repeat scroll center top;
margin-top: 148px;
}
.foot{
margin: -28px 0px 0px 461px;
width: 200px;
}
.hicham{
display: block;
position: absolute;
visibility: hidden;
}
.hand{
display: block;
visibility: hidden;
}
.basket{
visibility: hidden;
}
.copyright {
font-family: monospace;
color: #FFF;
text-transform: inherit;
display: block;
text-align: center;
margin-top: 6px;
font-weight: bold;
font-size: 12px;
}
}
Any help ?
Mobile browsers try to make your site look good, so they don't render your site pixel for pixel, like you might expect. For example: let's say your phone has a width of 250px, but your phone might tell your website that it is 500px or even 1000px wide, which in turn make your #media queries obsolete.
After that long explanation, this is what you need to add to the <head> of your html code: <meta name="viewport" content="width=device-width, initial-scale=1">, that should make your phone (and all other phones) tell your website what the phone's width REALLY is. And all your #media queries should work.
Hope that helped!
Here's some articles worth checking out for more information:
CSS Tricks: https://css-tricks.com/snippets/html/responsive-meta-tag/
MDN: https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag
Envato Tuts+: http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972

CSS viewport width

Okay, so at this moment I am busy learning responsive CSS. It might be simple for you, but I don't understand how to archieve this:
I am playing with making a 'grid'. I have set all the classes to percentages in width and height, so that should not be the problem. However, when I resize the viewport (window), it's not dynamically growing or shrinking.
See: here
Currently using the following html:
<meta name="viewport" content="width=device-width" />
<div id="wrapper">
<div id="header">
</div>
<div id="presenter">
</div>
<div id="main">
</div>
Using the following CSS:
<style>
/* Theme */
html {
margin-top: 0px !important;
}
/* DO NOT EDIT OR MONKEYS WILL BITE YOU */
.frame_holder {
position: absolute;
top: 8px;
bottom: 50px;
/* left: 50px; */
right: 150px;
background: #ffffff;
}
.my_frame {
width: 149%;
height: 108%;
/* border: 1px solid #e0e0e0; */
}
body {
background-color: #f0ede9;
margin-top: 0px;
position: relative;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.clearfix {
clear: both;
}
p {
font-family: Roboto;
padding: 1px;
}
#body.layout-1 {
background: #f0ede9 url(../images/border.gif) 640px top repeat-y scroll;
background-color: #f0ede9;
background-image: url(../images/border.gif), url(../images/border-2.gif);
background-repeat: repeat-y, repeat-y;
background-position: 640px top, 0px top;
}
a:hover, a:visited, a:link, a:active {
text-decoration: none;
color: #bababa;
font-family: Roboto;
}
#wrapper {
width: 965px;
margin: 0 auto;
overflow: hidden;
}
#header {
width: 100%;
height: 80px;
background: #2a2727;
margin-top: 20px;
color: #fff;
}
.top-logo-container {
display: block;
height: 100px;
width: 100px;
text-indent: -9999px;
background: url(http://favoritefm.com/wp-content/themes/FavClear/img/logo.png) 5% 50% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100px;
}
#main {
margin-left: 2px;
overflow: hidden;
}
#presenter {
margin-top: 40px;
width: 100%;
height: 40%;
overflow: hidden;
}
.presenter-one {
display: block;
height: 100%;
width: 50%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-two {
float: left;
position: relative;
display: block;
height: 50%;
width: 25%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 266px 300px;
}
.presenter-three {
position: relative;
display: block;
height: 50%;
width: 25%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 266px 310px;
}
.presenter-four {
position: relative;
display: block;
height: 52%;
width: 25%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 266px 300px;
}
.presenter-five {
position: relative;
display: block;
height: 52%;
width: 25%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 266px 300px;
}
#media screen and (max-width: 965px) {
body {
width: 50%;
}
#main {
width: 50%
}
#media screen and (max-width: 365px) {
body {
width: 100%;
}
#wrapper {
width: 100%
margin: 0 auto;
}
#header {
width: 100%;
background: #2a2727;
color: #fff;
margin-top: 0px;
height: 100px;
}
.top-logo-container {
display: block;
height: 120px;
width: 120px;
text-indent: -9999px;
background: url(http://favoritefm.com/wp-content/themes/FavClear/img/logo.png) 5% 50% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 120px;
}
#main {
margin-left: 2px;
}
#presenter {
margin-top: 40px;
width: 100%;
height: 100%;
}
.presenter-one {
display: block;
height: 100%;
width: 100%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-two {
display: block;
height: 50%;
width: 50%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-three {
position: relative;
display: block;
height: 50%;
width: 50%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-four {
position: relative;
display: block;
height: 50%;
width: 50%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%;
}
.presenter-five {
position: relative;
display: block;
height: 50%!important;
width: 50%;
text-indent: -9999px;
background: url(http://eastsbeach.com.au/assets/Uploads/_resampled/SetWidth2000-Kiama-Events-Easts-Beach-PB.jpg) 0% 0% no-repeat scroll;
margin: 0 auto;
position: relative;
float: left;
background-color: #000;
margin-top: -10px;
background-size: 100% 100%
}
}
You’ve missed closing your #media screen and (max-width: 965px) and setting your #wrapper to width: 100%; in this breakpoint. Then it will be responsive.
#media screen and (max-width: 965px) {
body {
width: 50%;
}
#wrapper {
width: 100%;
}
#main {
width: 50%
}
}
Additionally:
I don’t think it makes any sense to set the width of body and #main to 50 % here.
See JSFiddle

CSS Transform at chrome

I've created simply hover animation using CSS and some Jquery. All works fine until chrome get updated. Now transformed element is half after content and half before, link to demo site: http://demo.pandaart.pl/wp/gemini/ On firefox it works fine. On IE same problem as chrome.
Here is my CSS:
#home_boxes{
position: relative;
margin-left: -10px;
margin-right: -10px;
display: table;
width:1170px;
}
#home_boxes .item {
float: left;
width: 370px; height: 250px;
display: block;
margin: 10px;
}
#home_boxes .box .opis{
position: absolute;
height: 100px;
width:100%;
left:0; bottom: 0;
color: #FFF;
z-index: 1;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.7);
text-align: center;
}
#home_boxes .box .opis .bg{
background: #dd2a1b;
opacity: 0.7;
position: absolute;
width:100%;
height: 100%;
left:0;top:0;
display: block;
z-index: -1;
}
#home_boxes .box .content{
display: none;
height: 100%;
padding: 20px;
background: #FFF;
opacity: 0;
}
#home_boxes .box {
float: left;
width: 370px; height: 250px;
display: block;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
background-color: #FFF;
border: 7px solid #442321;
border-radius: 7px;
position: relative;
overflow: hidden;
transition: all 0.8s cubic-bezier(0.18, 0.89, 0.32, 1);
}
#home_boxes .box.open{
position: absolute;
width: calc(100% - 20px);
height: 520px;
z-index: 1002;
transition: all 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.3);
}
#home_boxes .item:nth-of-type(2) .box.open{
margin-left: -390px;
}
#home_boxes .item:nth-of-type(3) .box.open{
margin-left: -780px;
}
#home_boxes .item:nth-of-type(4) .box.open{
margin-top:-270px;
}
#home_boxes .item:nth-of-type(5) .box.open{
margin-top:-270px;
margin-left: -390px;
}
#home_boxes .item:nth-of-type(6) .box.open{
margin-top:-270px;
margin-left: -780px;
}
#home_boxes .box .okladki{
opacity: 0;
width:100%; height: 100%;
position: absolute;
transform:rotateY(0deg);
transition:transform .3s ease-in-out;
transform-style:preserve-3d;
cursor: pointer;
}
#home_boxes .box.open .content{
display: block;
overflow: auto;
}
#home_boxes .box:not(.open) .okladki{
opacity: 1;
}
#home_boxes .box .okladki > div {
width: 100%; height: 100%;
position: absolute; top: 0; left: 0; right: 0; bottom: 0;
}
#home_boxes .box .front {
transform:translateZ(40px);
}
#home_boxes .box .back {
background: #3B5998; font-size: 3em;
transform:rotateY(-100deg) translateZ(40px);
}
#home_boxes .box .okladki:hover {
transform: rotateY(100deg);
}
Any suggestions? Thanks for comments ;)
updated some of css worked fine for me
#home_boxes .box .okladki:hover {
transform: rotateY(180deg);
}
#home_boxes .box .front {
transform: rotateY(0deg) translateZ(40px);
}
#home_boxes .box .back {
background: #3B5998;
font-size: 3em;
transform: rotateY(-180deg) translateZ(40px);
}
you can refer http://davidwalsh.name/css-flip for more details
Updated the value of translateZ(180px) in the below class, add the below code and try.
#home_boxes .box .back {
background: #3B5998; font-size: 3em;
transform:rotateY(-100deg) translateZ(180px);
}

sprite for hover effect sliding from image to image

I have a social icons in sprite image, and hover effect is sliding when hovering.
I don't want it to, I want it to act just like if i use a regular image, when hover an image the image is changed, also I want to add CSS3 transitions to it.
This is the site: [Site][1]
/*Social Icons*/
#social_icons {
width: 18%;
height: 37px;
display: inline;
position: absolute;
bottom: 0;
left: 185px;
}
.social-roll {
height: 40px;
width: 42px;
margin: -3px;
display: inline-block;
-webkit-transition: all 0.9s ease-in-out;
-moz-transition: all 0.9s ease-in-out;
-o-transition: all 0.9s ease-in-out;
transition: all 0.9s ease-in-out; }
.ico-facebook, .ico-facebook-hover, .ico-googlep, .ico-googlep-hover, .ico-linkedin,
.ico-linkedin-hover, .ico-message, .ico-p, .ico-p-hover, .ico-twitter,
.ico-twitter-hover{
display: inline-block;
background: url('../images/icons/social.png') no-repeat;
overflow: hidden; }
.ico-facebook {
background-position: -3px -0px;
width: 40px;
height: 40px;
}
.ico-facebook:hover {
background-position: -46px -0px;
width: 40px;
height: 40px;
}
.ico-googlep {
background-position: -89px -0px;
width: 40px;
height: 40px;
}
.ico-googlep:hover {
background-position: -3px -43px;
width: 40px;
height: 40px;
}
.ico-linkedin {
background-position: -46px -43px;
width: 40px;
height: 40px;
}
.ico-linkedin:hover {
background-position: -89px -43px;
width: 40px;
height: 40px;
}
.ico-message {
background-position: -3px -86px;
width: 40px;
height: 40px;
}
.ico-p {
background-position: -46px -86px;
width: 40px;
height: 40px;
}
.ico-p:hover {
background-position: -89px -86px;
width: 40px;
height: 40px;
}
.ico-twitter {
background-position: -3px -129px;
width: 40px;
height: 40px;
}
.ico-twitter:hover {
background-position: -46px -129px;
width: 40px;
height: 40px;
}
[1]:
Just remove the transition effect:
.social-roll {
height: 40px;
width: 42px;
margin: -3px;
display: inline-block;
/* transition: all 0.9s ease-in-out 0s; */
}
Note: You need to specify what kind of transition you want
You have a rule set defined as below
.social-roll {
display: inline-block;
height: 40px;
margin: -3px;
transition: all 0.9s ease-in-out 0s;
width: 42px;
}
either you remove the transition property from the above rule or add a new property in the below rule set
.ico-facebook, .ico-facebook-hover, .ico-googlep, .ico-googlep-hover, .ico-linkedin, .ico-linkedin-hover, .ico-message, .ico-p, .ico-p-hover, .ico-twitter, .ico-twitter-hover {
transition: none;
}

Resources