Im trying to move a div up when you hover it and so far that works, but the tag inside stays in the same place and i need that it moves with the div. Do you have any suggestions how i can achieve this?
thanks for the help!
This is what i wrote so far:
css:
#probando img:hover {
top:-90px;
transition: top .30s;
}
#probando {
left:0;
right:0;
position: absolute;
z-index: 15;
top:40.5em;
}
#probando img {
max-width:280px;
position:relative;
top:-40px;
}
html
<div class="container" id="probando">
<div class="sixteen columns">
<div class="five columns" id="foto" >
<p id="galerie">Über uns</p>
<img src="../Img/ueberuns2.jpg" alt="Ueber uns" />
</div>
<div class="five columns" id="foto">
<p id="ueber">Galerie</p>
<img src="../Img/galerie.jpg" alt="Gallery" />
</div>
<div class="five columns" id="foto">
<p id="dj"> Djs</p>
<img src="../Img/dijcolor.jpg" alt="DJs" />
</div>
</div>
</div>
If i understand you correctly; your transition is only on the image tag, it has no child elements to take with it. If you move the transition to the containing div then it will move everything.
html: add a class that you can target for the transition.
<div class="container" id="probando">
<div class="sixteen columns">
<div class="five columns moveable" id="foto" >
<p id="galerie">Über uns</p>
<img src="../Img/ueberuns2.jpg" alt="Ueber uns" />
</div>
<div class="five columns moveable" id="foto">
<p id="ueber">Galerie</p>
<img src="../Img/galerie.jpg" alt="Gallery" />
</div>
<div class="five columns moveable" id="foto">
<p id="dj"> Djs</p>
<img src="../Img/dijcolor.jpg" alt="DJs" />
</div>
</div>
</div>
CSS: target the class instead:
#probando .moveable:hover {
top:-90px;
transition: top .90s;
}
#probando {
left:0;
right:0;
position: absolute;
z-index: 15;
top:10.5em;
}
#probando .moveable {
max-width:280px;
position:relative;
top:-40px;
}
https://jsfiddle.net/L12p8gj5/
You will just need to re-align your elements as needed.
Related
JSFIDDLE: http://jsfiddle.net/5nd6bexc/1/
I am trying to position a div (the contact us form) next to the contactus button, that is not the parent.
I know how to achieve that if the div is a parent(for instance the contactus is already placed in the page using that)
the best i got is this:
.managed-form {
background-color:#5B8F22;
width: 311px;
height: 369px;
z-index:99;
float: right;
margin: -75% 0% 0% 55%;
position:absolute;
display:none;
}
but it's not right because it positioning according to the parent div
HTML CODE
...........
...........
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 top-area">
<div class="managed-area row">
<div class="block-wrapper sliderblock">
<div class="block">
<div class="owl-carousel">
<div class="item slide">
<img src="/xcf.png" class="slide-image" />
<div class="slide-content">
<h2>Slide 1</h2>
<div class="managed-content">
<p>This is slide 1</p>
</div>
</div>
</div>
<div class="item slide">
<img src="cfv.png" class="slide-image" />
<div class="slide-content">
<h2>Slide 2</h2>
<div class="managed-content">
<p>This is slide 2</p>
</div>
</div>
</div>
</div> <span class="ContactForm" id="ContactForm">CONTACT US ∨ </span>
</div>
<div class="color-stripe color-stripe-2"></div>
</div>
</div>
.............
.............
.............
<div class="managed-form">
<div class="ContactForm-Heading">Contact Us</div>
<div class="ContactForm-Subheading"> <div class="managed-form">
<div class="ContactForm-Heading">Contact Us</div>
<div class="ContactForm-Subheading"></div>
<hr />
<div >
<hr />
<div >
......
</div>
Well, if the button has a fixed width and you want the space between the button and the form to be a fixed width, you just add them. The example code below would leave a 100px space between the 2 elements.
.button: {
position: absolute;
right: 0;
width: 20px;
}
.form {
position: absolute;
right: 120px;
}
On the other hand, if you want the space between the button and the form to be a percentage, you should do the following:
.button: {
position: absolute;
right: 0;
width: 20px;
}
.form {
margin-right: 20%;
position: absolute;
right: 20px;
}
I am stuck on how to arrange images for my gallery.php page so that there are 4 images per line. My first thought was to use 2 divs, one as column 1 and one as column 2, and then have two spans inside the divs labeled left and right, and float the span left float left, and the other span right. I made sure two make the widths of each of the column divs 50% and each image width 25% however it still did not work.
Here is the HTML portion of my code, and below the HTML is CSS.
<p id="service">Gallery of Completed Sabers</p>
<div class="col1">
<span class="left">
<img src="images/corran.jpg" alt="Corran Horn" />
<p>GCS:Corran Horn</p></span>
<span class="right">
<img src="images/corran.jpg" alt="Corran Horn" />
<p>GCS:Corran Horn</p></span>
</div>
<div class="col2">
<span class="left">
<img src="images/corran.jpg" alt="Corran Horn" />
<p>GCS:Corran Horn</p></span>
<span class="right">
<img src="images/corran.jpg" alt="Corran Horn" />
<p>GCS:Corran Horn</p></span>
</div>
CSS
div.col1 {
width:50%;
}
div.col2 {
width:50%;
}
span.left {
float:left;;
}
span.right {
float:right;
}
img {
width: 25%;
}
I am going to keep messing around, and see, maybe I will try 4 different columns.
Thank you
<section class="column">
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
</section>
<section class="column">
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
<div class="image-container">
<img src="https://m1.behance.net/rendition/modules/128626743/disp/bdf7c7afb76e0a0866cea43416c4b555.jpg">
</div>
</section>
*{
margin: 0px;
padding: 0px;
}
.column{
width:100%;
min-height:200px;
background:red;
border-bottom:1px solid blue;
}
.image-container{
width: 25%;
height: 200px;
float: left;
}
.image-container img{
max-height: 200px;
width: 100%;
}
I build a display that reveals information in the requested "flat tile" look my boss asked for using just CSS. So he has changed his mind and wants the text to slide out and the picture to say where it is. Here's where I'm at now.
I thought I might float the description div and make it relative to the bottom of the container div. That way when the container expands, the text would travel down. Didn't work.
CSS
/*HOW THE ROSTER LOOKS BEFORE THE HOVER*/
div.dude{ /*DUDE is the container for both the description and the photo divs*/
background-color:#82b2cd;
float:left;
margin-left:50px;
margin-bottom:20px;
width:200px;
height:200px;
overflow:hidden;
transition: all 0.3s ease-in-out;
}
div.dude>:first-child{ /*DESCRIPTION*/
font-size:14px;
opacity:0;
text-align:center;
height:200px;
color:#ffffff;
transition: opacity 1s linear;
}
div.dude>:first-child>h5{
color:#ffffff;
font-family: 'Roboto', sans-serif;
font-size:16px;
}
div.dude > div:nth-of-type(2){ /*Roster photo 200x200*/
position:relative;
top:-200px; /*cover up the description*/
float:left;
clear:none;
height:200px;
width:100%;
background-size:cover;
}
/*HOW A ROSTER ITEM LOOKS WHEN THE MOUSE HOVERS or FOCUS:*/
div.dude:hover, div.dude:focus{
height:400px;
box-shadow: 2px 2px 1px #888888;
}
div.dude:hover > :first-child, div.dude:focus > :first-child {
opacity: 1;
transition: opacity 1s linear;
}
div.dude:hover > div:nth-of-type(2), div.dude:focus > div:nth-of-type(2){
animation:duder 1s;
-moz-animation:duder 1s; /* Firefox */
-webkit-animation:duder 1s; /* Safari and Chrome */
top:0px;
}
#keyframes duder
{
0% {top:-150px;}
25% {top:-0px;}
50% {top:-0px;}
75% {top:-0px;}
100% {top:0px;}
}
#-moz-keyframes duder /* Firefox */
{
0% {top:-150px;}
25% {top:-0px;}
50% {top:-0px;}
75% {top:-0px;}
100% {top:0px;}
}
#-webkit-keyframes duder /* Safari and Chrome */
{
0% {top:-150px;}
25% {top:-0px;}
50% {top:-0px;}
75% {top:-0px;}
100% {top:0px;}
}
HTML
<div class="bs-docs-grid">
<div class="row">
<div class="dude span4">
<div><h5>Scott Sheridan</h5></br><i>English as a Second Language</i></br>Marianapolis Preparatory School</br>Thompson, CT</div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/ssheridan.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Mike Fauteux</h5></br><i>Academic Numeracy and Geometry</br>Master Teacher</i></br></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/08/fauteux-300x300.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Rose Zapata</h5></br><i>Algebra 1 and Geometry</br>Master Teacher</i></div>
<div style="background-image:url('http://leadps.org/images/content/633/Zapata.jpg');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Rudy Sharar</h5></br><i>High School Science</i></div>
<div style="background-image:url('http://www.leadps.org/images/content/1263/Rudy%20Sharar.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Joe Williams</h5></br><i>School Administration</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/11/joe_williams.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Martha James</h5></br><i>High School</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/12/martha_james.jpg');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Mitchell Mosbey</h5></br><i>First Grade</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/11/mmosbey.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Robert Rigonan</h5></br><i>Middle School Science</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/11/397136_4343580901101_1361576410_n-650x650.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Manny Herrera</h5></br><i>Fourth Grade</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/mannyhanging.jpg');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Sophia Thomas</h5></br><i>High School Mathematics</i></div>
<div style="background-image:url('http://www.leadps.org/images/content/1263/Sophia%20Thomas.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Mary Ellen Davies</h5></br><i>Middle School German</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/Schoenes-Wochenende-Ticket.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Dan Alderson</h5></br><i>10th Grade English</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/dalderson-650x650.png');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Heather Meiring</h5></br><i>High School Science</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/11/heather_meiring.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Ruthe Hall</h5></br><i>Middle School</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/12/ruthe_hall.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Evan Wolkenstein</h5></br><i>Jewish Literature, Psychology, Human Relations</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/12/evan_wolk.png');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Sarah Gerhardt</h5></br><i>Second Grade</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/Sarah_g-650x644.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Becca Abeles</h5></br><i>10th & 11th Grade English</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/b_abeles.jpg');"></div>
</div>
<div class="dude span4">
<div><h5>Tess O'Brien</h5></br><i>Fourth Grade</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/10/P1010156_2.jpg');"></div>
</div>
</div>
<div class="row">
<div class="dude span4">
<div><h5>Jean Gephart</h5></br><i>High School Science</i></div>
<div style="background-image:url('http://exitticket.org/wp-content/uploads/2013/11/JeanGephart.jpg');"></div>
</div>
</div>
</div>
<!-- ROSTER ENDS -->
In order to make the description text slide over the picture (without pushing the picture down), you can put the description in an absolutely positioned div, position it with top:-200px above the parent element, and the set top:0 when the parent is hovered or focused. I provide a working example here: http://jsfiddle.net/YXuk9/113/.
While you're at it, there are several changes you can make to your code that will make doing what you want easier. First, it's better to structure your HTML using IDs and classes if you can, rather than referring to them using nth-child selectors. It will be easier to read and maintain.
<div class="profile">
<img class="photo" src="http://exitticket.org/wp-content/uploads/2013/10/ssheridan.jpg" alt="Scott Sheridan" />
<div class="description">
<h5>Scott Sheridan</h5>
<span class="subject">English as a Second Language</span>
<span class="school">Marianapolis Preparatory School</span>
<span class="location">Thompson, CT</span>
</div>
</div>
Notice how this way of structuring the HTML makes it clear what kind information each tag holds. This way, when you refer to a given tag in your CSS, it's clear what you're talking about, so you don't need a comment saying that the first child of the div is the description!
Then your CSS can be much simpler:
.profile {
position:relative;
width:200px;
height:200px;
display:block;
overflow:hidden;
float:left;
margin-left:50px;
margin-bottom:20px;
}
.photo {
width:100%;
}
.description {
background-color:#82b2cd;
position:absolute;
top:-200px;
left:0;
color:white;
padding:10%;
height:100%;
transition: all 0.3s ease-in-out;
}
.description span {
display:block;
}
.profile:hover .description, .profile:focus .description {
top:0;
}
Note that now it's clear what element each CSS rule refers to. To make it clear I've removed some of the styles that aren't relevant to the problem you're having.
I have multiple divs with the same class of "product". When I hover on each product element, I need them to have a hover effect, but the problem is that when I hover over the first element, all other elements also have the effect applied rather than just the one i hovered. What am i doing wrong?
<style>
div.product{
width:90%;
margin:10px auto;
height: 200px;
transition: all 0.1s ease;
background-color: #069;
}
div.product:hover{
margin-top:-5px;
}
.img_box{
width:50%;
height:100%;
padding: 10px;
float:left;
box-sizing: border-box;
}
.desc_box{
width:50%;
height:100%;
float:left;
padding: 10px;
box-sizing: border-box;
}
.img{
background-color: #b65050;
height: 100%;
}
.desc{
background-color: chocolate;
height: 100%;
}
</style>
HTML:
<div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
</div>
heres my fiddle: MY FIDDLE
This is because you are floating the divs. Changing margin-top moves the element which creates room underneath it.
What you need is this:
div.product{
position:relative;
}
div.product:hover{
top:-5px;
}
position:relative basically takes up the original space but lets the div to be rendered elsewhere.
I am trying to make the Images in "fullwidthbanner" as fully responsive. May be the problem is that it has two images which I want it to transform with size.
This is my HTML
<div class="main-container col1-layout">
<div class="main row-second clearfix">
<div class="col-main">
<div class="std"><div class="sub-container"><div class="fullwidthbanner-container">
<div class="fullwidthbanner>
<div class="item"><img src="http://127.0.0.1/www/media/wysiwyg/sub-head1.jpg" alt="Random Collection"></div>
<div class="item"><img src="http://127.0.0.1/www/media/wysiwyg/sub-head1.jpg" alt="Random Collection"></div>
</div>
</div>
</div>
</div>
</div>
CSS
.sub-container {overflow:auto;}
.main-container {background:#fafafa; }
.main { margin:0 auto; position: relative; z-index:1; }
.sub-container div.item{ background-color:red; float:left;}
.sub-container div.item:hover{ background-color:green;}
.sub-container div.item img{ width:100% !important; display:block;}
For some reason, it does everything I want it to, but both the Images are fully extending in terms of width. The width always remain the same and when the window size increases, it just shows an empty space in front of both images.
Assuming this is the html:
<div class="main-container col1-layout">
<div class="main row-second clearfix">
<div class="col-main">
<div class="std">
<div class="sub-container">
<div class="fullwidthbanner-container">
<div class="fullwidthbanner">
<div class="item">
<img src="http://127.0.0.1/www/media/wysiwyg/sub-head1.jpg" alt="Eid Collection" />
</div>
<div class="item">
<img src="http://127.0.0.1/www/media/wysiwyg/sub-head1.jpg" alt="Eid Collection" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Does this css do what you want?
.sub-container div.item {
background-color: red;
float: left;
width: 100%;
}
Although I would suggest using max-width, instead of width -- this will make it adapt to smaller screens, and on larger screens it won't get blurry.