update width and margin