Thursday, September 28, 2023
HomeCSSjavascript - Time String Overlapping

javascript – Time String Overlapping


I have actually been attempting to produce a timer as well as for that I made use of toLocaleTimeString(). I obtained the string however the string is overlapping while providing on the display. I attempted to alter the dimension of the message as well as margin too, however it really did not functioned.

I attempted to alter the font-size as well as margin of the container. I obtained the moment string utilizing the code:

 feature Application() {
allow time = brand-new Day(). toLocaleTimeString();.
allow [currTime, getNewTime] = useState( time);.

feature getTime() {
time = brand-new Day(). toLocaleTimeString();.
getNewTime( time);.
}

setInterval( getTime, 1000);.

return (.
<< div className=" container">
<> < h1> > {currTime} <.
<< switch onClick= {getTime} >> Obtain Time<.
<.
);.
}

CSS:

 h1 {
font-size: 100px;.
}

. container {
margin: 60% automobile;.
}

I would like to know just how can I conquer this string overlapping trouble without transforming time right into 24 hr layout.

RELATED ARTICLES

Most Popular

Recent Comments