While working on my HTML form, I encountered an issue regarding the display of a warning message notifying users about the caps lock being on. Currently, the warning is shown correctly in a div located to the right of the text box. However, this div's presence causes the page layout to shift due to occupying space.
I'm seeking a way to have the warning message appear as a notification cloud or tooltip instead. Is there a method involving z-index adjustments or other techniques that can achieve this effect when detecting caps lock?