GithubHelp home page GithubHelp logo

better-css-lists's Introduction

Better-CSS-Lists

Get more control over your ordered and unordered lists without needing extra images or http requests.

Using HTML5 Data Attributes & CSS Pseudo Content, we can render out anything here as the list item marker. HTML character codes work beautifully, so do Unicode characters (if proper headers are sent). This is also great for appending commas or periods to each list item, as you see fit.

Works swimmingly in modern browsers, as well as IE8 and up. Also, this is naturally resolution independent, thus it'll look great on any screen.

It's very simple to use; just something like this will work for the markup:

<ol>
  <li>Wes anderson cred vegam</li>
</ol>
<ul>
  <li data-item="&hearts;">Wes anderson cred vegam</li>
</ul>

And for the CSS:

li {
  list-style:none;
  position:relative;
  counter-increment:this; /** name the counter **/
}
li:before {
  content:attr(data-item); /** or whatever you name your data-attribute **/
  position:absolute;
  left:0;
  top:.2em;
  font-size:80%;
  color:white;
  /** this is arbitrary for my design, but you get the idea **/
}
ol li:before {
 content:'(' counter(this) ')'; /** call the counter you named **/
}

You'll need to tweak things here and there of course, but you get the concept.

better-css-lists's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.