0

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.

Al Amin
  • 54
  • 8
  • Please add meaningful code and a problem description here. Don't just link to the site that needs fixing - otherwise, this question will lose any value to future visitors once the problem is solved or if the site you're linking to is inaccessible. Posting a [Minimal, Complete, and Verifiable example (MCVE)](http://stackoverflow.com/help/mcve) that demonstrates your problem would help you get better answers. For more info, see [Something on my web site doesn't work. Can I just paste a link to it?](http://meta.stackexchange.com/questions/125997/) Thanks! – j08691 Feb 13 '17 at 17:57
  • Please post any useful code to make the question clear. – Umair Shah Feb 13 '17 at 17:59
  • 1
    It has nothing to do with your ` ` you are targetting wrong class name in css while you have written your css class name differently in your CSS Code..so make those identical and your loader will start working..! :D :P – Umair Shah Feb 13 '17 at 18:07
  • Please before posting such questions next time that you make sure on your end that it's nothing just a miss typed problem but instead a real problem..It would help to minimize the time which is wasted on solving those questions..! – Umair Shah Feb 13 '17 at 18:09

1 Answers1

1

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.

Michael Coker
  • 52,626
  • 5
  • 64
  • 64
  • 2
    As to why there is a difference in behavior when omitting the DOCTYPE, see the first footnote in my answer [here](http://stackoverflow.com/questions/12533926/are-class-names-in-css-selectors-case-sensitive/12533957#12533957). – BoltClock Feb 13 '17 at 17:57
  • Great catch, @BoltClock! – Constantin Groß Feb 13 '17 at 17:58