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

Simple HTML Problem

In this small example code, I wanted to create a shape and a simple line of text. The problem that I'm having is that the text is not showing up when it is below the shape. However, when it is written above the shape in the code, it works fine. Why is this? <html> <body> <svg width="1000" height="1000"> <rect width="200" height="200" x="100" y="100" fill="yellow" /> </svg> <p align="center"> Why does this not work? </p> </body> </html>

18th Jul 2017, 3:12 AM
Eheeiudj Jrnrrb
Eheeiudj Jrnrrb - avatar
4 Answers
+ 4
it's working the text is showing scroll down.
18th Jul 2017, 3:31 AM
Sumit
Sumit - avatar
+ 1
Well, I just messed around with the dimensions of the shape and realized why the text was so far down. Oh, and thanks
18th Jul 2017, 3:45 AM
Eheeiudj Jrnrrb
Eheeiudj Jrnrrb - avatar
0
End your numbers with "px" or "%", then instead of <p align="center"> try this. <p style="text-align:center;"> If that still doesn't work put the <p> in some <div></div> tags. Hope this helps and if you need more help or this doesn't work let me know!
18th Jul 2017, 3:34 AM
Mason
Mason - avatar
0
Oh awesome! Thought about that when I saw 1000px lol. But glad you fixed it!
18th Jul 2017, 3:47 AM
Mason
Mason - avatar