Change child div position on parent hover [duplicate] - html

This question already has answers here:
What does + mean in CSS? [duplicate]
(4 answers)
What does the ">" (greater-than sign) CSS selector mean?
(8 answers)
What does the "~" (tilde/squiggle/twiddle) CSS selector mean?
(3 answers)
What does a space mean in a CSS selector? i.e. What is the difference between .classA.classB and .classA .classB? [duplicate]
(3 answers)
Closed 4 years ago.
On parent div hover, I want it's two child div's to move position via translate.
I've tried to form my code based on this approach, but when applying the code to practise, it doesn't work for me, wondering why?
/* HOVER DEFINED HERE */
.cta-wrapper:hover + .cta-image {
transform: translate(20px, 5px);
}
.cta-wrapper:hover ~ .cta-text {
transform: translate(-10px, -10px);
}
/************************/
.cta-wrapper {
position: relative;
padding-right: 15px;
padding-left: 15px;
width: 98.33333%;
transition: all 0.3s;
max-width: 1220px;
padding: 0 20px 80px;
margin: 0 auto;
}
.cta-wrapper a {
text-decoration: none;
text-align: left;
color: #fff;
}
.cta-image {
transition: all 0.2s;
z-index: 100;
position: relative;
}
.cta-text {
width: 295px;
text-align: left;
padding: 30px;
transform: translate(10px, -10px);
transition: all 0.2s;
background-color: #404262;
}
.card {
display: block;
border: none;
}
<div class="cta-wrapper">
<a href="#" class="card inverse-text">
<div class="cta-image"><img src="https://cdn2.hubspot.net/hubfs/548247/Tomorrow%20People/Landing%20Page/Template%20Build/GC_Jan_2017_137.png?t=1530188524021"></div>
</a>
<div class="cta-text">
<a href="#" class="card inverse-text">
<h3>Nam quis dolor id justo aliquet cursus in malesuada ante.</h3>
<p>Morbi vel efficitur orci, sit amet gravida dui. Integer dapibus ac mi a volutpat. Sed sed augue pulvinar, dignissim mauris non.</p>
</a>
<div class="fake-button">Read more <i class="arrow"></i></div>
</div>
</div>

Your selectors are incorrect for the hover. The selectors you've got aren't targeting child elements, they're targeting elements after the wrapper.
This should work:
/* HOVER DEFINED HERE */
.cta-wrapper:hover .cta-image {
transform: translate(20px, 5px);
}
.cta-wrapper:hover .cta-text {
transform: translate(-10px, -10px);
}
/************************/
.cta-wrapper {
position: relative;
padding-right: 15px;
padding-left: 15px;
width: 98.33333%;
transition: all 0.3s;
max-width: 1220px;
padding: 0 20px 80px;
margin: 0 auto;
}
.cta-wrapper a {
text-decoration: none;
text-align: left;
color: #fff;
}
.cta-image {
transition: all 0.2s;
z-index: 100;
position: relative;
}
.cta-text {
width: 295px;
text-align: left;
padding: 30px;
transform: translate(10px, -10px);
transition: all 0.2s;
background-color: #404262;
}
.card {
display: block;
border: none;
}
<div class="cta-wrapper">
<a href="#" class="card inverse-text">
<div class="cta-image"><img src="https://cdn2.hubspot.net/hubfs/548247/Tomorrow%20People/Landing%20Page/Template%20Build/GC_Jan_2017_137.png?t=1530188524021"></div>
</a>
<div class="cta-text">
<a href="#" class="card inverse-text">
<h3>Nam quis dolor id justo aliquet cursus in malesuada ante.</h3>
<p>Morbi vel efficitur orci, sit amet gravida dui. Integer dapibus ac mi a volutpat. Sed sed augue pulvinar, dignissim mauris non.</p>
</a>
<div class="fake-button">Read more <i class="arrow"></i></div>
</div>
</div>

Because of .cta-image and .cta-text being children, you're using the wrong selectors to target them.
/* HOVER DEFINED HERE */
.cta-wrapper:hover .cta-image {
transform: translate(20px, 5px);
}
.cta-wrapper:hover .cta-text {
transform: translate(-10px, -10px);
}
/************************/
.cta-wrapper {
position: relative;
padding-right: 15px;
padding-left: 15px;
width: 98.33333%;
transition: all 0.3s;
max-width: 1220px;
padding: 0 20px 80px;
margin: 0 auto;
}
.cta-wrapper a {
text-decoration: none;
text-align: left;
color: #fff;
}
.cta-image {
transition: all 0.2s;
z-index: 100;
position: relative;
}
.cta-text {
width: 295px;
text-align: left;
padding: 30px;
transform: translate(10px, -10px);
transition: all 0.2s;
background-color: #404262;
}
.card {
display: block;
border: none;
}
<div class="cta-wrapper">
<a href="#" class="card inverse-text">
<div class="cta-image"><img src="https://cdn2.hubspot.net/hubfs/548247/Tomorrow%20People/Landing%20Page/Template%20Build/GC_Jan_2017_137.png?t=1530188524021"></div>
</a>
<div class="cta-text">
<a href="#" class="card inverse-text">
<h3>Nam quis dolor id justo aliquet cursus in malesuada ante.</h3>
<p>Morbi vel efficitur orci, sit amet gravida dui. Integer dapibus ac mi a volutpat. Sed sed augue pulvinar, dignissim mauris non.</p>
</a>
<div class="fake-button">Read more <i class="arrow"></i></div>
</div>
</div>

Related

Why background-color is not working for me?

I'm creating a dating site to learn web dev and I don't know how to make background-color work, it just doesn't on specific divs. What should I change? I tried a lot of things but nothing happened.
Adding lorem ipsum so I can ask this question... just skip this
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ut felis magna. Cras lectus sapien, porttitor quis elit id, lacinia pellentesque urna. Fusce gravida felis sit amet purus mattis, sed faucibus turpis hendrerit. Integer convallis sagittis pulvinar. Curabitur tristique faucibus lorem iaculis egestas. Vivamus vitae lacus placerat, efficitur diam et, volutpat augue. Cras at purus vitae neque ultricies iaculis. Maecenas pellentesque ipsum nisi.
My code:
* {
padding: 0;
margin: 0;
color: black;
}
body {
overflow: hidden;
}
.container {
margin-left: auto;
margin-right: auto;
margin-top: 10px;
width: 95%;
height: 750px;
}
nav {
display: flex;
justify-content: space-between;
font-family: 'Pattaya', sans-serif;
font-size: 39px;
}
.logo {
cursor: pointer;
margin-top: auto;
margin-bottom: auto;
}
.menu {
margin-top: auto;
margin-bottom: auto;
}
nav ul {
list-style-type: none;
}
nav ul li {
padding: 30px;
display: inline-block;
}
nav ul li a {
text-decoration: none;
}
nav ul li a:hover {
background-color: #ede;
border-radius: 10px;
}
.circle {
z-index: -2;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #ede;
clip-path: circle(600px at right 800px);
}
.circlebig {
z-index: -2;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #ede;
clip-path: circle(940px at left);
}
.content {
display: flex;
justify-content: space-between;
font-family: 'Rubik', sans-serif;
font-size: 56px;
}
.text {
transform: translateY(25%);
}
.love {
font-size: 70px;
background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: move 400s linear infinite;
}
#keyframes move {
to {
background-position: 4500vh;
}
.freeplan {
z-index: 3;
display: block;
background-color: #666 !important;
}
.paidplan {
z-index: 3;
display: block;
background-color: #35f !important;
}
<link href="https://fonts.googleapis.com/css2?family=Pattaya&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Rubik:ital,wght#1,300&display=swap" rel="stylesheet">
<main>
<div class="container">
<nav>
<div class="logo">
<img src="img/logo.png">
</div>
<div class="menu">
<ul>
<li> &#8291 &#8291 Plans &#8291 &#8291 </li>
<li> &#8291 &#8291 About &#8291 &#8291 </li>
<li> &#8291 &#8291 Login &#8291 &#8291 </li>
</ul>
</div>
</nav>
<section class="content">
<div class="freeplan">
Freeplan
<img src="img/kiss.png">
</div>
<div class="paidplan">
Paidplan
<img src="img/kiss.png">
</div>
<img src="img/kiss.png">
</section>
<div class="circle"></div>
<div class="circlebig"></div>
</div>
</main>
You didn't close the curly brackets:
#keyframes move {
to {
background-position: 4500vh;
} // <==
}
I think you may miss the '#keyframes' curly bracket. please replace the #keyframes' as like my code.
#keyframes move {
to {
background-position: 4500vh;
}
}

CSS Tabs>Div hidden behind Container Div

I'm struggling to get my head around what is causing the "tabbed" div to be hidden from view. I can't work out whether it is the content or container div causing this issue.
If you change the ".tabs > div" position from absolute to relative then div class="tabbed" appears as I would like but it causes the content of the tabs stack on top of one another.
Is this a position/z-index or overflow issue?
Any help would be appreciated.
Here is the code:
* {
box-sizing: border-box;
}
body {
background: #fff;
color: #262626;
font: 1em 'PT Sans', sans-serif;
}
::selection {
background-color: #4EC6DE;
}
#content {
padding: 5px 0 5px 0;
position: relative;
overflow: hidden;
}
.container {
position: relative;
clear: both;
width: 100%;
min-height: 350px;
max-width: 1200px;
padding: 5px 0px 5px 0px;
overflow: hidden;
background-color: #ffffff;
}
.pCV {
font-family: 'Libre Baskerville', serif;
font-size: 16px;
line-height: 1.6;
padding: 0;
}
.cvheader {
font-family: 'Libre Baskerville', serif;
font-size: 16px;
font-weight: bold;
}
#textbox {
width: 100%;
border: 1px solid #ccc
}
/* Style buttons */
#downloadbtn {
background-color: #ffffff;
border: 2px solid #262626;
color: #262626;
padding: 12px 12px;
cursor: pointer;
font-size: 20px;
float: right;
margin-top: -50px;
}
/* Darker background on mouse-over */
#downloadbtn:hover {
background-color: #888888;
color: #ffffff;
border: 2px solid #888;
transition: all .8s ease-in-out;
}
.tabbed {
width: 1000px;
margin: 50px auto;
}
.tabbed>input {
display: none;
}
.tabbed>label {
display: block;
float: left;
padding: 12px 20px;
margin-right: 10px;
cursor: pointer;
transition: background-color .3s;
}
.tabbed>label:hover,
.tabbed>input:checked+label {
background: #4EC6DE;
}
.tabs {
clear: both;
perspective: 600px;
}
.tabs>div {
width: 1000px;
position: absolute;
border: 2px solid #4EC6DE;
padding: 10px 30px 40px;
line-height: 1.4em;
opacity: 0;
transform: rotateX(-20deg);
transform-origin: top center;
transition: opacity .3s, transform 1s;
z-index: 0;
}
#tab-nav-1:checked~.tabs>div:nth-of-type(1),
#tab-nav-2:checked~.tabs>div:nth-of-type(2) {
transform: rotateX(0);
opacity: 1;
z-index: 1;
}
#media screen and (max-width: 700px) {
.tabbed {
width: 400px
}
.tabbed>label {
display: none
}
.tabs>div {
width: 400px;
border: none;
padding: 0;
opacity: 1;
position: relative;
transform: none;
margin-bottom: 60px;
}
.tabs>div h2 {
border-bottom: 2px solid #4EC6DE;
padding-bottom: .5em;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.6/prefixfree.min.js"></script>
<div id="content">
<div class="container">
<div class="tabbed">
<input type="radio" name="tabs" id="tab-nav-1" checked>
<label for="tab-nav-1">CV 1</label>
<input type="radio" name="tabs" id="tab-nav-2">
<label for="tab-nav-2">CV 2</label>
<div class="tabs">
<div>
<div id="textbox">
<h2 class="cvheader">EDUCATION</h2>
<a href="ArtistCV.pdf" download>
<button id="downloadbtn"><i class="fa fa-download fa-fw"></i> Download</button></a>
<div style="clear: both;"></div>
</div>
<p class="pCV">Maecenas dictum, urna ut consequat condimentum, est dui commodo diam, ac pretium dui ante eu quam. </p>
</div>
<div><h2>CSS</h2><p>Maecenas dictum, urna ut consequat condimentum, est dui commodo diam, ac pretium dui ante eu quam. Curabitur posuere metus nec tellus venenatis placerat. Ut egestas neque in odio vulputate gravida. In at justo ac est laoreet eleifend vel quis arcu. Aliquam erat volutpat. Proin vitae vehicula neque. Nam tempus erat ac ante tincidunt tincidunt. Pellentesque eu nibh sapien. Nunc augue magna, lacinia eget congue eget, mattis id tortor. Fusce id vestibulum neque. Proin tincidunt tellus ut risus lobortis cursus. Duis sit amet urna vel sapien ullamcorper varius.</p></div>
</div>
</div>
</div>
</div>
I'm struggling to get my head around what is causing the "tabbed" div to be hidden from view.
You have mistake in your HTML markup. Change this:
Download</button</a>
To this:
Download</button></a>
And add this to your CSS:
.container {
min-height: 350px;
}
If you don't want to set min-height manually, then you'll need to use JS to calculate it dynamically. Hardly imagine doing this with pure CSS.

A part of CSS won't work after adding a background-image

Good afternoon,
I've been using HTML and CSS for a couple of weeks now and recently came across a problem that I have no clue about how to fix. Before I added a background-image, the contact id worked just fine and the CSS loaded properly. But after adding the image in the pages class, the CSS contact id didn't work anymore. Also in the element inspector the properties of the contact id were not there.
So I'm not sure If I missed something in between the link of HTML and CSS or that I coded it in the wrong order. The code below is after the contact id stopped working.
.pages {
background-image: url("img/background.png");
}
#contact {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1px;
background-color: #171717;
text-align: right;
}
.sidebar {
font-family: 'Yanone Kaffeesatz', sans-serif;
position: fixed;
top: 0;
bottom: 0;
left: 0;
margin: auto;
background-color: #212121;
width: 100px;
transition: all ease 0.5s;
}
ul {
position: relative;
top: 50%;
transform: translateY(-50%);
list-style: none;
padding: 0;
margin: 0;
}
li, a {
text-decoration: none;
position: relative;
display: block;
}
i.fa {
display: block;
text-align: center;
padding: 30px 10px;
font-size: 30px;
background-color: #565656;
color: #212121;
z-index:1;
}
span {
color: #fff;
font-size: 18px;
position: absolute;
top: 0;
bottom: 0;
left: -100%;
margin: auto;
display: block;
height: 100%;
padding: 0px 10px;
text-align: center;
z-index: -1;
background-color: #000000;
transition:all ease 0.5s;
line-height: 90px;
&::after {
content:"";
position: absolute;
left: 100%;
top: 0;
bottom: 0;
margin: auto;
border: 45px solid transparent;
border-left-color: #000;
height: 0;
width: 0;
}
}
&:hover {
i.fa {
background-color: #000;
}
span {
left: 100%;
}
}
<!DOCTYPE html>
<html>
<head>
<title>sidebar</title>
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
integrity="sha384-
mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz"
rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="sidebar">
<ul>
<li><a href="#"><i class="fa fa-graduation-cap"></i>
<span>Opleiding</span></a></li>
<li><a href="#"><i class="fa fa-briefcase"></i>
<span>Werkervaring</span></a></li>
<li><a href="#"><i class="fa fa-lightbulb"></i>
<span>Vaardigheden</span></a></li>
</ul>
</div>
<div class="pages">
</div>
<div class="footer">
contact
</div>
</body>
</html>
Thanks for your time and hope you guys and women can help me out. By the way English isn't my native language so I hope I explained it clearly.
Dirk van Houten
I will consider CSS grid, hope it will be much more organized
If you think grid is okay for you, it can indeed avoid the use of position and sides effects.
example:
/* grid instead position: */
body {
margin:0;
display: grid;
height: 100vh;
grid-template-columns: 100px 1fr;
grid-template-rows: 1fr 20px;
}
.sidebar {
display: flex;
align-items: center;
}
.footer {
grid-row: 2;
grid-column: 1 / span 3;
}
.pages {
overflow: auto;
}
/* end grid system */
/* position and coordonates, so transform are removed from codes */
.pages {
background-image: url("http://dummyimage.com/50x50");
}
#contact {
padding: 1px;
background-color: #171717;
text-align: right;
}
.sidebar {
font-family: "Yanone Kaffeesatz", sans-serif;
background-color: #212121;
width: 100px;
transition: all ease 0.5s;
}
ul {
list-style: none;
padding: 0;
margin: 0;
min-width: 100%;
overflow: visible;
}
.sidebar a {
position: relative;
}
li,
a {
text-decoration: none;
z-index: 1;
display: block;
}
i.fa {
display: block;
text-align: center;
padding: 30px 10px;
font-size: 30px;
background-color: #565656;
color: #212121;
z-index: 1;
}
a span {
color: #fff;
font-size: 18px;
position: absolute;
top: 0;
bottom: 0;
left: -100%;
margin: auto;
display: block;
height: 100%;
padding: 0px 10px;
text-align: center;
z-index: -1;
background-color: #000000;
transition: all ease 0.5s;
line-height: 90px;
}
a span::after {
content: "";
position: absolute;
left: 100%;
top: 0;
bottom: 0;
margin: auto;
border: 45px solid transparent;
border-left-color: #000;
height: 0;
width: 0;
overflow: hidden;
}
:hover i.fa {
background-color: #000;
}
a:hover span {
left: 100%;
}
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
integrity="sha384-
mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz"
rel="stylesheet">
<div class="sidebar">
<ul>
<li><a href="#"><i class="fa fa-graduation-cap"></i>
<span>Opleiding</span></a></li>
<li><a href="#"><i class="fa fa-briefcase"></i>
<span>Werkervaring</span></a></li>
<li><a href="#"><i class="fa fa-lightbulb"></i>
<span>Vaardigheden</span></a></li>
</ul>
</div>
<div class="pages">
<h1>HTML Ipsum Presents</h1>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.</p>
<h2>Header Level 2</h2>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ol>
<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>
<h3>Header Level 3</h3>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ul>
<pre><code>
#header h1 a {
display: block;
width: 300px;
height: 80px;
}
</code></pre>
</div>
<div class="footer">
contact
</div>

CSS Animation slider

I am trying to do an animation slider using only CSS. I have 3 pictures that I want to slide horizontally. My question is that I can add them transformation, but no animation The animation has to stop for a few seconds on each image. Anyone has ideas how to manage it? I use sass.
Code:
.slider {
position: relative;
height: 100vh;
// width: 100vw;
overflow: hidden;
display: block;
.slides {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
display: flex;
transition-timing-function: ease-out;
animation: slide 3s steps(2) infinite;
.slide {
height: 100vh;
width: 100vw;
padding: 100px;
margin: 0 auto;
float: left;
text-align: center;
img {
margin: 0 auto;
border-radius: 50%;
height: 250px;
}
h1 {
color: #323232;
font-size: 32px;
line-height: 42px;
letter-spacing: 1px;
padding-bottom: 12px;
}
h4 {
font-weight: 200;
line-height: 32px;
letter-spacing: 0.9px;
display: flex;
}
}
//end .slide
&:after {
content: "";
clear: both;
display: block;
}
}
//end .slides
#keyframes slide {
to {
transform: translateX(-300vw);
}
}
}
}
<section class="slider">
<div class="slides">
<div class="slide">
<img src="images/testimonial-img-1.jpg" alt="" />
<h1>TANYA - Architect</h1>
<h4>Lorem ipsum dolor sit amet, maecenas eget vestibulum justo imperdiet, wisi risus purus augue vulputate voluptate neque, curabitur dolor libero sodales vitae elit massa.</h4>
</div>
<div class="slide">
<img src="images/testimonial-img-2.jpg" alt="" />
<h1>LINDA - City planner</h1>
<h4>Lorem ipsum dolor sit amet, maecenas eget vestibulum justo imperdiet, wisi risus purus augue vulputate voluptate neque, curabitur dolor libero sodales vitae elit massa.</h4>
</div>
<div class="slide">
<img src="images/testimonial-img-3.jpg" alt="" />
<h1>SANDAR - Developer</h1>
<h4>Lorem ipsum dolor sit amet, maecenas eget vestibulum justo imperdiet, wisi risus purus augue vulputate voluptate neque, curabitur dolor libero sodales vitae elit massa.</h4>
</div>
</div>
</section>
Try this:-
#outerbox{
width:700px;
overflow:hidden;
}
#sliderbox{
position:relative;
width:2800px;
animation:animation 20s infinite;
}
#sliderbox img{
float:left;
}
#keyframes animation{
0%{
left:0px;
}
100%{
left:-2800px;
}
}
<div id="outerbox">
<div id="sliderbox">
<img src="http://labs.qnimate.com/slider/1.jpg"/>
<img src="http://labs.qnimate.com/slider/2.jpg"/>
<img src="http://labs.qnimate.com/slider/3.jpg"/>
Ok try this
#outerbox{
width:700px;
}
#sliderbox{
position:relative;
width:2800px;
animation:animation 20s infinite;
}
#sliderbox img{
float:left;
}
#keyframes animation{
0%{
left:0px;
}
20%{
left:0px;
}
25%{
left:-700px;
}
45%{
left:-700px;
}
50%{
left:-1400px;
}
70%{
left:-1400px;
}
}
<div id="outerbox">
<div id="sliderbox">
<img src="http://labs.qnimate.com/slider/1.jpg"/>
<img src="http://labs.qnimate.com/slider/2.jpg"/>
<img src="http://labs.qnimate.com/slider/3.jpg"/>
</div>
</div>
Your css, fixed:
.slider{
position: relative;
height: 100vh;
// width: 100vw;
overflow: hidden;
display: block;
}
.slides{
position: absolute;
top: 0;
left: 0;
overflow: hidden;
display: flex;
animation: slide 3s ease-out infinite;
}
.slide{
height: 100vh;
width: 100vw;
padding: 100px;
margin: 0 auto;
float: left;
text-align: center;
}
img{
margin: 0 auto;
border-radius: 50%;
height: 250px;
}
h1{
color: #323232;
font-size: 32px;
line-height: 42px;
letter-spacing: 1px;
padding-bottom: 12px;
}
h4{
font-weight: 200;
line-height: 32px;
letter-spacing: 0.9px;
display: flex;
}
&:after{
content: "";
clear: both;
display: block;
}
The closing } were wrong. you can't have a css rule inside another.
Also the transition timing wasn't doing anything if you are using animation, you can add it to the animation declaration. Transition and animation are two different things. Both have timing function which you can declare on a single line or separately.

Keep transition effect on 1 div from moving the div that follows?

1. I have a 4 column row of divs that move a little when hovered (with margin and padding). How can I keep this movement from moving the content that is below it without adding a fixed height. It is in a fluid layout so with a fixed height that allows enough room for the movement, the content below starts to get too far away as the window width is reduced and the images scale down.
2. For the bounty you need to make the jsFiddle work.
It seems that even though I have transition: all, all of the padding-bottom gets added instantly while the margin-top transitions for 300ms. Shouldn't the padding transition also? I think that would get rid of the jump. I tried transitioning height on hover for the same effect but it had the same exact issue. the height just got added instead of transitioning.
I made a jsFiddle to play with.
HTML:
<header class="sectionTitle lightboxes clearfix">
<h3><i class="i-small icon-folder-open"></i><strong>Portfolio</strong></h3>
</header>
<article id="row2fluid" role="presentation">
<section id="row2col1"> <a class="slider" href="#"><img src="http://mtctinc.com/images/folioImg1.jpg" alt="porfolio 1" />
<div class="caption">
<h3>Example 1</h3>
<span>Slider/Slideshow</span>
</div>
</a>
</section>
<section id="row2col2"> <a class="youtube" href="#"><img src="http://mtctinc.com/images/folioImg2.jpg" alt="portfolio 2" />
<div class="caption">
<h3>Example 2</h3>
<span>Youtube</span>
</div>
</a>
</section>
<section id="row2col3"> <a href="#" class="clearfix"><img src="http://mtctinc.com/images/folioImg3.jpg" alt="porfolio 3" />
<div class="caption">
<h3>Example 3</h3>
<span>Flash</span>
</div>
</a>
</section>
<section id="row2col4"> <a href="#" class="clearfix"><img src="http://mtctinc.com/images/folioImg4.jpg" alt="portfolio 4" />
<div class="caption">
<h3>Example 4</h3>
<span>HTML</span>
</div>
</a>
</section>
</article>
<div id="moreContent">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget nulla laoreet, blandit massa eu, mollis tellus. Duis pellentesque dui nec diam ullamcorper, ac dignissim sapien interdum. Proin in libero nec neque fermentum varius. Integer hendrerit, justo feugiat porttitor iaculis, nisl purus luctus neque, non ultrices magna quam et magna. Proin porttitor, metus sed commodo pharetra, lacus eros aliquet diam, eu auctor nisi diam quis felis.</div>
CSS:
.sectionTitle {
border-bottom: 3px solid #e9e9e9;
width:100%;
}
.sectionTitle h3 {
font-size:11px;
text-transform:uppercase;
font-weight:bold;
border-bottom: 3px solid #3b3b3b;
display:table;
margin-bottom: -2px;
float: left;
width: 100%;
min-height: 33px;
line-height: 19px;
padding-bottom: 10px;
}
.sectionTitle strong {
display: inline-block;
padding-left:10px;
line-height:14px;
}
.lightboxes {
position: relative;
clear:both;
padding-top: 30px;
}
#row2fluid {
text-align: center;
position: relative;
float: left;
width: 100%;
}
#row2fluid img {
opacity: .8;
border: none;
-webkit-transition:all 300ms;
-o-transition:all 300ms;
-moz-transition:all 300ms;
transition:all 300ms;
}
#row2fluid a:hover img {
opacity: 1;
margin-top: -16px;
}
#row2fluid a:hover .caption h3 {
color: #F15A2B;
}
#row2fluid .caption {
border-bottom: 1px solid #E9E9E9;
margin: 0px 3px;
line-height: .7em;
padding: 14px 0 30px;
}
#row2fluid a:hover .caption {
border-bottom: 1px solid #F15A2B;
background-color: #f7f7f7;
padding-bottom: 46px;
}
#row2fluid .caption span {
font-style: italic;
font-size: 12px;
color: #ACACAC;
}
#row2col1 {
clear: both;
float: left;
margin-left: 0;
width: 24.1758%;
display: inline-block;
padding-top: 40px;
margin-top: -1px;
}
#row2col2 {
clear: none;
float: left;
margin-left: 1.0989%;
width: 24.1758%;
display: inline-block;
padding-top: 40px;
margin-top: -1px;
}
#row2col3 {
clear: none;
float: left;
margin-left: 1.0989%;
width: 24.1758%;
display: inline-block;
padding-top: 40px;
margin-top: -1px;
}
#row2col4 {
clear: none;
float: left;
margin-left: 1.0989%;
width: 24.1758%;
display: inline-block;
padding-top: 40px;
margin-top: -1px;
}
#row2col1:hover {
border-top: 3px solid #F15A2B;
padding-top: 37px;
}
#row2col2:hover {
border-top: 3px solid #F15A2B;
padding-top: 37px;
}
#row2col3:hover {
border-top: 3px solid #F15A2B;
padding-top: 37px;
}
#row2col4:hover {
border-top: 3px solid #F15A2B;
padding-top: 37px;
}
#moreContent {
clear: both;
position: relative;
float: left;
margin-left: 0;
width: 100%;
display: block;
padding-top: 20px;
}
You just need to add
-webkit-transition:all 300ms;
-o-transition:all 300ms;
-moz-transition:all 300ms;
transition:all 300ms;
to the caption as well.
See here
http://jsfiddle.net/ZuU8V/4/