Hot answers tagged road
What you're trying to create is either a categorized or graduated symbology. This website walks you through it: http://qgis.spatialthoughts.com/2012/02/tutorial-styling-vector-data-in-qgis.html
This seems to potentially answer your question: https://github.com/bbecquet/Leaflet.PolylineDecorator I can't' comment on the appropriateness of the method... seems like a lot of code for a simple problem.
Only top voted, non community-wiki answers of a minimum length are eligible