开发者

Can one declare a css file directly in an html element? [duplicate]

This question already has answers here: 开发者_运维百科 Closed 11 years ago.

Possible Duplicates:

Is adding CSS rules outside the Header possible?

Declare CSS style outside the “HEAD” element of an “HTML” page ?

I'm working on a CMS which doesn't permit me to edit the CSS, nor do I have access to the head to add a link to my own CSS file.

I do however have access to certain html zones of the website and would like to declare my CSS link inline with the HTML for each element.

The reason: I'm building a "garage door" with CSS3 Transitions and therefore it's important that I can declare the ID and style in my html directly.

So how would one declare a CSS file inline with the html? Here's what I've come up with, but I'm clearly missing something.

"ul id="garagedoor": href="http://linktothefile/garagedoor.css"

I realize it's entirely counter-intuitive to declare the css inline with the html, but I see no other way of getting this to work.

Thanks guys


I'm working on a CMS which doesn't permit me to edit the CSS

Then either:

  1. It is a really awful CMS and should be replaced or
  2. You don't have the authority to add CSS to the site (but someone else does and you need to talk to them)

Can one declare a css file directly in an html element?

The only place that <link> or <style> elements are allowed is the <head>, although browsers will error recover from them being elsewhere.

style attributes are allowed on most elements, but are bad practise.

"ul id="garagedoor": href="http://linktothefile/garagedoor.css"

That doesn't even resemble HTML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜