HTML CSS center a paragraph | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HTML CSS center a paragraph

<div> <p id="clock"></p> <p id="time"></p> </div> I have two paragraphs. The first one (analog clock) has a fixed position on my page. I'd like to fix the second one (containing digital clock representation of the clock that is above) below the analog clock. The length of the text is changing, so I would like to center it between side margins so that its horizontal center matches the above clock's center. How should I do that? Thanks in advance.

23rd Sep 2018, 2:58 PM
Steppenwolf
Steppenwolf - avatar
3 Answers
+ 1
Any way we can see the full code (or the relevant part) in a link to your Code Playground project? I noticed that you are showing empty elements.
23rd Sep 2018, 3:30 PM
Janning⭐
Janning⭐ - avatar
0
Perhaps this is what you look for using relative position in parent with absolute position in child element. https://code.sololearn.com/WHi6fGqcSGlJ/?ref=app
23rd Sep 2018, 3:46 PM
Calviղ
Calviղ - avatar
0
could you post your code here?
23rd Sep 2018, 3:52 PM
Ulisses Cruz
Ulisses Cruz - avatar