Roman Byshko
Roman Byshko

Reputation: 9002

css style sheet and script in body. Possible?

I am a user of the content management system (TYPO3) that does not allow me to add something to the head of the html document. Is it possible to define a css style sheet and script in the body so that I do not duplicate corresponding styles and javascript everywhere in the html code that I add?

Upvotes: 2

Views: 881

Answers (3)

wsanville
wsanville

Reputation: 37516

Technically, it's not valid to place a style tag inside the body, but most, if not all browsers will actually implement it.

I've always been under the impression that a link tag should be inside the head according to the specs, but given a quick test, it looks like using a link tag inside the body validates as HTML 5, so that might be an option. See Alohci's comment about this below.

And yes, you can place a script tag inside your body.

Upvotes: 4

biesior
biesior

Reputation: 55798

Use Content Element of HTML type to do that with TYPO3 backend if there is no other possibility.

Of course as suggested in other answers you should not add CSS in the body, so maybe it will be just better to use inline styles for required elements?

<div style="color: red">title</div>

Upvotes: 0

Oriol
Oriol

Reputation: 288020

You can add a script in the <body>, but css should be in the <head>.

Major browsers recognize <style> in the <body>, but it's not valid.

Upvotes: 0

Related Questions