Al Amin
Al Amin

Reputation: 54

<!DOCTYPE html> block animation css

I am trying to make css3 spinner (loader). It works fine without . But when I use , the css code is not loading.

See demo- without doctype --> http://echakri.net/css-animation/witouthdoctype.html (work fine)

with doctype--> http://echakri.net/css-animation/withdotype.html (not work)

My code:

Html:

<div id="loaderw" class="loaderw">
            <div class="loader1"></div>
            <div class="loader2"></div>
            <div class="loader3"></div>
            <div class="loader4"></div>
            <div class="loader5"></div>
        </div>

Css:

.Loaderw {
  width: 50px;
  height: 40px;
  text-align: center;
  font-size: 10px;
  float: right;
}

.Loaderw > div {
  background-color: green;
  height: 100%;
  width: 6px;
  display: inline-block;
  -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
  animation: sk-stretchdelay 1.2s infinite ease-in-out;
}

.Loaderw .loader2 {
  -webkit-animation-delay: -1.1s;
  animation-delay: -1.1s;
}

.Loaderw .loader3 {
  -webkit-animation-delay: -1.0s;
  animation-delay: -1.0s;
}

.Loaderw .loader4 {
  -webkit-animation-delay: -0.9s;
  animation-delay: -0.9s;
}

.Loaderw .loader5 {
  -webkit-animation-delay: -0.8s;
  animation-delay: -0.8s;
}

@-webkit-keyframes sk-stretchdelay {
  0%, 40%, 100% { -webkit-transform: scaleY(0.4) }  
  20% { -webkit-transform: scaleY(1.0) }
}

@keyframes sk-stretchdelay {
  0%, 40%, 100% { 
    transform: scaleY(0.4);
    -webkit-transform: scaleY(0.4);
  }  20% { 
    transform: scaleY(1.0);
    -webkit-transform: scaleY(1.0);
  }
}
<div id="loaderw" class="loaderw">
				<div class="loader1"></div>
				<div class="loader2"></div>
				<div class="loader3"></div>
				<div class="loader4"></div>
				<div class="loader5"></div>
			</div>

How I solve this problem?

Thanks in advance.

Upvotes: 0

Views: 351

Answers (1)

Michael Coker
Michael Coker

Reputation: 53709

The HTML and CSS between the sites is different. In the page with the doctype, change the #loaderw class from lower-case to upper-case to match your CSS.

<div id="loaderw" class="loaderw">

to

<div id="loaderw" class="Loaderw">

Alternatively, you can change all of the .Loaderw classes in your CSS to .loaderw - whatever's easier. But CSS is case-sensitive, so those need to match somehow.

Upvotes: 1

Related Questions