I have a Slider with a few images. Inside this slider, i have a div called "sb-bolas", and inside this div, i created new div's where i have a circle, and inside this circle i want to insert some text.
But i need to create more then 1 circle and i want to every circle have the same space between them.
How can i do this?
HTML
<div class="sb-bolas">
<div class="bolas-grad">something</div>
<div class="bolas-grad">something</div>
<div class="bolas-grad">something</div>
</div>
CSS
.sb-bolas {
padding: 10px;
bottom: 50px;
left: 100px;
right: 100px;
z-index: 1000;
position: absolute;
background: #CBBFAE;
background: rgba(190,176,155, 0.4);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
color: #fff;
-webkit-transition: all 200ms;
-moz-transition: all 200ms;
-o-transition: all 200ms;
-ms-transition: all 200ms;
transition: all 200ms;
}
.bolas-grad {
width: 100px;
height: 100px;
border-radius: 50px;
opacity: 0.7;
filter: alpha(opacity=40);
background: linear-gradient(to bottom, #007EFF, #09f);
font-size: 12px;
color: #fff;
line-height: 100px;
text-align: center;
}
*UPDATE**
Image
Use float:left; and margin
Keep in mind, using float will remove any absolute positioning you may have established with its parent element. To further help clarify what exactly you need to do, we don't have enough context with the rest of your HTML. Please provide more detailed code if you want a more detailed answer.
View Here: http://jsfiddle.net/SinisterSystems/qwA32/2/
HTML:
<div class="slideshow">
<div class="slide" style="background:#C00;">
</div>
<div class="slide" style="background:#0C0;">
</div>
<div class="slide" style="background:#00C;">
</div>
</div>
CSS:
.slideshow {
position:absolute;
top:0;
left:0;
}
div.slide {
float:left; // <------- Here
margin-right:50px; // <------- Here
width: 100px;
height: 100px;
border-radius:50px;
opacity:0.7;
filter:alpha(opacity=40);
background:linear-gradient(to bottom, #007EFF, #09f);
font-size:12px;
color:#fff;
line-height:100px;
text-align:center;
}
View Here: http://jsfiddle.net/SinisterSystems/qwA32/2/
Add property
display:inline-block;
to the class .bolas-grad to have the circles in the same row.
To have even spaces add margin to the class .bolas-grad
Related
I'm trying to animate the border of a circle when I hover over it so that it fills up gradually. So far no luck on my #keyframes animation code. I'm not exactly sure what I'm doing wrong here as my keyframes is targeting the value of my .circle:hover property.
.circle {
position: relative;
overflow: hidden;
width: 120px;
height: 120px;
border-radius: 50%;
background: #5d0b3c;
}
#skills .text {
position: absolute;
top: 38px;
left: 30px;
width: 60px;
color: #fff;
text-align: center;
text-transform: uppercase;
font: 18px sans-serif;
transition: opacity .2s ease;
}
.circle:hover {
animation: border;
}
#keyframes border {
0% {
border: none;
}
25% {
border: 5px solid pink;
}
50% {
}
75% {
}
100% {
}
}
<div class="container">
<div class="row">
<div class="col-3">
<div class="card">
<div class="card-body" style="border: 1px solid">
<div class="circle">
<span class="text">skill 1</span>
</div>
</div>
</div>
</div>
</div>
</div>
You are passing incomplete "parameters" in CSS. When we are going to use an animation, the required parameter sequence is:
animation: [name] [duration] [interpolation function]
Interpolation function is how the animation will be executed: linearly? Will it start fast and end slowly? Or will you follow a custom rhythm?
Example:
animation: border 1s linear;
However, there are sub-parameters that you can use but are not required, such as deciding how long the animation will take to start. For more details, you can see this article.
You are using the CSS wrongly.
You only set the name of the animation, but that is not enough for it to understand what you really want to do. To do so, you need to give an interpolation function and a duration.
Beside that, I've also added -webkit-animation as that is needed for browsers like Safari and Chrome, although the latter won't support it from version 43, as far as I know.
Anyway, an example of correct CSS is this:
.circle:hover {
-webkit-animation: border 1s linear;
animation: border 1s linear;
}
Please see the full working code / demo here:
https://jsfiddle.net/9r08aoty/3/
You don't need animation / keyframes for that, a simple transition will do
.circle {
box-sizing:border-box; /* <<== so the circle doesn't grow with the border */
position: relative;
overflow: hidden;
width: 120px;
height: 120px;
border-radius: 50%;
background: #5d0b3c;
}
#skills .text {
position: absolute;
top: 38px;
left: 30px;
width: 60px;
color: #fff;
text-align: center;
text-transform: uppercase;
font: 18px sans-serif;
transition: opacity .2s ease;
}
.circle:hover {
border:5px solid pink;
transition:border .5s ease; /*<<== simple transition */
}
<div class="container">
<div class="row">
<div class="col-3">
<div class="card">
<div class="card-body" style="border: 1px solid">
<div class="circle">
<span class="text">skill 1</span>
</div>
</div>
</div>
</div>
</div>
</div>
Would I like to know how I can put in a div 100% height?
I have a div with an image and a div with content.
The image has a width 100%, and the same content but does not fill the entire image div.
I copied the code if you can help.
Thank you,
#carta div{
position: relative;
display: table;
}
#carta div .overlay{
width: 100%;
height: 100%;
background: rgba(0,0,0,.7);
position: absolute;
top:0;
text-align: center;
color:white;
cursor: pointer;
opacity: 0;
-webkit-transition:all .4s ease-out;
transition:all .4s ease-out;
}
#carta .overlay:hover{
opacity: 1;
width: 100%;
height: 100%;
}
#carta .col-1-4{
padding: 0;
margin:0;
}
#carta div img{
width: 100%;
display: table;
}
#carta .overlay p{
font-style: oblique;
font-size: 20px;
padding-top: 50px;
text-align: center;
border-top: 1px solid white;
-webkit-transition:all .4s ease-out;
transition:all .4s ease-out;
}
#carta .overlay h5{
font-size: 30px;
margin: 50px;
}
<div class="clearFix">
<div class="col-1-4">
<img src="img/carta/atun.jpg" alt="atún revuelto"/>
<div class="overlay">
<h5>Atun revuelto</h5>
<p>15€</p>
</div>
</div>
<div class="col-1-4">
<img src="img/carta/especialidaditaliana.jpg" alt="especialidad italiana"/>
<div class="overlay">
<h5>Especialidad Italiana</h5>
<p>15€</p>
</div>
</div>
</div>
Thank you very much for your responses.
I have solved by adding "display: table-cell" in the css class ".overlay"
Thus occupies the div, which occupies the image.
Many thanks
Use background in css,something like this: background: url(img/carta/especialidaditaliana.jpg);
You also can use div to set background
Like this: <div class="img">content</div> but you also need css background.
Something like this?It should work in .html document...
<style>
.img {
position: relative;
width: 200px;
height: 100%;
background: url(http://goo.gl/ytbJn8);
color: white;
}
</style>
<div class="img">This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text.</div>
<div class="box"></div>
I am unable to align image to the width of caption with maintaining the gutter width. I am using bootstrap and also the image is flowing outside the div on hover. Can anybody help me out ?
This is what i am trying to achive : https://awwapp.com/s/43b68655-83a6-4133-ab28-0ec9a4152316/
Pen : http://codepen.io/anon/pen/XbxOMq
HTML :
HOTSPOT TEXTf
<div class="col-md-4 hotspot-wrapper">
<img src="https://newevolutiondesigns.com/images/freebies/hd-widescreen-wallpaper-3.jpg" alt="..." class="img-responsive">
<div class="hotspot-text">
HOTSPOT TEXTf
</div>
</div>
</div>
<div class="col-md-4 hotspot-wrapper">
<img src="https://newevolutiondesigns.com/images/freebies/hd-widescreen-wallpaper-3.jpg" alt="..." class="img-responsive">
<div class="hotspot-text">
HOTSPOT TEXTf
</div>
</div>
</div>
CSS:
.hotspot-wrapper {
position: relative;
overflow: hidden;
margin-bottom:20px;
}
.hotspot-text {
width:100%;
height: 102px;
position: absolute;
bottom: -50px;
transition: all .2s linear;
background: rgba(0,0,0,.7);
color:#fff;
}
.hotspot-wrapper:hover .hotspot-text {
bottom: 0;
}
.hotspot-wrapper img {
-webkit-transition: all 0.7s ease;
transition: all 0.7s ease;
}
.hotspot-wrapper:hover img {
-webkit-transform:scale(1.3);
transform:scale(1.3);
}
You should make your CSS for these two classes like this, so the hotspot for the text will be aligned with the image :
.hotspot-text {
height: 102px;
position: absolute;
bottom: -50px;
right:0px;
left:0px;
transition: all .2s linear;
background: rgba(0,0,0,.7);
color:#fff;
}
.hotspot-wrapper:hover .hotspot-text {
bottom: 0;
left:0;
right:0;
}
And you should overwrite the padding on the left and on the right set there by default with bootstrap. Like that, the image will have the full width of the div.
.col-lg-4 ,.col-md-4,col-sm-4,col-xs-4{
padding-left:0px;
padding-right:0px;
}
Here's a Fiddle
I want to change the height growth path from top-down to bottom-up. Is it possible in CSS?
.button {
margin-top:200px;
margin-right:34px;
width:150px;
height:45px;
background:black;
float:right;
transition-duration:2s;
}
.buttom:hover{
height:180px;
transition-duration:2s;
}
<div class='button'> </div>
http://jsfiddle.net/yasharshahmiri/1pkemq1p/3/
All you need is to set position: absolute and bottom position like this:
.buttom{
margin-top:200px;
margin-right:34px;
width:150px;
height:45px;
background:black;
float:right;
position:absolute;
bottom: 10px;
transition: height 2s ease-in-out
}
.buttom:hover{
height:180px
}
<div class='buttom'> </div>
Use Rotate and transform-origin to be able to set position relative to the element
.buttom{
margin-top:200px; /* this shall be higher than the height on hover*/
margin-right:34px;
width:150px;
height:45px;
background:black;
transition: height 2s ease-in-out ;
transform: rotatex(180deg);
transform-origin: top;
}
.buttom:hover{
height:180px
}
<div class='buttom'> </div>
Or this way:
.buttom{
width:150px;
height:45px;
background:black;
transition: height .3s cubic-bezier(0.175, 0.885, 0.32, 1.275) ;
transform: rotatex(180deg) translate3d(0, -200px,0);/* the Y-Value shall be higher than the height on hover*/
transform-origin: top;
}
.buttom:hover{
height:180px
}
<div class='buttom'></div>
You can do a smart trick: change margin-top simultaneously with height so that it looks like height is growing from bottom to top:
.buttom:hover {
height: 180px;
margin-top: 65px;
transition-duration: 2s;
}
Final margin-top (65px) is the difference of the starting margin-top (200) and diff of the resulting (180px) and initial (45px) height: 65 = 200 - (180 - 45). In this case block will visually stay fixed while growing up.
Demo: http://jsfiddle.net/1pkemq1p/6/
#PlantTheIdea (nice name) had the answer. It's caveat (absolute positioning) is a pretty big one, depending on your layout, but here's how it works:
.bottom-wrap { position: relative; height: 180px;}
.bottom { position: absolute; bottom:0; width: 100px; height: 20px;
background: #000;
transition: height 0.2s ease-in-out;
}
.bottom:hover { height: 180px; }
<div class="bottom-wrap">
<div class="bottom">
</div>
</div>
You have to set absolute position to the <div>.
.buttom {
width: 150px;
height: 45px;
background: black;
transition-duration: 2s;
position: absolute;
right: 10%;
bottom: 10%;
}
.buttom:hover {
height: 180px;
transition-duration: 2s;
}
<div class='buttom'></div>
Consider following HTML.
I have .image and .details wrapped in .wrap. Outside the .wrap, I have another div .extra, which I want to hide initially but on hover over the image div only, i want to slide it down so that it takes whole area of the .wrap.
I am trying following code, does not work:
HTML:
<div class="box">
<div class="wrap">
<div class="image"><img src="http://farm9.staticflickr.com/8075/8310628243_d48e64dc66_m.jpg" /></div>
<div class="details">xxx</div>
</div>
<div class="extra">hidden, show on hover over .image</div>
</div>
CSS:
.box{
border: 1px solid red;
width: 240px;
}
.image{
border: 1px solid green;
position: relative;
}
.extra{
position: absolute;
top: -100%;
left: 0;
background: green;
}
.box .image:hover .extra{
top: 0;
}
Demo: http://jsfiddle.net/pv9jd/
.extra is not a child of .image.
I updated the fiddle by replacing .image with .wrap:hover.
http://jsfiddle.net/UrKCs/2/
I'm not sure if you want that, because now the .extra appears when hovering the whole .wrap div.
I updated it again to have the hover on the image only
http://jsfiddle.net/UrKCs/5/
I believe you are looking for something like this image hover using jQuery
$('.image').hover(function(){
$('.extra').css({'top' : '0'});
},function(){
$('.extra').css({'top' : '-100%'}
);
});
Sorry to butcher your code but this may be able to help you:
<div class="box">
<div class="image"></div>
</div>
This is the CSS:
.box div{
color: #fff;
width: 200px;
height: 100px;
position: relative;
box-sizing: border-box;
transition: border .7s ease;
}
.image{
background: #fff url(http://farm9.staticflickr.com/8075/8310628243_d48e64dc66_m.jpg) bottom;
border-top: solid 100px #ccc;
}
.image:hover{
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
border: solid 0px;
}
You can read more here for the sliding.
You can also play around here: http://codepen.io/joe/pen/oqxJu