Why the text dosen't apear on top | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
3rd Aug 2022, 8:47 AM
Varin
Varin - avatar
6 Answers
+ 2
PRO You first need to know about proper structure of html. In head section only limited tags can be use. Which tags are used to show content on the browser that tags should be inside body tag. I saw your last 4-5 code and in every code you are doing same mistake. In this code also you have written 'h1', 'p' tag inside 'head' section which should be inside 'body' section
3rd Aug 2022, 9:03 AM
A͢J
A͢J - avatar
+ 2
PRO Head section can contains only: 1 - title 2 - base 3 - link 4 - meta 5 - script 6 - style 7 - noscript
3rd Aug 2022, 9:08 AM
A͢J
A͢J - avatar
+ 2
It's because u used a large font size which adds extra padding to your work u have to position it.. on the body u should remove the extra spaces that are there by default body{ margin:0px; padding:0px; Box-sizing:border-box; } To position the text : Id{ Position:relative; top: -88px; }
4th Aug 2022, 8:04 PM
Okere Samuel
Okere Samuel - avatar
+ 1
PRO Yes because JS code loads first then html so you need to write js code inside window.onload function And also in one html content 'id' can't be same. To put text on top you need to add margin in minus because h1 tag takes some margin from top https://code.sololearn.com/WxRkV0fNwR0d/?ref=app
3rd Aug 2022, 9:20 AM
A͢J
A͢J - avatar
+ 1
A͢J i understand now thank you
3rd Aug 2022, 9:25 AM
Varin
Varin - avatar
0
I've just put them in the body tag and it says can't read properties of null
3rd Aug 2022, 9:13 AM
Varin
Varin - avatar