Checkout the HTML and css bindings, they should be able to do exactly what you need: http://knockoutjs.com/documentation/html-binding.html