Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any use at all for code to go between </head> and <body>? [duplicate]

Tags:

html

I am just trying to clean up my code by removing any unwanted spaces and while doing so I was about to remove the gap between my </head> tag and my <body>

So it looks like this:

</head>
<body>

Instead of this:

</head>

<body>

but as I was about to do so I was wondering if there is any type of code that can benefit from being in between this space? or whether it's a no go area?

Or would it only be acceptable for leaving notes?

like image 895
SaturnsEye Avatar asked Nov 22 '25 18:11

SaturnsEye


1 Answers

It's not valid HTML markup to place any tags directly into the <html> element, except for <head>, <body> and comments.

As for the blank space, it makes no difference. Some people may argue it's more readable to separate them, due to the highly different purpose of both tags, but for parsing, there's no difference. Of course, you may save as much as 5 bytes in ASCII encoding (assuming you indent children of <body> with 4 spaces, that would be "space space space space newline"), but that is easily overlooked.

like image 167
Kroltan Avatar answered Nov 24 '25 08:11

Kroltan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!