Color overlay on image hover css - css

I'm trying to overlay a white circle on top of an image once it is hovered over, however this is trickier than I thought using just CSS. The solution doesn't need to be a strictly CSS one, it's just that I wouldn't like to use images.
HTML/ERB
<div class="item-container">
<div class="rollover-item">
<%= link_to image_tag(#featured_product_first.product.images.order(:placement).first.image.url(:medium)), #featured_product_first.product %>
</div>
<%= link_to #featured_product_first.product.name, #featured_product_first.product %>
<% end %>
</div>
CSS
.item-container {
width: 100%;
height: 100%;
}
.rollover-item {
position: relative;
z-index: 1;
}
.rollover-info img:hover:after {
content: ' ';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,.5);
border-radius: 50%;
z-index: 10;
}

Assuming this structure
JSFiddle Demo
HTML
<div class="item-container">
<div class="rollover-item">
<img class="product-img" src="http://lorempixel.com/output/technics-q-c-200-200-7.jpg" alt=""/>
<a class="description" href="#">Product Description</a>
</div>
</div>
Then this general CSS should work. Using overflow hidden, absolute positioning and transitioning.
.item.container {
display:inline-block;
}
.rollover-item {
position:relative;
overflow:hidden;
width:200px;
}
.description{
position:absolute;
top:100%;
left:0;
display:block;
width:200px; /* as image */
height:200px; /* as image */
line-height:200px; /* as image */
text-align:center;
text-decoration:none;
color:black;
font-weight:bold;
background:rgba(255,255,255,0.5);
border-radius:50%;
transition:top 0.5s ease;
}
.rollover-item:hover .description {
top:0;
}

look at this example:
html:
<div class="item_cont">
<img src="img_src.jpg" />
<div class="circ"></div>
</div>
css:
.item_cont{width:100px;height:100px;}
.item_cont img{width:100px;height:100px;}
.item_cont .circ{display:none;background:#fff;width:80px;height:80px;border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%;}
.item_cont:hover .circ{display:block;}
no js needed.
hope that helps.

use this code:
jsFiddle is here
HTML:
<div class="item-container">
<div class="rollover-item">
</div>
</div>
CSS:
.item-container{
position:relative;
width:200px;
height:200px;
background:tomato; /* I love this color */
}
.rollover-item{
position:aboslute;
width:0%;
height:0%;
margin:0 auto;
background:#fff;
border-radius:50%;
opacity:0;
transition:all 0.5s ease;
}
.item-container:hover .rollover-item{
width:100%;
height:100%;
opacity:1;
}

Related

Change hover background of round image css with text in it

Cant do it right way.
Editing html is not allowed
<div class="photo_box ">
<h4>LEARN MORE</h4>
<div class="image_frame">
<div class="image_wrapper"><img class="scale-with-grid" src="#" alt="" width="" height=""></div>
</div>
<div class="desc">
<h4>Lipoparticles</h4>
Lipoparticles are virus-like particles that concentrate membrane proteins in their
native-conformation. </div>
should be like this :
I think this will help you.
#image{
width: 100px;
height: 100px;
border-radius:50%;
background-color: red;
position:relative;
}
#image>span{
position: absolute;
color:yellow;
top:50%;
left:50%;
transform:translate(-50%,-50%);
}
#image:hover{
/*image will be selected when hover*/
/*apply changes you want*/
filter:grayscale(40%);
}
#image:hover>span{
/*span will be selected when image is hover*/
color: blue;
}
/*For advance use: pseudo element*/
/*#image:hover::after{
content:'';
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
background-color: rgba(0,0,0,20%);
}*/
<div id="image">
<span>Text</span>
</div>
Learn about Beginner Concepts:Selectors and different selectors

Send google maps div on the back

I have this situation
The popup comes out when trying to login. I would like it comes ON the google maps div
So, this is the style of my popup
.popup-inner {
max-width:500px;
width:90%;
padding:40px;
position:absolute;
top:50%;
left:50%;
-webkit-transform:translate(-50%, -50%);
transform:translate(-50%, -50%);
box-shadow:0px 2px 6px rgba(0,0,0,1);
border-radius:3px;
background:#fff;
z-index:9999999;
While the back becomes
.popup {
width:100%;
height:100%;
display:none;
position:fixed;
top:0px;
left:0px;
background:rgba(0,0,0,0.75);
}
and this is the popup
<div class="popup" data-popup="popup-1">
<div class="popup-inner">
<form action="#" th:action="#{/}" method="post" class="form-signin">
<div class="form-group">
//content of the form...
</div>
</form>
<p>
<a data-popup-close="popup-1" href="#">Close</a>
</p>
<a class="popup-close" data-popup-close="popup-1" href="#">x</a>
</div>
</div>
The map has is in a simple, while the pop
<div id="map"></div>
with this style
#map {
width:100%;
height: 600px;
z-index: 1;
}
just add z-index:2; to .popup
.popup {
z-index:2;
}
Did some changes in your code, look at my snippet there are also some comments which you should read.
Hopefully this would do the job for you!
.popup {
/*display:none; //change it back to its original*/
display:block;
width:100%;
height:100%;
top:0px; /* 0px is 0 by default cause there does not exist 0 pixels. So only 0 is ok */
left:0;
background:rgba(0,0,0,0.75);
}
.popup-inner {
position:fixed; /* changed position: absolute to fixed */
width:90%;
max-width:500px;
top:50%;
left:50%;
padding:40px;
-webkit-transform:translate(-50%, -50%);
transform:translate(-50%, -50%);
box-shadow:0px 2px 6px rgba(0,0,0,1);
border-radius:3px;
background:red;
z-index: 10;
}
#map {
width:100%;
height: 600px;
z-index: 1;
background-color: pink; /* used to check the positions, make sure to remove the line */
}
<div class="popup" data-popup="popup-1">
<div class="popup-inner">
<form action="#" th:action="#{/}" method="post" class="form-signin">
<div class="form-group">
//content of the form...
</div>
</form>
<p>
<a data-popup-close="popup-1" href="#">Close</a>
</p>
<a class="popup-close" data-popup-close="popup-1" href="#">x</a>
</div>
</div>
<div id="map"></div>

CSS placing multiple text above multiple images

I am having trouble placing a multiple text in front of multiple images. The way I can achieve this is using absolute and relative positioning, with only 1 text above 1 image. But when used in multiple id's it is not working. Please show me a way. Thank you
#box1{
float:left;
position: relative;
z-index: 10;
width: 100px;
}
#boxtext1{
float:left;
width:100px;
position: absolute;
z-index: 51;
}
#box2{
float:left;
position: relative;
z-index: 11;
width: 100px;
}
#boxtext2{
float:left;
width:100px;
position: relative;
z-index: 50;
}
http://jsfiddle.net/k9b0vgeg/3/
If there's not some other reason to be using IDs (i.e. javascript), using classes would simplify this a lot.
.box {
float:left;
position:relative;
width:100px;
}
.box-text {
position:absolute;
top:0;
left:0;
}
<div class="box">
<img src="image.jpg" width="100"/>
<div class="box-text">Some Text 1</div>
</div>
<div class="box">
<img src="image.jpg" width="100"/>
<div class="box-text">Some Text 2</div>
</div>
Place the text div inside the main box div instead of placing it outside. There is no need to use float with the absolute positioned div. To adjust the left,right offset, add left and right css rules too.
HTML:
<div id="box1">
<img src="image.jpg" width="100px" />
<div id="boxtext1">Some text1</div>
</div>
<div id="box2">
<img src="image.jpg" width="100px" />
<div id="boxtext2">Some text2</div>
</div>
CSS:
#box1 {
float:left;
position: relative;
z-index: 10;
width: 100px;
}
#boxtext1 {
width:100px;
position: absolute;
z-index: 51;
bottom:10px;
}
#box2 {
float:left;
position: relative;
z-index: 11;
width: 100px;
}
#boxtext2 {
width:100px;
position: absolute;
z-index: 50;
bottom:10px; //for placement.
}
Demo: http://jsfiddle.net/lotusgodkk/k9b0vgeg/6/
You did not put your HTML code in the question, assuming your HTML is what is shown in your JSFIDDLE:
put your #boxtext1/2/3 etc inside your #box1/2/3 etc. respectively and style the box text accordingly.
DEMO : JSFIDDLE
HTML:
<div id="box1">
<img src="image.jpg" width="100px"/>
<div id="boxtext1">
Some text1
</div>
</div>
<div id="box2">
<img src="image.jpg" width="100px"/>
<div id="boxtext2">
Some text2
</div>
</div>
CSS:
#box1{
float:left;
position: relative;
z-index: 10;
width: 100px;
}
#boxtext1{
float:left;
width:100px;
position: absolute;
margin-top:-100px;
margin-left:5px;
}
#box2{
float:left;
position: relative;
z-index: 10;
width: 100px;
}
#boxtext2{
float:left;
width:100px;
position: absolute;
margin-top:-100px;
margin-left:5px;
}

Positioning problems with internet explorer (basic CSS)

I'm attempting to create a website like this http://www.spookycraft.net/ and whenever I run my site in IE it looks terrible everything is pushed to the left and all of the images are separated, Tho in Chrome and firefox they look perfect (as in all centered and the transition is there) here's the fiddle
http://jsfiddle.net/EuRJE/
Here's the testing site: http://www.wandernetwork.com/
and here's the code:
also keep in mind i'm somewhat novice so if you have any pointers for me or additional tips they would be greatly appreciated.
<head>
<meta charset='UTF-8'>
<title>Wandercraft Network</title>
<style media="screen" type="text/css">
#page-wrap {
width:620px;
margin:0px auto;
}
.slide-up-boxes a {
display:block;
width:300px;
height:300px;
background: #eee;
overflow:hidden;
}
.slide-up-boxes h5 {
height:300px;
width:300px;
text-align:center;
line-height:150px;
-webkit-transition: margin-top 0.3s linear;
background-color:#white;
}
.slide-up-boxes a:hover h5 {
margin-top:-300px;
}
.slide-up-boxes div {
text-align:center;
height:300px;
width:300px;
opacity:0;
background-color:orange;
-webkit-transform: rotate(6deg);
-webkit-transition: all 0.2s linear;
}
.slide-up-boxes a:hover div {
-webkit-transform: rotate(0);
opacity:1;
}
.slide-up-boxes {
margin:5px;
width:300px;
float:left;
}
.banner {
margin:0px auto;
display:block;
padding:15px;
width:1000px;
height:300px;
}
/* Limit the width of the tray to 30px to make it stack vertically*/
#enjin-tray {
max-width: 30px;
margin: 0;
bottom: 175px;
}
#enjin-tray li#notificationpanel {
border-radius: 3px;
}
#enjin-tray ul li.tray-item {
border-style: solid;
border-width: 1px;
}
#notificationpanel .notification-icon.apps {
background-position: -84px 3px;
}
#notificationpanel .notification-icon.general {
background-position: -54px 3px;
}
#notificationpanel .notification-icon.messages {
background-position: -25px 3px;
}
#notificationpanel .notification-icon.dashboard {
display: none;
}
#enjin-tray li#notificationpanel .subpanel {
width: 380px;
bottom: 0;
}
#enjin-tray #notificationpanel .subpanel.general {
right: 40px;
}
#enjin-tray #notificationpanel .subpanel.messages {
right: 40px;
}
#enjin-tray .subpanel {
right: 40px;
}
#enjin-tray #notificationpanel .subpanel.apps .faux-icon {
display: none;
}
#enjin-tray #notificationpanel .subpanel.general .faux-icon {
display: none;
}
#enjin-tray #notificationpanel .subpanel.messages .faux-icon {
display: none;
}
#messages-notification-tip {
bottom: 231px !important;
right: 35px !important;
}
#general-notification-tip {
bottom: 205px !important;
right: 35px !important;
}
#apps-notification-tip {
bottom: 180px !important;
right: 35px !important;
}
.triangle {
display: none;
}
#enjin-tray-messaging {
display: none;
}
</style>
</head>
<body>
<img src="https://dl.dropboxusercontent.com/u/85261154/WN_Banner.png" border="0px" class="banner">
<div id="page-wrap">
<section class="slide-up-boxes"> <a href="www.reddit.com">
<img src="https://dl.dropboxusercontent.com/u/85261154/PVP.png">
<div>
<h5> <img src="http://www.backbonetechnology.com/media/blog-html5-logo.png"> </h5>
</div>
</a>
</section>
<section class="slide-up-boxes"> <a href="www.reddit.com">
<img src="https://dl.dropboxusercontent.com/u/85261154/Kingdoms.png">
<div>
<h5> <img src="http://www.backbonetechnology.com/media/blog-html5-logo.png"> </h5>
</div>
</a>
</section>
<section class="slide-up-boxes"> <a href="www.reddit.com">
<img src="https://dl.dropboxusercontent.com/u/85261154/Survival.png">
<div>
<h5> <img src="http://www.backbonetechnology.com/media/blog-html5-logo.png"> </h5>
</div>
</a>
</section>
<section class="slide-up-boxes"> <a href="www.reddit.com">
<img src="https://dl.dropboxusercontent.com/u/85261154/Factions.png">
<div>
<h5> <img src="http://www.backbonetechnology.com/media/blog-html5-logo.png"> </h5>
</div>
</a>
</section>
<div style="clear:both;"></div>
</div>
</body>
Any help would be appreciated if I find the answer I'll be sure to update this post, Thank you for reading.
What version of IE are you using? Your page looks fine on IE10.
I can't help you if you are running an older version, but have a look at this :
Imitate CSS3 transition in IE?
-webkit-transition won't work on IE.

overlapping photos

Im trying to set up a way of viewing photos when you hover over them and im having some trouble with floating and positioning. I've got it to work like this...
**HTML**
<div id="container-collection">
<div id="clothes1"><img src="Images/smallest/JPEG/IMG_3148.jpg" alt="1" width="211" height="316" onMouseOver="MM_showHideLayers('closeup1','','show')" onMouseOut="MM_showHideLayers('closeup1','','hide')"></div><div id="clothes2"><img src="Images/smallest/JPEG/IMG_3124.jpg" alt="2" width="211" height="316" onMouseOver="MM_showHideLayers('closeup2','','show')" onMouseOut="MM_showHideLayers('closeup2','','hide')"></div>
<div id="closeup1"><img src="Images/Smaller/bigger ones/JPEG/IMG_3148_1.jpg" width="432" height="648" alt="11"></div> <div id="closeup2"><img src="Images/Smaller/bigger ones/JPEG/IMG_3124_1.jpg" width="432" height="648" alt="11"></div>
</div>
**CSS**
#container-collection { width: 900px; margin:0 auto; padding-top: 90px; }
#clothes1 { float:left; left:0px; top:5px; width:209px; height:316px; z-index:1; }
#clothes2 { float:left; left:5px; top:5px; width:209px; height:316px; z-index:1; }
#closeup1 { float:left; left:400px; top:-316px; width:427px; height:648px; z-index:2; visibility: hidden; }
#closeup2 { position:relative; left:423px; top:-648px; width:427px; height:648px; z-index:3; visibility: hidden; }
but theres got to be a better way.
Cheers.
There are many JavaScript plugins you can use to quickly achieve this.
For example, try the bootstrap plugin:
http://twitter.github.com/bootstrap/javascript.html#popovers
NB: the data-content attribute in the <a> tag could hold HTML content. Just look out for the use of quotes.
<a href="#" rel="popover" data-content="<img src='image2.jpg' />" data-original-title="A Title">
<img src="image1.jpg" border="0" />
</a>
Optionally, a much simpler version to show a preview can be done with CSS only, utilizing hover.
<style>
a.info
{
position: relative; /*this is the key*/
z-index: 204;
color: #000;
text-decoration: none;
}
a.info:hover
{
z-index: 205;
background-color: gainsboro;
}
a.info span{display: none}
a.info:hover span
{
/*the span will display just on :hover state*/
display: block;
position: absolute;
top: 3em;
left: 1em;
}
</style>
<a class="info" href="javascript:focus();">
<img src="image1.jpg" /><span><img src="image2.jpg" /></span>
</a>

Resources