Jumat, 17 Februari 2012

Make Ordered List More Styles

Mari kita bermain-main dengan list-style. Dimana pemakaian list ini sering kita pakainya dengan tagging <ol> dan <ul>. Dengan kemajuan bahasa CSS yang ada saat ini, memungkinkan kita berkreasi lebih dengan atribut lists tersebut. Tidak terbatas hanya menampilkan deretan baris saja bos, coba lihat kreasi² berikut unordered list hover style, lis style use jQuery, creating multicolumn lists using css...search di kotak pencarian dengan keyword list style ;)
Walau sudah banyak trik ini Koben posting, namun tak ada salahnya berbagi kembali agar gaya list dapat terus bervariasi :D Dimulai dari membaca artikel master @chriscoyier numbering in style Koben menemukan kembali yg lebih full stylish ;;)

Tidak tanggung-tanggung 2 buah gaya ordered list diciptakan! Here original article CSS3 ordered list styles by master @catalinred :)

Rounded Shaped Numbers

  1. List item 1
  2. List item 2
  3. List item 3
    1. List sub item 1
    2. List sub item 2
  4. List item 4
  5. List item 5

CSS3 Code Rounded Shaped Numbers

ol {
counter-reset: li;
list-style: none;
*list-style: decimal;
font: 15px'trebuchet MS', 'lucida sans';
padding: 0;
}
ol ol {
margin: 0 0 0 2.5em;
}
.rounded-list a {
position: relative;
display: block;
padding: .4em .4em .4em 2.8em;
*padding: .4em;
margin: .5em 0;
background: #ddd;
color: #444;
text-decoration: none;
-moz-border-radius: .3em;
-webkit-border-radius: .3em;
border-radius: .3em;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
.rounded-list a:hover {
background: #eee;
}
.rounded-list a:hover:before {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
.rounded-list a:before {
content: counter(li);
counter-increment: li;
position: absolute;
left: -.3em;
top: 50%;
margin-top: -1.3em;
background: #0099FF;
height: 2em;
width: 2em;
line-height: 2em;
border: .3em solid #fff;
text-align: center;
font-weight: bold;
-moz-border-radius: 2em;
-webkit-border-radius: 2em;
border-radius: 2em;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
MARKUP HTML<ol class="rounded-list">
<li>
<a href="">List item 1</a>
</li>
<li>
<a href="">List item 2</a>
</li>
<li>
<a href="">List item 3</a>
<ol>
<li>
<a href="">List sub item 1</a>
</li>
<li>
<a href="">List sub item 2</a>
</li>
</ol>
</li>
<li>
<a href="">List item 4</a>
</li>
<li>
<a href="">List item 5</a>
</li>
</ol>

Rectangle Shaped Numbers

  1. List item 1
  2. List item 2
  3. List item 3
    1. List sub item 1
    2. List sub item 2
    3. List sub item 3
  4. List item 4
  5. List item 5

CSS3 Code Rectangle Shaped Numbers

ol {
counter-reset: li;
list-style: none;
*list-style: decimal;
font: 15px'trebuchet MS', 'lucida sans';
padding: 0;
}
ol ol {
margin: 0 0 0 2.5em;
}
.rectangle-list a {
position: relative;
display: block;
padding: .4em .4em .4em .8em;
*padding: .4em;
margin: .5em 0 .5em 2.5em;
background: #ddd;
color: #444;
text-decoration: none;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
.rectangle-list a:hover {
background: #eee;
}
.rectangle-list a:before {
content: counter(li);
counter-increment: li;
position: absolute;
left: -2.5em;
top: 50%;
margin-top: -1em;
background: #09f;
height: 2em;
width: 2em;
line-height: 2em;
text-align: center;
font-weight: bold;
}
.rectangle-list a:after {
position: absolute;
content: '';
border: .5em solid transparent;
left: -1em;
top: 50%;
margin-top: -.5em;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
.rectangle-list a:hover:after {
left: -.5em;
border-left-color: #09f;
}
MARKUP HTML<ol class="rectangle-list">
<li>
<a href="">List item 1</a>
</li>
<li>
<a href="">List item 2</a>
</li>
<li>
<a href="">List item 3</a>
<ol>
<li>
<a href="">List sub item 1</a>
</li>
<li>
<a href="">List sub item 2</a>
</li>
<li>
<a href="">List sub item 3</a>
</li>
</ol>
</li>
<li>
<a href="">List item 4</a>
</li>
<li>
<a href="">List item 5</a>
</li>
</ol>
Semoga bermanfaat :)
Happy list \m/

Tidak ada komentar:

Posting Komentar