Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS content with delay

Tags:

html

css

I'm using CSS content property to add content before an html tag.

span::before {
    content: 'content that needs a delay';
}
<span></span>

Is there a way to delay the visibility of the content (with CSS)?

like image 983
Sampath Liyanage Avatar asked Sep 07 '16 04:09

Sampath Liyanage


Video Answer


2 Answers

span::before {
    content: 'content that needs a delay';
     margin-top: 25px;
    font-size: 21px;
    text-align: center;
    animation: fadein 4s;
}

@keyframes fadein {
    from {
        opacity:0;
    }
    to {
        opacity:1;
    }
}
<span></span>
like image 157
Gowtham Avatar answered Oct 12 '22 06:10

Gowtham


Try css-animation

span::before {
  content: 'content that needs a delay';
  opacity: 0;
  animation: 2s fadeIn;
  animation-fill-mode: forwards;
  transition: opacity 1.5s;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
<span></span>
like image 25
Jinu Kurian Avatar answered Oct 12 '22 06:10

Jinu Kurian