Responsive progress bar

2015-04-05

Ezt a kódrészt mostanában készítettem és gondoltam megosztom veletek, hátha valakinek hasznára lesz egyszer.

A működő kódot ide kattintva tudod megnézni.

Videó

Videó

HTML forráskód


<div class="wrapper">

    <h1>.: progress bar :.</h1>

    <ul class="progress-bar weeks">
        <li><div>1. hét</div></li>
        <li><div>2. hét</div></li>
        <li class="active"><div>3. hét</div></li>
        <li><div>4. hét</div></li>
    </ul>

    <ul class="progress-bar lessons">
        <li><div>1.</div><span>lecke</span></li>
        <li><div>2.</div><span>lecke</span></li>
        <li><div>3.</div><span>lecke</span></li>
        <li class="active"><div>4.</div><span>lecke</span></li>
        <li><div>5.</div><span>lecke</span></li>
        <li><div>6.</div><span>lecke</span></li>
        <li><div>7.</div><span>lecke</span></li>
    </ul>

</div>

CSS forráskód


* { padding:0; margin:0; border:0 }
body { background:#272d34; font-family: 'Ubuntu'; font-size: 11px; }
h1 { font-size: 40px; color: #fff; text-align: center; margin: 0 0 60px 0 }
.wrapper { width: 90%; max-width: 800px; margin: 40px auto }

.progress-bar li {
    list-style: none;
    float: left;
    text-align: center;
    position: relative;
    height: 50px
}
.progress-bar li:before {
    content: "";
    z-index: -1;
    position: absolute;
    left: 0;
    top: 20%;
    background: #ffcc00;
    width: 100%;
    height: 8px;
    box-shadow: inset 1px 1px 1px rgba(0,0,0,0.4), 1px 1px 1px rgba(0,0,0,0.7)
}
.progress-bar li:first-child:before { border-radius: 5px 0 0 5px }
.progress-bar li:last-child:before { border-radius: 0 5px 5px 0 }

.progress-bar li div {
    background: #ffcc00;
    font-size: 14px;
    font-weight: bold;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 15px;
    margin: 0 auto 5px auto;
    box-shadow: inset 1px 1px 1px rgba(0,0,0,0.2), 1px 1px 1px rgba(0,0,0,0.4)
}
.progress-bar li span {
    display: block;
    color: rgba(255,255,255,0.4)
}
.progress-bar li.active div {
    background: linear-gradient(#b00000 0%,#830303 100%);
    color: #fff
}

.progress-bar.weeks li { width: 25% }
.progress-bar.weeks li div { width: 55px }
.progress-bar.lessons li { width: 14.28% }

@media only screen and (max-width:480px) {
    .progress-bar li div {
        width: 20px;
        height: 20px;
        line-height: 20px;
        border-radius: 10px;
        font-size: 12px
    }
    .progress-bar li:before {
        height: 4px;
        top: 15%
    }
}