-1

So, I have this code

<div id="timer"> </div> 

How can I centrate this in HTML5? I tried but as far I as know, it's obsolete for HTML5 and I must use CSS Any help?

Anderson
  • 1
  • 2

2 Answers2

1

You can't (or, more specifically, shouldn't) do any kind of styling in HTML, that's what the CSS exists for.

The text-align property could be a beginning.

Here is a great source of information : https://www.w3schools.com/css/

  • Oh Matte', io ti ho solo chiesto come faccio a centrare quel porc'iddio di codice, non lezioni sul css :-) – Anderson Apr 02 '19 at 12:38
1

You can achieve this by using Flexbox. Try below code snippet it'll help you out. Thanks

#parent {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
<div id="parent">
  <div id="timer">Timer</div> 
</div>
Hassan Siddiqui
  • 2,799
  • 1
  • 13
  • 22