I am trying to create a automatic scrolling div without javaScript, but currently it stops too early. I have my animation going down 100% but this isn't even close to the end.
Here is the CSS. The div is dynamic. Sometimes the div is really big with multiple span, sometimes its only a few, That's why I tried to use -100%.
.question{
-webkit-animation: moveDiv 25s linear infinite;
}
#-webkit-keyframes moveDiv {
from {margin-top: 60vh;}
to {margin-top: -100%;}
}
Here is my plnkr
https://plnkr.co/edit/c7TiOH5LgUiqWmbUzPdb?p=preview
This would be my quick answer for you:
#-webkit-keyframes moveDiv {
from {-webkit-transform: translateY(60px); }
to { -webkit-transform: translateY(calc(-100% - 200px));}
}
transform is the perfect property for animations. The percentage in transform takes the percentage of the element, whereas the percentage for margin refer to the width of the containing block (according to mozilla developer).
/* Styles go here */
#finish{
text-align:center;
}
#message{
margin-top:20px;;
color:green;
font-size:60px;
text-align:center;
}
#main{
margin:40px;
text-align:center;
}
#Questions{
/*overflow:scroll;*/
overflow:hidden;
height:50vh;
background:rgba(203, 203, 203, 0.44);
color:white;
margin-bottom:20px;
}
.question{
-webkit-animation: moveDiv 14s linear infinite;
}
.QDisp{
margin-top:2%;
font-size:50px;
color:rgb(70, 232, 77);
margin-bottom:6%;
text-align:center;
}
.ADisp{
text-align:center;
display: block;
background-color:rgb(255, 103, 98);
margin: 15px;
margin-left: 100px;
margin-right:100px;
border-radius:25px;
color:white;
font-size: 40px;
}
.IDisp{
margin-top:2%;
font-size:40px;
color:rgb(255, 150, 54);
text-align:center;
margin-bottom:400px;
}
#-webkit-keyframes moveDiv {
from {-webkit-transform: translateY(60px);}
to {-webkit-transform: translateY(calc(-100% - 200px));}
}
<div id="finish">
<div id="message">
Thank You, we really hope you enjoyed it!
</div>
<div id="main">
<div id="Questions">
<div class="question">
<span class="Qs">
<p class = "QDisp">1 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">2 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">3 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">4 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">5 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">6 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
<span class="Qs">
<p class = "QDisp">7 jihasdfjeoihfon ofidsicdsaofnewew diahoshfoow</p>
<span class = "ADisp">joiasfdioenwowe </span>
<p class="IDisp">Reflkfasjpwepjiqnpqk;ljrewjlfjejwlejklwwfjk} </p>
</span>
</div>
</div>
</div>
</div>
Related
I want to have each text have a different color so I used a multiple span classes to set the color in css. I also want the text to have line breaks so I used div. This fiddle shows the result I want but the div tags used for the line breaks creates a large gap. Is there another way to have line breaks with multiple span classes?
Fiddle: https://jsfiddle.net/nh7vswco/
<pre id="info">
<div class = "fact-card">
<span class="animal"> animal</span>
<span class="colon"> : </span>
<span class="animal-name">tiger</span>
<span class="comma">,</span>
</div>
<div class = "fact-card">
<span class="animal"> species</span>
<span class="colon"> : </span>
<span class="animal-name">Mammal</span>
<span class="comma">,</span>
</div>
<div class = "fact-card">
<span class="animal"> type</span>
<span class="colon"> : </span>
<span class="animal-name">carnivore</span>
<span class="comma">,</span>
</div>
Result:
Each word and colon should have a different color.
animal : tiger,
species : mammal,
type : carnivore,
This fiddle has the result Fiddle: https://jsfiddle.net/nh7vswco/ but I would like to remove the gaps from the div tag.
1- There are many ways to make a line break like so: <br> or line-break CSS property.
2- To remove the gaps from the div tag. we can use the line-height: 0%;
<style>#info {
text-align: center;
padding-left: 20px;
padding-right: 20px;
}
.colon {
color: #cc7832;
}
.animal-name {
color: #2587be;
}
.animal {
color:#9473a5;
display: block;
}
.fact-card{
display: flex;
line-height: 0%;
}
.span {
font-family: Arial;
}
<pre id="info">
<div class = "fact-card">
<span class="animal"> animal</span>
<span class="colon"> : </span>
<span class="animal-name">tiger</span>
<span class="comma">,</span>
</div>
<div class = "fact-card">
<span class="animal"> species</span>
<span class="colon"> : </span>
<span class="animal-name">Mammal</span>
<span class="comma">,</span>
</div>
<div class = "fact-card">
<span class="animal"> type</span>
<span class="colon"> : </span>
<span class="animal-name">carnivore</span>
<span class="comma">,</span>
</div>
</pre>
This issue is actually due to the side-effects of using the pre tag. The additional spacing you have in between the divs inside your pre tag are being interpreted as line breaks as that is what pre is meant to do. If you do not want this extra spacing, eliminate the extra white space (line breaks, spaces, etc.) you have.
<pre id="info"><div class = "fact-card">
<span class="animal"> animal</span>
<span class="colon"> : </span>
<span class="animal-name">tiger</span>
<span class="comma">,</span>
</div><div class = "fact-card">
<span class="animal"> species</span>
<span class="colon"> : </span>
<span class="animal-name">Mammal</span>
<span class="comma">,</span>
</div><div class = "fact-card">
<span class="animal"> type</span>
<span class="colon"> : </span>
<span class="animal-name">carnivore</span>
<span class="comma">,</span>
</div>
Have this code:
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4> </div> </div>
How do I hide the text "(Fee Simple)" from displaying?
Want the Price to show but not the "Fee Simple" text
You can use a font-size trick like this:
h4.ihf-price {
font-size: 0;
}
h4.ihf-price span {
font-size: initial;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
Or use color trick if you want to maintain the same content width of h4:
h4.ihf-price {
color: #fff; /* Should be the same as background */
}
h4.ihf-price span {
color: initial;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
Hide text in the entire element. Show text only in the nested element.
.ihf-price {
font-size: 0;
}
.ihf-for-sale-price {
font-size: 16px;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
OR
.ihf-price {
visibility: hidden;
}
.ihf-for-sale-price {
visibility: visible;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
I was looking for Accordion to present this data with collapsibles on Web Browser.
I chanced upon this one.
Original Code Pen: https://codepen.io/abergin/pen/ihlDf
(Has some documentation & insights)
I downloaded this CP as a ZIP which had an HTML, CSS and SASS file.
I modified it offline to eliminate the column maximum width limitations and be able to show as many as possible on Desktop Browser. Put in a lot of smaller Values for fonts, padding & margins etc.
So as to make it simpler/ easier for folks here, I am forking the original Code Pen with my data.
Modification Code Pen: https://codepen.io/xml/pen/JrqKWQ?editors=0100
I have not been able to resolve or figure out is this.
All the collapsibles like "Utilities" show a huge empty space below. I'm not sure how to eliminate it taking up that space.
It happens for every <h2> (Folder Names) that contain a lot of <p> (Apps).
How can I fix the CSS or code so as to eliminate the empty space and ensure space is only taken when the collapse is expanded below?
Not sure what part of CSS / SASS code from the Code Pen is doing this and how to fix it. My goal is to maximize data visibility on screen.
$white: rgba(254,255,250,1)
$grey: rgba(220,231,235,1)
$red: rgba(255,104,115,1)
$black: rgba(48,69,92,0.8)
$sans: 'Titillium Web', sans-serif
.transition
transition: all 0.25s ease-in-out
.flipIn
animation: flipdown 0.5s ease both
.no-select
-webkit-tap-highlight-color: rgba(0,0,0,0)
-webkit-touch-callout: none
-webkit-user-select: none
-khtml-user-select: none
-moz-user-select: none
-ms-user-select: none
user-select: none
html
width: 100%
height: 100%
perspective: 900
overflow-y: scroll
background-color: $grey
font-family: $sans
color: $black
body
min-height: 0
display: inline-block
position: relative
left: 50%
margin: 90px 0
transform: translate( -50% , 0 )
box-shadow: 0 10px 0 0 $red inset
background-color: $white
max-width: 450px
padding: 30px
#media ( max-width:550px )
box-sizing: border-box
transform: translate( 0 , 0 )
max-width: 100%
min-height: 100%
margin: 0
left: 0
h1 , h2
color: $red
h1
text-transform: uppercase
font-size: 36px
line-height: 42px
letter-spacing: 3px
font-weight: 100
#extend .flipIn
h2
font-size: 26px
line-height: 34px
font-weight: 300
letter-spacing: 1px
display: block
background-color: $white
margin: 0
cursor: pointer
#extend .no-select
p
color: $black
font-size: 17px
line-height: 26px
letter-spacing: 1px
position: relative
overflow: hidden
max-height: 800px
#extend .transition
opacity: 1
transform: translate( 0 , 0 )
margin-top: 14px
z-index: 2
ul
list-style: none
perspective: 900
padding: 0
margin: 0
li
position: relative
padding: 0
margin: 0
padding-bottom: 4px
padding-top: 18px
border-top: 1px dotted $grey
#extend .flipIn
&:nth-of-type(1)
animation-delay: 0.5s
&:nth-of-type(2)
animation-delay: 0.75s
&:nth-of-type(3)
animation-delay: 1.0s
&:last-of-type
padding-bottom: 0
i
position: absolute
transform: translate( -6px , 0 )
margin-top: 16px
right: 0
&:before , &:after
content: ""
#extend .transition
position: absolute
background-color: $red
width: 3px
height: 9px
&:before
transform: translate( -2px , 0 ) rotate( 45deg )
&:after
transform: translate( 2px , 0 ) rotate( -45deg )
input[type=checkbox]
position: absolute
cursor: pointer
width: 100%
height: 100%
z-index: 1
opacity: 0
&:checked
&~p
margin-top: 0
max-height: 0
opacity: 0
transform: translate( 0 , 50% )
&~i
&:before
transform: translate( 2px , 0 ) rotate( 45deg )
&:after
transform: translate( -2px , 0 ) rotate( -45deg )
#keyframes flipdown
0%
opacity: 0
transform-origin: top center
transform: rotateX(-90deg)
5%
opacity: 1
80%
transform: rotateX(8deg)
83%
transform: rotateX(6deg)
92%
transform: rotateX(-3deg)
100%
transform-origin: top center
transform: rotateX(0deg)
<h1>CSS + HTML only Accordion Element</h1>
<ul>
<h2>Pg: </h2>
<li><input type="checkbox" checked><i></i><h2>Folder 1</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 2</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 3</h2>
<p>Apps 3</p>
</li>
<p>App: <span style="color:#0000ff">com.apple.mobilephone</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobilecal</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobileslideshow</span></p>
<p>App: <span style="color:#0000ff">com.apple.camera</span></p>
<p>App: <span style="color:#0000ff">com.apple.videos</span></p>
<p>App: <span style="color:#0000ff">com.apple.youtube</span></p>
<p>App: <span style="color:#0000ff">com.apple.Maps</span></p>
<p>App: <span style="color:#0000ff">com.apple.weather</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobilenotes</span></p>
<p>App: <span style="color:#0000ff">com.apple.reminders</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobiletimer</span></p>
<p>App: <span style="color:#0000ff">com.apple.gamecenter</span></p>
<li><input type="checkbox" checked><i></i><h2>Apple</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.apple.mobileme.fmf1</span></p>
<p>App: <span style="color:#0000ff">com.apple.Cards</span></p>
<p>App: <span style="color:#0000ff">com.apple.iBooks</span></p>
</li>
<p>App: <span style="color:#0000ff">com.apple.MobileStore</span></p>
<p>App: <span style="color:#0000ff">com.apple.AppStore</span></p>
<p>App: <span style="color:#0000ff">com.apple.Preferences</span></p>
</ul>
<!--Exit PAGE-->
<!--Enter PAGE-->
<ul>
<h2>Pg: </h2>
<li><input type="checkbox" checked><i></i><h2>Folder 1</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 2</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 3</h2>
<p>Apps 3</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Utilities</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.apple.MobileAddressBook</span></p>
<p>App: <span style="color:#0000ff">com.apple.calculator</span></p>
<p>App: <span style="color:#0000ff">com.apple.VoiceMemos</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Jailbreak</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.saurik.Cydia</span></p>
<p>App: <span style="color:#0000ff">libactivator</span></p>
<p>App: <span style="color:#0000ff">eu.heinelt.ifile</span></p>
<p>App: <span style="color:#0000ff">crash-reporter</span></p>
<p>App: <span style="color:#0000ff">com.googlecode.mobileterminal.Terminal</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Social</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.atebits.Tweetie2</span></p>
<p>App: <span style="color:#0000ff">info.colloquy.mobile</span></p>
<p>App: <span style="color:#0000ff">com.tapbots.Tweetbot</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Other</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.apple.stocks</span></p>
<li><input type="checkbox" checked><i></i><h2>Newsstand</h2>
<p>Apps 1</p>
</li>
</li>
<p>App: <span style="color:#0000ff">com.clickgamer.AngryBirds</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobileipod</span></p>
</ul>
<!--Exit PAGE-->
<!--Enter PAGE-->
<ul>
<h2>Pg: </h2>
<li><input type="checkbox" checked><i></i><h2>Folder 1</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 2</h2>
<p>Apps 1</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Folder 3</h2>
<p>Apps 3</p>
</li>
<li><input type="checkbox" checked><i></i><h2>Utilities</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.apple.MobileAddressBook</span></p>
<p>App: <span style="color:#0000ff">com.apple.calculator</span></p>
<p>App: <span style="color:#0000ff">com.apple.VoiceMemos</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Jailbreak</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.saurik.Cydia</span></p>
<p>App: <span style="color:#0000ff">libactivator</span></p>
<p>App: <span style="color:#0000ff">eu.heinelt.ifile</span></p>
<p>App: <span style="color:#0000ff">crash-reporter</span></p>
<p>App: <span style="color:#0000ff">com.googlecode.mobileterminal.Terminal</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Social</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.atebits.Tweetie2</span></p>
<p>App: <span style="color:#0000ff">info.colloquy.mobile</span></p>
<p>App: <span style="color:#0000ff">com.tapbots.Tweetbot</span></p>
</li>
<li><input type="checkbox" checked><i></i><h2>Other</h2>
<p>Apps 1</p>
<p>App: <span style="color:#0000ff">com.apple.stocks</span></p>
<li><input type="checkbox" checked><i></i><h2>Newsstand</h2>
<p>Apps 1</p>
</li>
</li>
<p>App: <span style="color:#0000ff">com.clickgamer.AngryBirds</span></p>
<p>App: <span style="color:#0000ff">com.apple.mobileipod</span></p>
</ul>
The problem is with the margins on the p tag.
It has its default margins, and you have added a margin-top:14px;
Then the ul li input[type="checkbox"]:checked ~ p rule removes the margin-bottom (sets it to 0).
So the space is the added margins of the elements that are hidden.
If you set both top and bottom margins to 0 when closed then it works fine.
See https://codepen.io/anon/pen/NaVbYN?editors=0100
Not sure but try adding
padding-bottom: 0px!important;
or
margin-bottom: 0px!important;
To your h2 class
Using below code, I am able to highlight the element with value 2 and 3 instead of element 3. I tried using last child and nth-last-type but didn't work as expected. Issue is with highlighting immediate next element of class - active and apply blink to both tick mark of 3 and value 3 and change of active class to change blink
No Jquery solution, as currently trying to implement using CSS3
I am trying to choose first element of class hightlight without active class using CSS only
HTML:
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<div class="steps" style="width:26%;float:left">
<div class="stepSection">
<table>
<tr><td><div class="highlight active"><span class="glyphicon glyphicon glyphicon-ok"></span></div></td><td>1.</td><td> <span>one</span></td></tr>
<tr><td><div class="highlight active" ><span class="glyphicon glyphicon glyphicon-ok"></span></div></td><td>2.</td><td> <span>two</span></td></tr>
<tr><td><div class="highlight"><span class="glyphicon glyphicon glyphicon-ok"></span></div> </td><td>3.</td><td><span>three</span></td></tr>
<tr><td><div class="highlight"><span class="glyphicon glyphicon glyphicon-ok"></span></div> </td><td>3.</td><td><span>four</span></td></tr>
</table>
</div>
</div>
<div style="width:2%;float:left;">
<div class="highlight active">1</div>
<div class="highlight active">2</div>
<div class="highlight">3</div>
<div class="highlight">4</div>
</div>
CSS3:
.highlight{
color:white;
width:20px;
height:20px;
border-radius:50%;
background: rgb(234,116,0);
display: inline-block;
text-align: center;
}
.active{
background:green;
}
#keyframes blink {
to { background: rgb(234,116,0); }
}
.active + .highlight{
color: white;
background: white;
animation: blink 2s steps(2, start) infinite;
}
Method 1: Jquery
You can do it using jquery like so
$(".active:last").next().addClass("blink")
And change your css to have blink class
.blink {
color: white;
background: white;
animation: blink 2s steps(2, start) infinite;
}
Working Js fiddle
Method 2:
If you want to do it only using css , you need to book keep your last element
by adding a class to the last element say .last
<div style="width:2%;float:left;">
<div class="highlight active">1</div>
<div class="highlight active last">2</div>
<div class="highlight">3</div>
<div class="highlight">4</div>
</div>
and then do you css like
.last + .highlight {
color: white;
background: white;
animation: blink 2s steps(2, start) infinite;
}
Method 3:
change your css to
div.active + div:not(.active){
color: white;
background: white;
animation: blink 2s steps(2, start) infinite;
}
Basically it finds the element which has class active before it and the next class which does not have the class active.
working jsfiddle
Instead of nth-last-type you may use:
.highlight + .highlight:not(.active):nth-of-type(3) {
The snippet:
.highlight {
color: white;
width: 20px;
height: 20px;
border-radius: 50%;
background: rgb(234, 116, 0);
display: inline-block;
text-align: center;
}
.active {
background: green;
}
#keyframes blink {
to {
background: rgb(234, 116, 0);
}
}
.highlight + .highlight:not(.active):nth-of-type(3) {
color: white;
background: white;
animation: blink 2s steps(2, start) infinite;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="steps" style="width:26%;float:left">
<div class="stepSection">
<table>
<tr>
<td>
<div class="highlight active"><span class="glyphicon glyphicon glyphicon-ok"></span></div>
</td>
<td>1.</td>
<td><span>one</span></td>
</tr>
<tr>
<td>
<div class="highlight active"><span class="glyphicon glyphicon glyphicon-ok"></span></div>
</td>
<td>2.</td>
<td><span>two</span></td>
</tr>
<tr>
<td>
<div class="highlight"><span class="glyphicon glyphicon glyphicon-ok"></span></div>
</td>
<td>3.</td>
<td><span>three</span></td>
</tr>
<tr>
<td>
<div class="highlight"><span class="glyphicon glyphicon glyphicon-ok"></span></div>
</td>
<td>3.</td>
<td><span>four</span></td>
</tr>
</table>
</div>
</div>
<div style="width:2%;float:left;">
<div class="highlight active">1</div>
<div class="highlight active">2</div>
<div class="highlight">3</div>
<div class="highlight">4</div>
</div>
I am getting parser error when I try to use CSS animations.
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: "-" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
<html>
<head>
.spin {
-webkit-animation: spin .2s infinite linear;
-moz-animation: spin .2s infinite linear;
-o-animation: spin .2s infinite linear;
animation: spin .2s infinite linear;
-webkit-transform-origin: 50% 58%;
transform-origin: 50% 58%;
-ms-transform-origin: 50% 58%; /* IE 9 */
}
#-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
#-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
#keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<h1 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h1>
<h3 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h3>
<h6 class="text-center">
<span class="glyphicon glyphicon-refresh spin"></span>
<span class="glyphicon glyphicon-record spin"></span>
<span class="glyphicon glyphicon-send spin"></span>
<span class="glyphicon glyphicon-star spin"></span>
</h6>
</body>
</html>
Add <style type="text/css"> just below the head tag and above your CSS code. It looks like you have the closing tag at the bottom already.