user981220
user981220

Reputation: 27

CSS data-step to be changed with span element

Hello I am using a step bar template which can be seen here: http://codepen.io/mattdrose/pen/qEZBge

What my problem is comes on the complete step, which code is the following:

 `<li class="is-complete lx-text-table" data-step="✔">` 

Where I would like to change data-step icon like <span class="icon"></span>

The complete step CSS is the follwing:

.progress_bar > li.is-complete:before, .progress_bar > li.is-complete:after {

  color: #FFF;
  background: #9bca61;

Any idea how I can achieve this result will be very welcome. Thanks in advance.

Upvotes: 0

Views: 2703

Answers (1)

zer00ne
zer00ne

Reputation: 43880

I'm not totally sure what you are requesting... you want to know how to put a "✓" the circles? If so, look at my snippet. I changed the content value from attr(data-end) to'\2713' which is the equivalent of "✓" :

.progress > li:before { content: '\2713';

.progress {
  list-style: none;
  margin: 0;
  padding: 0;
  display: table;
  table-layout: fixed;
  width: 100%;
  color: #849397;
}
.progress > li {
  position: relative;
  display: table-cell;
  text-align: center;
  font-size: 0.8em;
}
.progress > li:before {
  /*content: attr(data-step);*/
  content: '\2713';
  display: block;
  margin: 0 auto;
  background: #DFE3E4;
  width: 3em;
  height: 3em;
  text-align: center;
  margin-bottom: 0.25em;
  line-height: 3em;
  border-radius: 100%;
  position: relative;
  z-index: 1000;
}
.progress > li:after {
  content: '';
  position: absolute;
  display: block;
  background: #DFE3E4;
  width: 100%;
  height: 0.5em;
  top: 1.25em;
  left: 50%;
  margin-left: 1.5em\9;
  z-index: -1;
}
.progress > li:last-child:after {
  display: none;
}
.progress > li.is-complete {
  color: #2ECC71;
}
.progress > li.is-complete:before,
.progress > li.is-complete:after {
  color: #FFF;
  background: #2ECC71;
}
.progress > li.is-active {
  color: #3498DB;
}
.progress > li.is-active:before {
  color: #FFF;
  background: #3498DB;
}
/**
 * Needed for IE8
 */

.progress__last:after {
  display: none !important;
}
/**
 * Size Extensions
 */

.progress--medium {
  font-size: 1.5em;
}
.progress--large {
  font-size: 2em;
}
/**
 * Some Generic Stylings
 */

*,
*:after,
*:before {
  box-sizing: border-box;
}
h1 {
  margin-bottom: 1.5em;
}
.progress {
  margin-bottom: 3em;
}
a {
  color: #3498DB;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
body {
  text-align: center;
  color: #444;
}
<h1>Scalable Responsive Progress Bar</h1>

<ol class="progress">
  <li class="is-active" data-step="1">
    Step 1
  </li>
  <li data-step="2">
    Step 2
  </li>
  <li data-step="3" class="progress__last">
    Step 3
  </li>
</ol>

<ol class="progress progress--medium">
  <li class="is-complete" data-step="1">
    Step 1
  </li>
  <li class="is-active" data-step="2">
    Step 2
  </li>
  <li data-step="3" class="progress__last">
    Step 3
  </li>
</ol>

<ol class="progress progress--large">
  <li class="is-complete" data-step="1">
    Create Account
  </li>
  <li class="is-complete" data-step="2">
    Login
  </li>
  <li class="is-active" data-step="3">
    Payment
  </li>
  <li data-step="4" class="progress__last">
    Confirm
  </li>
</ol>

<h5><a href="http://www.browserstack.com/screenshots/18de86e5aee5c2bac662805e03ea5ed1dbd7d7fd" target="_blank">Supported by IE8+</a></h5>

If you don't want all of the circles with "✓", I can show you how to do it for specific circles as well.

UPDATE: On rereading the question, I think you actually want to do individual circles. If so then leave the CSS the way it was originally and do this instead:

<li class="is-complete lx-text-table" data-step="&#10003">

Upvotes: 1

Related Questions