width detection and html tweaks