/    Sign up×
Community /Pin to ProfileBookmark

Can I Embed CSS outside of the head tag?

I am working with a particularly stubborn database system for our ecommerce site, and have gotten a request from one of our marketing people to add some pre-made pages into our system. Unfortunately, they are built extensively around an external stylesheet that I have no way of putting into the database.

I would like to know if there is any way to define styles when you are working in the <body> tag, as I can’t use a <link href=””> tag or define a script in the head (everything above the body tag is generated by the server).

Is my only choice to rip apart the css stylesheet and rebuild the html from scratch?

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@macthewebAug 29.2007 — Some db driven systems like Website Baker get away with what you are proposing by placing a stylesheet in the body of a page. In theory it shouldn't work, but browsers seem to accept it. I wouldn't count on that being forward compatible, though.

I hate to propose this but iframes may be your best bet. Otherwise you are going to have to do inline CSS or, (gag) font tags. Or can you pretend the pages are in the system but just link to standalone html pages?
Copy linkTweet thisAlerts:
@IxianAug 29.2007 — If you can add a script that'll put the stylesheet link in the head that's the best possible way, otherwise putting it in the body could be second best (not really good, but easy to implement) as today's browsers will digest a lot of stuff they shouldn't. Otherwise mactheweb has the best advice on what to do.
Copy linkTweet thisAlerts:
@WakawakaauthorAug 29.2007 — Thanks guys, I'll look into iframes. I know I can't put the css in the body of the page, our db system doesn't like it (or anything else for that matter).

If that doesn't work, I guess it's back to the drawing board and <font> tags. Sigh.
×

Success!

Help @Wakawaka spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...