Star rating input using Adaptive cards - adaptive-cards

I am looking to develop an Adaptive card that will take a user input value ranging from 1 to 5 depending on the number of stars the user selects.
I also would like to apply animation as the user hovers over the stars. For example if the user hovers through from left to right to the 4th star then I would like stars 1 to 4 selected. Similarly, if the user hovers back left to the 2nd star then I would like the 3rd and 4th star deselected. See the link below for an example.
However, given adaptive cards are purely declarative (i.e. no code is allowed) is it possible to develop one? If so please can you point me in the right direction?
See link below for an example of how I would like this presented to a user (to be clear using Adaptive cards),
Codepen - A code pen by Ash Durham
HTML
<span class="rating_stars rating_0">
<span class='s' data-low='0.5' data-high='1'><i class="fa fa-star-o"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star"></i></span>
<span class='s' data-low='1.5' data-high='2'><i class="fa fa-star-o"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star"></i></span>
<span class='s' data-low='2.5' data-high='3'><i class="fa fa-star-o"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star"></i></span>
<span class='s' data-low='3.5' data-high='4'><i class="fa fa-star-o"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star"></i></span>
<span class='s' data-low='4.5' data-high='5'><i class="fa fa-star-o"></i><i class="fa fa-star-half-o"></i><i class="fa fa-star"></i></span>
<span class='r r0_5' data-rating='1' data-value='0.5'></span>
<span class='r r1' data-rating='1' data-value='1'></span>
<span class='r r1_5' data-rating='15' data-value='1.5'></span>
<span class='r r2' data-rating='2' data-value='2'></span>
<span class='r r2_5' data-rating='25' data-value='2.5'></span>
<span class='r r3' data-rating='3' data-value='3'></span>
<span class='r r3_5' data-rating='35' data-value='3.5'></span>
<span class='r r4' data-rating='4' data-value='4'></span>
<span class='r r4_5' data-rating='45' data-value='4.5'></span>
<span class='r r5' data-rating='5' data-value='5'></span>
</span>
<div class="values">
<div>
<label>Rating</label><input type="text" id="rating" value="0" />
</div>
<div>
<label>Rating Value</label><input type="text" name="rating" id="rating_val" value="0" />
</div>
</div>
<div class="info">
<p>The above textboxes should be hidden fields, but have been made textboxes to display the values when you click.</p>
<p>The 'Rating' value can be used for class/id based changes to this if wanting to use a background sprite to manage the stars instead.</p>
</div>
CSS
.rating_stars {
margin-top: 15px;
display: inline-block;
font-size: 20px;
font-weight: 200;
color: #918f8f;
position: relative;
}
.rating_stars span .fa, .rating_stars span.active-low .fa-star-o, .rating_stars span.active-high .fa-star-o{
display: none;
}
.rating_stars span .fa-star-o{
display: inline-block;
}
.rating_stars span.s.active-high .fa-star{
display: inline-block; color: #feb645;
}
.rating_stars span.s.active-low .fa-star-half-o{
display: inline-block; color: #feb645;
}
.rating_stars span.r {
position: absolute;
top: 0;
height: 20px;
width: 10px;
left: 0;
}
.rating_stars span.r.r0_5 {left:0px;}
.rating_stars span.r.r1 {left:10px; width: 11px;}
.rating_stars span.r.r1_5 {left:21px; width: 13px;}
.rating_stars span.r.r2 {left:34px; width: 12px;}
.rating_stars span.r.r2_5 {left:46px; width: 12px;}
.rating_stars span.r.r3 {left:58px; width: 11px;}
.rating_stars span.r.r3_5 {left:69px; width: 12px;}
.rating_stars span.r.r4 {left:81px; width: 12px;}
.rating_stars span.r.r4_5 {left:93px; width: 12px;}
.rating_stars span.r.r5 {left:105px; width: 12px;}
/* Just to make things look pretty ;) */
html, body {
text-align: center;
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
height: 100%;
color: #eee;
background: #7d7e7d; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMTAwJSI+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjN2Q3ZTdkIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzBlMGUwZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(-45deg, #7d7e7d 0%, #0e0e0e 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#7d7e7d), color-stop(100%,#0e0e0e)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(-45deg, #7d7e7d 0%,#0e0e0e 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(-45deg, #7d7e7d 0%,#0e0e0e 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(-45deg, #7d7e7d 0%,#0e0e0e 100%); /* IE10+ */
background: linear-gradient(135deg, #7d7e7d 0%,#0e0e0e 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d7e7d', endColorstr='#0e0e0e',GradientType=1 ); /* IE6-8 fallback on horizontal gradient */
}
label {width: 100px;display: inline-block; text-align: right; margin-right: 10px;}
input {width: 50px; text-align: center;}
.values {margin-top: 20px;}
.info {max-width: 500px; margin: 20px auto;}
JS
jQuery(document).ready(function($) {
$('.rating_stars span.r').hover(function() {
// get hovered value
var rating = $(this).data('rating');
var value = $(this).data('value');
$(this).parent().attr('class', '').addClass('rating_stars').addClass('rating_'+rating);
highlight_star(value);
}, function() {
// get hidden field value
var rating = $("#rating").val();
var value = $("#rating_val").val();
$(this).parent().attr('class', '').addClass('rating_stars').addClass('rating_'+rating);
highlight_star(value);
}).click(function() {
// Set hidden field value
var value = $(this).data('value');
$("#rating_val").val(value);
var rating = $(this).data('rating');
$("#rating").val(rating);
highlight_star(value);
});
var highlight_star = function(rating) {
$('.rating_stars span.s').each(function() {
var low = $(this).data('low');
var high = $(this).data('high');
$(this).removeClass('active-high').removeClass('active-low');
if (rating >= high) $(this).addClass('active-high');
else if (rating == low) $(this).addClass('active-low');
});
}
});
Thanks

There was a question very similar to this just yesterday - see In bot framework v4, how to implemente rating card with comment box and submit button. Very important - note the comments below the answer as we had an important discussion that might also be applicable to your scenario

Related

Font-Size Responsive to DIV Size

I'm creating a page where I have some elements and they could be hidden or not. I'd like to know if it's possible to adjust my font-size according to my div?
For example, when I have 2 elements shown, I'd like my text to be bigger than when I have 5, so this way my text would fit better the space.
My JavaScript Code, which define if the element will be hidden or not.
var val_kpi = $("#t3_teste_B_kpi").text();
var val_kpi_clean = Number(val_kpi.replace(/[^0-9.-]+/g,""));
if (val_kpi_clean != null && val_kpi_clean != 0){
$("#t3_teste_B").css("display", "");
}else{
$("#t3_teste_B").css("display", "none");
}
.tier3_test{
width:50%;
min-height: 100px;
height: auto;
margin-right: 2.5px ;
/*Configurações Visuais */
background: #FFF;
/*Configurações da Borda */
border: 5px solid;
border-image-slice: 1;
/* border-radius: 30px 30px 30px 30px; */
border-image-source: linear-gradient(to left, #2B6640, #66B512);
}
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
.tier3_in{
margin: 10px 5px 10px 5px;
width:100%;
}
.kpititle3{
font-weight: bold;
color: #000;
font-size: calc(8px + (12 - 8) * ((100vw - 300px) / (1600 - 300)));
}
.kpitext3 {
font-size: calc(10px + (16 - 10) * ((100vw - 300px) / (1600 - 300)));
font-weight: bold;
}
.no-wrap{
white-space: nowrap;
}
<div class="tier3_test flex-center">
<div class="tier3_in" id="t3_teste_A">
<span class="kpititle3">A</span>
<p><span class="kpitext3" id="t3_teste_A_kpi">VALOR 1</span></p>
</div>
<div class="tier3_in" id="t3_teste_B">
<span class="kpititle3">B</span>
<p><span class="kpitext3" id="t3_teste_B_kpi">VALOR 2</span></p>
</div>
<div class="tier3_in" id="t3_teste_C">
<span class="kpititle3">C</span>
<p><span class="kpitext3" id="t3_teste_C_kpi">VALOR 3</span></p>
</div>
<div class="tier3_in" id="t3_teste_D">
<span class="kpititle3">D</span>
<p><span class="kpitext3" id="t3_teste_D_kpi">VALOR 4</span></p>
</div>
<div class="tier3_in" id="t3_teste_E">
<span class="kpititle3">E</span>
<p><span class="kpitext3" id="t3_teste_E_kpi">VALOR 5</span></p>
</div>
</div>
The Result I Have:
The Result I'd like to have:
There is no way to do this using simple CSS.
Chris Coyier over at CSS-Tricks explains the best solutions, and all use javascript. However, there is no point figuring it out yourself - Coyier discusses a few already-written libraries that do the job for you.
Below is an example using your code and the first such library: Dave Rupert’s FitText library. Click the button to see what happens when three divs are removed.
jsFiddle Demo (StackSnippets not working at the moment)
var grow_factor = $('.tier3_in').length / 2;
$('.tier3_test').fitText( grow_factor );
/* Below is just to remove divs for demo... */
$('button').click(function(){
$('#t3_teste_C, #t3_teste_D, #t3_teste_E').remove();
var grow_factor = $('.tier3_in').length / 2;
$('.tier3_test').fitText( grow_factor );
});
.tier3_test{
width:50%;
min-height: 100px;
height: auto;
margin-right: 2.5px ;
/*Configurações Visuais */
background: #FFF;
/*Configurações da Borda */
border: 5px solid;
border-image-slice: 1;
/* border-radius: 30px 30px 30px 30px; */
border-image-source: linear-gradient(to left, #2B6640, #66B512);
}
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
.tier3_in{
margin: 10px 5px 10px 5px;
width:100%;
}
.kpititle3{
font-weight: bold;
color: #000;
}
.no-wrap{
white-space: nowrap;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/jquery.fittext.js"></script>
<div class="tier3_test flex-center">
<div class="tier3_in" id="t3_teste_A">
<span class="kpititle3">A</span>
<p><span class="kpitext3" id="t3_teste_A_kpi">VALOR 1</span></p>
</div>
<div class="tier3_in" id="t3_teste_B">
<span class="kpititle3">B</span>
<p><span class="kpitext3" id="t3_teste_B_kpi">VALOR 2</span></p>
</div>
<div class="tier3_in" id="t3_teste_C">
<span class="kpititle3">C</span>
<p><span class="kpitext3" id="t3_teste_C_kpi">VALOR 3</span></p>
</div>
<div class="tier3_in" id="t3_teste_D">
<span class="kpititle3">D</span>
<p><span class="kpitext3" id="t3_teste_D_kpi">VALOR 4</span></p>
</div>
<div class="tier3_in" id="t3_teste_E">
<span class="kpititle3">E</span>
<p><span class="kpitext3" id="t3_teste_E_kpi">VALOR 5</span></p>
</div>
</div>
<button>Remove 3 Divs</button>
In your javascript, simply add / remove one of two extra-classes (.big-font and .small-font)to your wrapper div (.tier-3-test) in function of if its elements are removed or not. In your css, you then define a font-size for extra class 1 which is added if the wrapper div contains all 5, and another font-size for extra class 2 which is added if the wrapper div contains less divs, more or less like so:
.big-font {
font-size: 30px;
}
.small-font {
font-size: 20px;
}

Anki CSS/HTML align vertically to bottom / center / top

I am editing the template of an Anki deck, which uses HTML and CSS. What I would like to do here is on the front side, vertically aligning the Japanese character to the middle and the hint to the bottom. I tried manually spacing everything with <br>, but then it doesn't work in different resolution windows (and is just a dirty solution) Front example.
On the back side I would like to make the stroke diagram always snap to the top, the Japanese character with keyword and mnemonic in the middle, and the rest on the bottom. If I tried spacing this with <br> I would get the same problem as on the front page, plus the mnemonic is sometimes 1 line, but can also be 5+ lines so it would have to be aligned dynamically to work even if the window size was always the same Back example with arrows.
I already found this question which seems to somewhat answer my question, but as I know practically nothing about CSS/HTML I don't know how to apply it in my case. If you could help me I would greatly appreciate it as I spend a lot of time with this deck and it keeps annoying me, I would also share the improved version for other people to use.
Here is the code for the front
<div class="front" lang="ja">
<span class="large japanese">{{kanji}}</span>
<br>
<hr>
{{hint:Memory palace}}
back
<div class="back" lang="ja">
{{strokeDiagram}}<br> <br>
<hr>
<span class="medium">{{keyword}}</span>
<br/><br/>
<span class="large japanese">{{kanji}}</span>
<br>
<span class="medium">{{myStory}}</span> <br><hr>
<span class="tiny"> Memory palace: {{Memory palace}}</span>
<span class="tiny"> Frame: {{frameNoV6}} Strokes: {{strokeCount}} — Jouyou Grade: {{jouYou}} JLPT: {{jlpt}}</span><br/>
<!-- Uncomment for Heisig Story
<hr>
<span class="medium">{{heisigStory}}</span>
{{#heisigComment}}<br/><br/><span class="small">{{heisigComment}}</span>{{/heisigComment}}
-->
<!-- Uncomment for koohi Story
<hr/>
<span class="medium">{{koohiiStory1}}</span>
-->
<hr/>
<br> <br>
<!-- Uncomment for On-Yomi and Kun-Yomi
<span class="small">On-Yomi: <span class="medium japanese">{{onYomi}}</span> Kun-Yomi: <span class="medium japanese">{{kunYomi}}</span></span><br/>
-->
<span class="tiny">Constituents: {{constituent}}</span><br/><br/>
{{#readingExamples}}<span class="tiny">Examples: <span class="japanese">{{readingExamples}}</span></span>{{/readingExamples}}
</div>
and the styling,
div.front, div.back {
text-align: center;
font-family: sans-serif;
font-size: 16px; /* line height is based on this size in Anki for some reason, so start with the smallest size used */
}
span.tiny {font-size: 16px;}
span.small {font-size: 24px;}
span.medium {font-size: 32px;}
span.large {font-size: 96px;}
span.italic {font-style: italic;}
.win .japanese {font-family: "Meiryo", "MS Mincho";}
.mac .japanese {font-family: "Hiragino Mincho Pro";}
.linux .japanese {font-family: "Kochi Mincho";}
.mobile .japanese {font-family: "Motoya L Cedar", "Motoya L Maru", "DroidSansJapanese", "Hiragino Mincho ProN";}
Front
div.front,
div.back {
width: 100%;
text-align: center;
font-family: sans-serif;
font-size: 16px;
/* line height is based on this size in Anki for some reason, so start with the smallest size used */
}
span.tiny {
font-size: 16px;
}
span.small {
font-size: 24px;
}
span.medium {
font-size: 32px;
}
span.large {
font-size: 96px;
}
span.italic {
font-style: italic;
}
.win .japanese {
font-family: "Meiryo", "MS Mincho";
}
.mac .japanese {
font-family: "Hiragino Mincho Pro";
}
.linux .japanese {
font-family: "Kochi Mincho";
}
.mobile .japanese {
font-family: "Motoya L Cedar", "Motoya L Maru", "DroidSansJapanese", "Hiragino Mincho ProN";
}
/* Positional */
.bottom {
display: block;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
.center {
display: block;
position: absolute;
left: 0;
right: 0;
/* I want a better way to do the below! */
top: 50%;
transform: translateY(-50%);
}
.top {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
}
<div class="front" lang="ja">
<span class="large japanese center">{{kanji}}</span>
<hr>
<span class="bottom">{{hint:Memory palace}}</span>
Note that the <hr> is unstyled.
Back
div.front,
div.back {
width: 100%;
text-align: center;
font-family: sans-serif;
font-size: 16px;
/* line height is based on this size in Anki for some reason, so start with the smallest size used */
}
span.tiny {
font-size: 16px;
}
span.small {
font-size: 24px;
}
span.medium {
font-size: 32px;
}
span.large {
font-size: 96px;
}
span.italic {
font-style: italic;
}
.win .japanese {
font-family: "Meiryo", "MS Mincho";
}
.mac .japanese {
font-family: "Hiragino Mincho Pro";
}
.linux .japanese {
font-family: "Kochi Mincho";
}
.mobile .japanese {
font-family: "Motoya L Cedar", "Motoya L Maru", "DroidSansJapanese", "Hiragino Mincho ProN";
}
/* Positional */
.bottom {
display: block;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
.center {
display: block;
position: absolute;
left: 0;
right: 0;
/* I want a better way to do the below! */
top: 50%;
transform: translateY(-50%);
}
.top {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
}
<div class="back" lang="ja">
<div class="top">{{strokeDiagram}}</div>
<hr>
<div class="center"><span class="medium">{{keyword}}</span>
<span class="large japanese">{{kanji}}</span>
</div>
<div class="bottom">
<span class="medium">{{myStory}}</span> <br>
<hr>
<span class="tiny"> Memory palace: {{Memory palace}}</span>
<span class="tiny"> Frame: {{frameNoV6}} Strokes: {{strokeCount}} — Jouyou Grade: {{jouYou}} JLPT: {{jlpt}}</span><br/>
<!-- Uncomment for Heisig Story
<hr>
<span class="medium">{{heisigStory}}</span>
{{#heisigComment}}<br/><br/><span class="small">{{heisigComment}}</span>{{/heisigComment}}
-->
<!-- Uncomment for koohi Story
<hr/>
<span class="medium">{{koohiiStory1}}</span>
-->
<hr/>
<br> <br>
<!-- Uncomment for On-Yomi and Kun-Yomi
<span class="small">On-Yomi: <span class="medium japanese">{{onYomi}}</span> Kun-Yomi: <span class="medium japanese">{{kunYomi}}</span></span><br/>
-->
<span class="tiny">Constituents: {{constituent}}</span><br/><br/> {{#readingExamples}}
<span class="tiny">Examples: <span class="japanese">{{readingExamples}}</span></span>{{/readingExamples}}
</div>
</div>
One problem with this technique is that, if there is insufficient space, they will draw over each other.

Why can't I create a CSS gradient background in sharepoint 2010?

I am trying to add a gradient background to a div in a page I'm making in Sharepoint 2010. The code below is working perfectly when I edit the html source and preview the page, but once I click the Save & Close button at the top left, the gradient disappears. Does sharepoint 2010 not allow gradients?
<style>
#gradientBanner {
background: white; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(left, #AFD3FA, #E3F9FF); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(right, #AFD3FA, #E3F9FF); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(right, #AFD3FA, #E3F9FF); /* For Firefox 3.6 to 15 */
background: linear-gradient(to right, #AFD3FA, #E3F9FF) !important; /* Standard syntax */
}
</style>
<div id="gradientBanner" style="width: 100%; height: 160px; ">
<div style="width:420px; display: inline-block; position:absolute; left:1px;">
<p style="font-family:cordia new;font-size: 36px; color:#547FAB; vertical-align: middle; padding-top: 21px; padding-left:30px;">PAYROLL LEADERSHIP TEAM</p>
</div>
<img src="/wg/PayrollLeadershipTeam/Images1/PuzzleBuildingBanner.png" alt="" style="position:absolute; right:23px; height: 160px; z-index:1;"/>
<div style="width: 100%; display: inline-block; position:relative; top:146px; height: 14px; background-color: #195E8A; z-index:0;">
</div>
</div>
<br/>
<br/>
<br/>
<div class="ms-rtestate-read ms-rte-wpbox" contenteditable="false">
<div class="ms-rtestate-notify ms-rtestate-read 59faed79-5d0f-4684-b5f6-fd96080c5c8f" id="div_59faed79-5d0f-4684-b5f6-fd96080c5c8f">
</div><div class="ms-rtestate-read" id="vid_59faed79-5d0f-4684-b5f6-fd96080c5c8f" style="display: none;"></div></div>
No; it's just that SharePoint strips out any script tags unless you're using the Script Editor web part.

Equally space elements using display: flex;

I am experimenting with Flexbox for some UI work I'm doing at the moment. I have a group of select boxes that i have styled with some basic css. My question to you is how can i equally space the devices without one or two looking too close to one another?
#device-select {
background: #2d2d2d;
border-radius: 8px;
width: 250px;
display: flex;
padding: 20px;
}
.rad, .ckb {
cursor:pointer;
flex: 1;
text-align: center;
color: white;
}
.rad > input, .ckb > input {
/* Hide original radio and checkboxes */
visibility: hidden;
position: absolute;
}
.rad > i {
font-size: 64px;
color: #fff;
}
.rad:hover > i {
/* HOVER <i> STYLE */
color: wheat;
}
.rad > input:checked + i {
color: purple;
}
<link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"/>
<div id="device-select">
<label class="rad">
<input type="radio" name="device-choice" value="desktop" /> <i class="fa fa-desktop"></i>
Desktop</label>
<label class="rad">
<input type="radio" name="device-choice" value="tablet" /> <i class="fa fa-tablet"></i>
Tablet</label>
<label class="rad">
<input type="radio" name="device-choice" value="mobile" /> <i class="fa fa-mobile"></i>
Mobile</label>
</div>
Please remove flex: 1; from .rad, .ckb
New code should be
.rad, .ckb {
cursor:pointer;
text-align: center;
color: white;
}
Removing flex:1; from .rad, .ckb class does the magic.
Check JsFiddle.
Also read this to know more about flex properties.
Can you have DIVs inside #device-select and then inside these DIVs you will have LABELs? So you can apply margin or padding to LABEL tag. Of course this is only if you want another DIVs as LABELs wrapper.

Changing the color of an icon from FontAwesome?

I am using BigCommerce, and have this for my code:
.icon-cart {
color: #4ca3c0 !important;
}
.icon-cart a{
color: #4ca3c0 !important;
}
and it won't change the color of the icon. Any help?
http://glymed-plus.mybigcommerce.com/
The fontAwesome installation is messed up.
The reason color CSS attribute won't change the color of the shopping cart is because the shopping cart is being rendered by a sprite:
.icon {
display: inline-block;
width: 16px;
height: 14px;
background: url("http://cdn3.bigcommerce.com/r-13587bfb690318eb6b3c052034841f2aff994eb4/themes/ClassicNext/images/icon_sprite.png") no-repeat 0 -27px;
}
(the background is loading an image, instead of the icon).
See http://fortawesome.github.io/Font-Awesome/get-started/
You might not have copied the other folders in the installation.
If you remove the background, install the other dirs, and keep your HTML, it should work.
EDIT: You were right, fontAwesome is correctly installed.
Now change the <i> element:
<i class="fa fa-shopping-cart" title="View Cart"> </i>
You can set the size and position to better the display, but the fa and fa-shopping-cart classes must be set for showing the shopping cart icon.
Your icon is not css made, it is a png image that is loaded as the icon's background.
you cannot just 'change' its color, you need to adjust it using CSS Filters
in your case, you can apply invert on the <i> element:
-webkit-filter: invert(100%);
to change it from gray to white.
body {
background: black;
}
.icon {
display: inline-block;
width: 16px;
height: 14px;
background: url("http://cdn3.bigcommerce.com/r-13587bfb690318eb6b3c052034841f2aff994eb4/themes/ClassicNext/images/icon_sprite.png") no-repeat 0 -27px;
-webkit-filter: invert(100%);
}
.icon:hover {
-webkit-filter: invert(0%);
}
<i class="icon icon-cart" title="View Cart" style="
color: red;
"> </i>
First Remove !important
.icon-cart {
color: #4ca3c0;
}
.icon-cart a{
color: #4ca3c0;
}
now here is how you markup looks like
<a href="" title="View Cart">
<i class="icon icon-cart" title="View Cart"> </i>
<span></span>
</a>
.icon-cart is i and has no child.
So this is not valid:
.icon-cart a{
color: #4ca3c0;
}