I've made a sort of diagram with temperature values and a schedule for it. Now I want to align the time-tags perfectly with the middle of my gaps between the "blocks". The first one works with position:absolute and left:(%-px/2), but the second and third example are off. How does one align these boxes?
The Fiddle is HERE.
body {
background-color: #DDD;
}
a {
cursor: pointer;
}
.block {
display: block;
height: 100%;
color: #FFF;
font-size: .75em;
float: left;
position: relative;
opacity: 1;
transition: opacity, 0.4s ease; /* hover effect transition */
border-radius: 5px;
}
.block:nth-child(n+2) {
margin-left: 0.5%;
}
.block:hover {
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.19);
}
.block.cool,
.legend li:nth-of-type(1):before {
background-color: #41A6F0;
}
.block.hot,
.legend li:nth-of-type(2):before {
background-color: #E27A3F;
}
.paused.cool {
background-color: #ccc;
}
.paused.hot {
background-color: #bbb;
}
.barchart {
display: grid;
margin: 0;
grid-template-columns:
[viewport-start] minmax(0.57em, 1fr) [container-start] minmax(20em, 35em) [container-end] minmax(0.75em, 1fr) [viewport-end];
grid-auto-rows: 30px;
}
row {
padding: 5px;
grid-column: container;
grid-row: span 4;
line-height: 120px;
text-align: center;
width: 0%;
animation: expand 1.2s ease forwards;
/* see animation "expand" below */
}
timerow {
grid-column: container;
grid-row: span 1;
line-height: 14px;
text-align: center;
visibility: hidden;
animation: 1.3s blendin; /* see animation "blendin" below */
animation-fill-mode: forwards;
margin-top: -15px;
position: relative;
}
timerow a {
position: absolute;
height: 25px;
width: 44px;
font-size: 0.8em;
color: #919191;
background: #fff;
}
/*
timerow a:last-child {
float: right;
margin-right: -12px;
}
timerow a:first-child {
margin-left: -17px;
}
*/
tag {
grid-column: container;
padding-top: 8px;
font-size: 0.8em;
color: #919191;
}
/* Big-Screen Design */
#media screen and (min-width: 768px) {
.barchart {
margin-left: -4.5em;
grid-template-columns:
[viewport-start] minmax(0.5em, 1fr) [axis-start] minmax(2em, 8em) [container-start] minmax(36em, 3fr) [container-end] minmax(0.5em, 1fr) [viewport-end];
}
tag {
grid-column: axis-start/container-start;
grid-row: span 4;
line-height: 120px;
padding: 0;
text-align: center;
}
}
/* intro animation */
#keyframes expand {
from {
width: 0%;
}
to {
width: calc(100% - 12px);
}
}
#keyframes blendin {
99% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
#media screen and (min-width: 768px) {
#keyframes expand {
from {
width: 0%;
}
to {
width: calc(100% - 13px);
}
}
}
row:nth-child(4) {
animation-delay: .1s;
}
row:nth-child(6) {
animation-delay: .2s;
}
<div class="barchart">
<tag>Workday</tag>
<row>
<a style="width:28.9444444444%;" class="block cool">19deg</a>
<a style="width:63.805555555%;" class="block hot">21deg</a>
<a style="width:6.25%;" class="block hot">22deg</a>
</row>
<timerow>
<a style="left:calc(29.1944% - 22px);">07:30</a>
<a style="left:calc(93.5% - 22px);">22:30</a>
</timerow>
<tag>Weekend</tag>
<row>
<a style="width:44%;" class="block cool">16deg</a>
<a style="width:16%;" class="block paused hot">21deg</a>
<a style="width:38.5%;" class="block paused cool">18deg</a>
</row>
<timerow>
<a style="left:calc(44% - 22px);">00:00</a>
<a style="left:calc(60.75% - 22px);">00:00</a>
</timerow>
</div>
timerow a {
position: absolute;
height: 25px;
width: 44px;
font-size: 0.8em;
color: #919191;
background: #fff;
}
this one get's positioned too far right,
<a style="left:calc(93.5% - 22px);">22:30</a>
while this one works perfectly, where the ":" is centered in the gap:
<a style="left:calc(29.1944% - 22px);">07:30</a>
Even though I added the % numbers and factored in the 0.5% gap and subtracted the 22px for half the width of the box.
You also have the padding that you need to account for since position:absolute consider the padding-box to do the calculation. Add margin to timerow equal to the padding applied to row and you calculation will be correct.
You can also simplify the -22px with a translation. Also consider box-sizing:border-box; to your row element instead of decreasing the width in the animation.
body {
background-color: #DDD;
}
a {
cursor: pointer;
}
.block {
display: block;
height: 100%;
color: #FFF;
font-size: .75em;
float: left;
position: relative;
opacity: 1;
transition: opacity, 0.4s ease; /* hover effect transition */
border-radius: 5px;
}
.block:nth-child(n+2) {
margin-left: 0.5%;
}
.block:hover {
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.19);
}
.block.cool,
.legend li:nth-of-type(1):before {
background-color: #41A6F0;
}
.block.hot,
.legend li:nth-of-type(2):before {
background-color: #E27A3F;
}
.paused.cool {
background-color: #ccc;
}
.paused.hot {
background-color: #bbb;
}
.barchart {
display: grid;
margin: 0;
grid-template-columns:
[viewport-start] minmax(0.57em, 1fr) [container-start] minmax(20em, 35em) [container-end] minmax(0.75em, 1fr) [viewport-end];
grid-auto-rows: 30px;
}
row {
padding: 5px;
box-sizing:border-box;
grid-column: container;
grid-row: span 4;
line-height: 120px;
text-align: center;
width: 0%;
animation: expand 1.2s ease forwards;
/* see animation "expand" below */
}
timerow {
grid-column: container;
grid-row: span 1;
line-height: 14px;
margin:0 5px;
text-align: center;
visibility: hidden;
animation: 1.3s blendin; /* see animation "blendin" below */
animation-fill-mode: forwards;
margin-top: -15px;
position: relative;
}
timerow a {
position: absolute;
height: 25px;
width: 44px;
font-size: 0.8em;
color: #919191;
background: #fff;
transform:translateX(-50%);
}
tag {
grid-column: container;
padding-top: 8px;
font-size: 0.8em;
color: #919191;
}
/* Big-Screen Design */
#media screen and (min-width: 768px) {
.barchart {
margin-left: -4.5em;
grid-template-columns:
[viewport-start] minmax(0.5em, 1fr) [axis-start] minmax(2em, 8em) [container-start] minmax(36em, 3fr) [container-end] minmax(0.5em, 1fr) [viewport-end];
}
tag {
grid-column: axis-start/container-start;
grid-row: span 4;
line-height: 120px;
padding: 0;
text-align: center;
}
}
/* intro animation */
#keyframes expand {
from {
width: 0%;
}
to {
width: 100%;
}
}
#keyframes blendin {
99% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
row:nth-child(4) {
animation-delay: .1s;
}
row:nth-child(6) {
animation-delay: .2s;
}
<div class="barchart">
<tag>Workday</tag>
<row>
<a style="width:28.9444444444%;" class="block cool">19deg</a>
<a style="width:63.805555555%;" class="block hot">21deg</a>
<a style="width:6.25%;" class="block hot">22deg</a>
</row>
<timerow>
<a style="left:calc((28.9444444444 + 0.5/2)*1%);">07:30</a>
<a style="left:calc((28.9444444444 + 63.805555555 + 0.5 + 0.5/2)*1%);">22:30</a>
</timerow>
<tag>Weekend</tag>
<row>
<a style="width:44%;" class="block cool">16deg</a>
<a style="width:16%;" class="block paused hot">21deg</a>
<a style="width:38.5%;" class="block paused cool">18deg</a>
</row>
<timerow>
<a style="left:calc(44% + 0.5%/2);">00:00</a>
<a style="left:calc(44% + 16% + 0.5% + 0.5%/2);">00:00</a>
</timerow>
</div>
Related
The animation is viewable on my website at www.surfturkey.net
The issue is occurring on the 'projects' page.
I am having trouble locating the problem with my CSS animation. I have an image in a CSS grid cell. I want to animate it to an absolute position near the top left corner of my page. Currently, the animation shrinks and travels up and to the right in the wrong direction, then jumps outside the grid cell and travels in the desired direction (up and to the left). I can't figure out how to make it transition smoothly from the starting location to the top left corner. I also have an animation which directly precedes the problem animation, which flies in from the left using a transform function and a rotate function. I have the animations in a class. Here's my HTML and CSS. I am using Sass, but I have formatted the code here into plain CSS.
.logo-box__logo {
transform : rotateZ(-40deg);
transform-style : preserve-3d;
width : 30rem;
height : 30rem;
}
.slidein {
animation : slide-in-from-left 1.5s ease 0s 1 normal forwards;
}
.shrink {
animation : shrink-to-top 1.5s linear 2s 1 normal forwards;
}
#keyframes slide-in-from-left {
from { transform : translateX(-1000px); }
to { transform : rotateZ(-40deg); }
}
#keyframes shrink-to-top {
from {
height : 30rem;
width : 30rem;
position : relative;
}
to {
height : 10rem;
width : 10rem;
position : absolute;
top : 2%;
left : 2%;
}
}
<div class="logo-box">
<a href="index.html">
<img class="logo-box__logo shrink"
src="https://surfturkey.net/assets/img/surfturkey_right.png"
alt="A turkey on a surfboard">
</a>
</div>
I still don't understand why is there a grid in logo-box. Nevertheless, take a look at this:
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
box-sizing: content-box;
font-size: 62.5%;
}
body {
font-family: "Nunito", sans-serif;
color: #A5C9CA;
background-color: #395B64;
overflow-x: hidden;
}
.container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: -webkit-min-content 20vh 70vh 100vh;
grid-template-rows: min-content 20vh 70vh 100vh;
}
.navbar {
grid-column: 2/3;
grid-row: 1/2;
font-family: "Nunito", sans-serif;
display: flex;
justify-content: flex-end;
}
.navbar__links {
font-size: 1.8rem;
text-transform: uppercase;
margin: 3rem;
}
.navbar__item {
text-decoration: none;
color: #A5C9CA;
padding: 2rem;
transition: color 1s;
}
.navbar__item:hover {
color: #C84B31;
}
.slidein {
-webkit-animation: slide-in-from-left 1.5s ease 0s 1 normal forwards;
animation: slide-in-from-left 1.5s ease 0s 1 normal forwards;
}
.shrinkup {
-webkit-animation: shrink-to-top 1.5s linear 2s 1 normal forwards;
animation: shrink-to-top 1.5s linear 2s 1 normal forwards;
}
#-webkit-keyframes slide-in-from-left {
from {
transform: translateX(-1000px);
}
to {
transform: translateX(0) rotateZ(-32deg);
/* margin-left: 5rem; */
}
}
#keyframes slide-in-from-left {
from {
transform: translateX(-1000px);
}
to {
transform: translateX(0) rotateZ(-32deg);
/* margin-left: 5rem; */
}
}
#-webkit-keyframes shrink-to-top {
from {
transform: rotateZ(-32deg);
}
to {
width: 15rem;
height: 15rem;
position: absolute;
top: 2rem;
left: 2rem;
transform: rotateZ(-32deg);
}
}
#keyframes shrink-to-top {
from {
transform: rotateZ(-32deg);
}
to {
width: 15rem;
height: 15rem;
position: absolute;
/* top: 2rem;
left: 2rem; */
transform: rotateZ(-32deg);
}
}
.main-content {
grid-row: 4/5;
grid-column: 1/-1;
background-color: #A5C9CA;
width: 100vw;
}
.accent-font {
color: #C84B31;
}
.heading {
grid-row: 3/4;
grid-column: 2/3;
font-family: "Nunito", sans-serif;
display: flex;
flex-direction: column;
justify-self: flex-start;
margin-left: -12rem;
}
.heading__title {
font-size: 14rem;
text-align: right;
}
.heading__title a {
text-decoration: none;
}
.heading__subtitle {
font-size: 4rem;
text-align: right;
}
.logo-box {
grid-row: 1/3;
grid-column: 3/4;
}
.logo-box__logo {
width: 80rem;
height: 80rem;
position: absolute;
left: 5rem;
margin-top: 1.5%;
transform: rotateZ(-32deg);
/* border: 1px solid red; */
}/*# sourceMappingURL=main.css.map */
<body class="container">
<nav class="navbar">
<div class="navbar__links">
<a class="navbar__item" href="#">Our Story</a>
<a class="navbar__item" href="projects.html">Projects</a>
<a class="navbar__item" href="#">Contact us</a>
<a class="navbar__item" href="#">Blog</a>
</div>
</nav>
<div class="logo-box">
<a href="index.html">
<img class="logo-box__logo shrinkup" src="https://www.surfturkey.net/assets/img/surfturkey_right.png" alt="A turkey on a surfboard">
</a>
</div>
<header class="heading">
<h1 class="heading__title">Come <span class="accent-font">see</span></h1>
<h2 class="heading__subtitle">what all we're up to...</h2>
</header>
<main id="projects" class="main-content">
</main>
</body>
I am Having a lof of problems trying to create a message card for my app. Basically I want to the content of the message div to be align with the name of the person,like this app .I already Tried to change the display to flex wrap,but still not the same, And I am looking if it's possible to re-create what this person did on the image here
Right now mine is this:
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
::-webkit-scrollbar-button {
width: 0px;
height: 0px;
}
::-webkit-scrollbar-thumb {
background: #fc0303;
border: 100px none #ffffff;
border-radius: 7px;
}
::-webkit-scrollbar-thumb:hover {
background: #fc0303;
}
::-webkit-scrollbar-thumb:active {
background: #000000;
}
::-webkit-scrollbar-track {
background: #191919;
border: 100px none #ffffff;
border-radius: 100px;
}
::-webkit-scrollbar-track:hover {
background: #191919;
}
::-webkit-scrollbar-track:active {
background: #333333;
}
::-webkit-scrollbar-corner {
background: transparent;
}
#menu_icon {
width:40px;
height:40px;
border-radius:50%;
transition: transform .9s;
float:right
}
#menu_icon:hover {
cursor:pointer;
-ms-transform: scale(1.1); /* IE 9 */
-webkit-transform: scale(1.1); /* Safari 3-8 */
transform: scale(1.1);
}
.chat_box{
background-color:#191919;
overflow: scroll;
overflow-x: hidden;
border: 2px black dashed;
width:100%;
height:100%;
border-radius:3px;
padding:10px;
}
.chat_box_message_content{
display:block;
}
.msg-txt {
display: flex;
flex-flow: wrap column;
width: 80%;
}
.chat_box_message_content p{
color:white;
}
.chat_box_message_content img {
width:35px;
height:35px;
border-radius:50%;
}
body {
background: #eef0f1;
color: black;
font-family: "Roboto", sans-serif;
overflow-x: hidden;
}
<div id="chat_box" class="chat_box">
<img onclick="showMenu()" id="menu_icon" src="https://i.pinimg.com/736x/3f/e0/dc/3fe0dcb84367af59e8881edcb7747d58.jpg">
<p style="color:white;font-size:13px;font-style: oblique;margin-top:50px">Usuário Conectado ao servidor!</p>
<div class="chat_box_message_content">
<img src="https://i.pinimg.com/736x/3f/e0/dc/3fe0dcb84367af59e8881edcb7747d58.jpg">
<span style="color:#9b72da" class="chat_box_message_content_icon">o</span>
<p class="chat_box_message_content_msg">
AAAAAAAAA
</p>
</div>
<div class="chat_box_message_content">
<img src="https://i.pinimg.com/736x/3f/e0/dc/3fe0dcb84367af59e8881edcb7747d58.jpg">
<span style="color:#da729f" class="chat_box_message_content_icon">Maria</span>
<p class="chat_box_message_content_msg">
teste
</p>
</div>
</div>
Can U guys help me with it?
Add display: inline to your ".chat_box_message_content p" CSS class to be like this:
.chat_box_message_content p {
color:white;
display: inline;
}
You can try to make the card div have display: grid and then set the content's positions inside the grid. Something like that:
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
::-webkit-scrollbar-button {
width: 0px;
height: 0px;
}
::-webkit-scrollbar-thumb {
background: #fc0303;
border: 100px none #ffffff;
border-radius: 7px;
}
::-webkit-scrollbar-thumb:hover {
background: #fc0303;
}
::-webkit-scrollbar-thumb:active {
background: #000000;
}
::-webkit-scrollbar-track {
background: #191919;
border: 100px none #ffffff;
border-radius: 100px;
}
::-webkit-scrollbar-track:hover {
background: #191919;
}
::-webkit-scrollbar-track:active {
background: #333333;
}
::-webkit-scrollbar-corner {
background: transparent;
}
#menu_icon {
width: 40px;
height: 40px;
border-radius: 50%;
transition: transform .9s;
float: right
}
#menu_icon:hover {
cursor: pointer;
-ms-transform: scale(1.1);
/* IE 9 */
-webkit-transform: scale(1.1);
/* Safari 3-8 */
transform: scale(1.1);
}
.chat_box {
background-color: #191919;
overflow: scroll;
overflow-x: hidden;
border: 2px black dashed;
width: 100%;
height: 100%;
border-radius: 3px;
padding: 10px;
}
.chat_box_message_content {
display: grid;
grid-template-columns: 50px 5fr;
grid-template-rows: 20px 30px;
margin: 2em 0;
grid-column-gap: 15px;
}
.msg-txt {
display: flex;
flex-flow: wrap column;
width: 80%;
}
.chat_box_message_content span {
grid-column-start: 2;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 1;
}
.chat_box_message_content p {
color: white;
grid-column-start: 2;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
padding: 5px 0;
}
.chat_box_message_content img {
width: 100%;
max-width: 45px;
height: auto;
border-radius: 50%;
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
}
body {
background: #eef0f1;
color: black;
font-family: "Roboto", sans-serif;
overflow-x: hidden;
}
This is a very common type of animation - toggle a sidebar on/off:
document.querySelector('.toggle').addEventListener('click', e =>
document.body.classList.toggle('no-aside')
)
body {
display: grid;
grid-gap: 10px;
grid-template-columns: minmax(50px, 200px) auto;
grid-template-areas: "aside main";
margin: 0;
width: 100vw;
height: 100vh;
transition: grid-template-columns .25s;
}
body.no-aside {
grid-template-columns: 50px auto;
}
aside {
background: #111;
color: #fff;
}
main {
background: #ddd;
}
.toggle {
background: #111;
width: 40px;
height: 40px;
display: block;
position: relative;
}
.toggle i,
.toggle i::after,
.toggle i::before {
position: absolute;
width: 40px;
height: 4px;
border-radius: 4px;
transition: transform .15s;
background-color: #fff;
}
.toggle i {
top: 46%;
left: 18%;
display: block;
opacity: .5;
}
.toggle i::before {
top: -10px;
}
.toggle i::after {
bottom: -10px;
}
.toggle i::after,
.toggle i::before {
content: '';
display: block;
}
.toggle i::before {
transform: translate3d(-8px, 0, 0) rotate(-45deg) scale(0.7, 1);
}
.toggle i::after {
transform: translate3d(-8px, 0, 0) rotate(45deg) scale(0.7, 1);
}
.no-aside .toggle i::before,
.no-aside .toggle i::after {
transform: none;
}
<aside>
<a class="toggle">
<i></i>
</a>
</aside>
<main>
content
</main>
But it appears that the transitions for grid* properties are not yet implemented in browsers so it doesn't work with a grid layout.
Is there a way to achieve this with other properties, but still keep the grid layout? Everything I've tried, with width, left, margin etc. seems to leave a gap between the 2 grid items.
Grid is supposed to have 5 animatable properties:
grid-gap, grid-row-gap, grid-column-gap, grid-template-columns and grid-template-rows.
But as you said, browsers have not implemented it yet. Firefox and Edge can animate grid-gap, grid-row-gap and grid-column-gap, but not grid-template-columns or grid-template-rows. Chromium browsers can't animate any grid property at all.
A workaround for this particular case would be to set the transition as width on the aside, and have the template columns declared as min-content 1fr.
document.querySelector('.toggle').addEventListener('click', e =>
document.body.classList.toggle('no-aside')
)
body {
display: grid;
grid-gap: 10px;
grid-template-columns: min-content 1fr;
/*
alternatively, ridiculously uneven FR columns can work too, such as
grid-template-columns: 1fr 30fr;
*/
grid-template-areas: "aside main";
margin: 0;
width: 100vw;
height: 100vh;
}
body.no-aside aside{
width:50px;
}
aside {
width:200px;
background: #111;
color: #fff;
transition: width 1s;
}
main {
background: #ddd;
}
.toggle {
background: #111;
width: 40px;
height: 40px;
display: block;
position: relative;
}
.toggle i,
.toggle i::after,
.toggle i::before {
position: absolute;
width: 40px;
height: 4px;
border-radius: 4px;
transition: transform .15s;
background-color: #fff;
}
.toggle i {
top: 46%;
left: 18%;
display: block;
opacity: .5;
}
.toggle i::before {
top: -10px;
}
.toggle i::after {
bottom: -10px;
}
.toggle i::after,
.toggle i::before {
content: '';
display: block;
}
.toggle i::before {
transform: translate3d(-8px, 0, 0) rotate(-45deg) scale(0.7, 1);
}
.toggle i::after {
transform: translate3d(-8px, 0, 0) rotate(45deg) scale(0.7, 1);
}
.no-aside .toggle i::before,
.no-aside .toggle i::after {
transform: none;
}
<aside>
<a class="toggle">
<i></i>
</a>
</aside>
<main>
123123
</main>
I'm trying to create a keyframe animation in Sass with a for loop, but I'm stumbling on the writing of it. What I would like is have each single item to appear one after the other but with a minor delay. Sort of like a stacking of cards.
Here is a codepen. Here is the code:
<ul>
<li>About</li>
<li>Contact</li>
<li>Labs</li>
</ul>
html {
font-size: 62.5%;
box-zising: border-box;
}
*,
*:before,
*:after {
box-zising: inherit;
}
html, body {
width: 100vw;
height: 100vh;
background: black;
font-size: 1rem;
}
ul {
position: fixed;
display: flex;
flex-direction: column;
align-items: flex-start;
border: 1px solid white;
width: 100vw;
height: 100vh;
}
li {
list-style: none;
border: 1px solid white;
width: 100%;
text-align: center;
margin-top: 10px;
background: red;
#for $i from 1 through 4 {
&:nth-of-type(#{$i}) {
animation: slideTop;
animation-duration: 1.5s + (40ms * $i);
animation-iteration-count: 5;
animation-delay: 2.5s + (40ms * $i);
}
}
a {
display: block;
padding: 50px;
color: white;
font-size: 24px;
text-decoration: none;
letter-spacing: 0.1em;
}
}
#keyframes slideTop {
0% {
opacity: 0;
transform: scaleY(0);
}
100% {
opacity: 1;
transform: scaleY(50px);
}
}
see here > jsfiddle
you have to set a much bigger animation-delay so you can see that the lis appear one after the other
and you have to set opacity:0 together with animation-fill-more:forwards so at first the lis are hidden and then they appear and stay with opacity:1
let me know if this is what you were looking for
CODE :
( snippet not working because it doesn't have SASS; i've only put it so that the code is visible here on the site )
html {
font-size: 62.5%;
box-zising: border-box;
}
*,
*:before,
*:after {
box-zising: inherit;
}
html, body {
width: 100vw;
height: 100vh;
background: black;
font-size: 1rem;
}
ul {
position: fixed;
display: flex;
flex-direction: column;
align-items: flex-start;
border: 1px solid white;
width: 100vw;
height: 100vh;
}
li {
list-style: none;
border: 1px solid white;
width: 100%;
text-align: center;
margin-top: 10px;
background: red;
opacity:0;
#for $i from 1 through 4 {
&:nth-child(#{$i}) {
animation: slideTop;
animation-duration: 1s + ($i*400ms);
animation-iteration-count: 1;
animation-delay: 2.5s + ($i*400ms);
animation-fill-mode:forwards;
}
}
a {
display: block;
padding: 50px;
color: white;
font-size: 24px;
text-decoration: none;
letter-spacing: 0.1em;
}
}
#keyframes slideTop {
0% {
opacity: 0;
transform: scaleY(0);
}
100% {
opacity: 1;
transform: scaleY(50px);
}
}
<ul>
<li>About</li>
<li>Contact</li>
<li>Labs</li>
</ul>
I was over this problem last 2 hours and I don't figuire it out of how could I fix this.
I am using column-count and column-widthcss property to create a nice and stable mosaic in HTML5.
Here's my code <-- Note that I need to put absolute value in -webkit-column-width property, the % didn't work.
<aside class="lastarticles">
<div class="article">
<div class="thumb"><img class="transition" src="media/thumb/thumb1.jpg">
<div class="hoverarticle transition">
<a href="single.html"><div class="readmore">
<div class="midler"> <i class="fa fa-plus"></i> </div>
</div></a>
</div>
</div>
<div class="caption">
<p>“Como é que vocês se conheceram?”
"Mas nós não nos conhecemos."</p>
</div>
</div>
</aside>
.lastarticles {
-moz-column-count: 4;
-moz-column-width: 25%;
-webkit-column-count: 4;
-webkit-column-width: 285px;
column-count: 4;
column-width: 25%;
}
.article {
margin-bottom: 20px;
padding: 0px;
overflow: hidden;
}
.article .thumb {
height: 100%;
display: block;
position: relative;
width: 100%;
overflow: hidden;
}
.article .thumb img {
display: block;
}
.article .thumb:hover .hoverarticle {
background: rgba(51, 51, 51,.7);
opacity: 1;
}
.article .thumb:hover img {
transform:scale(1.2,1.2)
}
.article .thumb:hover i {
-webkit-animation: rotateInUpLeft .9s;
-moz-animation: rotateInUpLeft .9s;
-ms-animation: rotateInUpLeft .9s;
-o-animation: rotateInUpLeft .9s;
animation: rotateInUpLeft .9s;
}
.article .hoverarticle {
position: absolute;
top: 0px;
width: 100%;
height: 100%;
opacity: 0;
}
.article .hoverarticle .readmore {
display: table;
width: 100%;
height: 100%;
text-align: center;
}
.article .hoverarticle i {
color: #fff;
font-size: 20pt
}
.article .caption {
margin: 0px;
display: table-cell;
padding: 5px 10px;
background: none repeat scroll 0% 0% rgb(238, 238, 238);
}
.article .caption p {
font-family: "open_sanslight";
font-size: 11pt;
margin: 0px;
color: #333;
}
Here's the result on Firefox (the expected one)
Here's the result on Chrome (weird one)
JSFIDLE