fixing css class application and height/width calculation