How can I correct the horizontal line extending beyond the border?