initialised the width property to 0 for transition to work