-
☆ A M B ☆
- 24,524 Posts
I know it’s possible to use a document to do CSS in, but I can’t find it now. Can somebody either point me to the relevant post, or explain how it’s done? I’ll make up a tutorial on doing the template complete with css and js files as documents as I do it.
-
MODX Staff
- 12,272 Posts
Thanks Susan. I think the way to do it is with custom doc types. Make one for a CSS file (text/css) and one for a JS file (text/javascript) and you’re good to go. Make sure they’re using the new blank template type and link to them the way you would a normal document -- [~cssID~] and [~jsID~].
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
☆ A M B ☆
- 24,524 Posts
So I would have in my template:
<link rel="stylesheet" type="text/css" href="[~cssID~]" />
I don’t care for using an embedded css @import statement in the header; is there an advantage to it that I’m not aware of?
(I’ll be trying this to see if it works, but your input would also be appreciated)
-
MODX Staff
- 12,272 Posts
That’s the right format, or should be. @import is a way to hide things from Netscape Navigator 4.x... hardly relevant at this point I’d think.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
MODX Staff
- 10,725 Posts
One advantage of using @import is to make your pages render without the stylesheet if the CSS implementation on the browser is so old not to recognize the @import statement (e.g. hiding from NN4 as Ryan said). One good use for this is to create fancy CSS additions in a separate CSS and import it so only the newer browsers that can handle it would ever see it.
I tried this using the CSS as a doc and using the ID as suggested but it appears the ID just creates the href= index.php vs the whole link is that suppose to happen ?
link rel="stylesheet" type="text/css" href="[~2~]" creates href=index.php
had to add the base url, seems like the only real advantage to using css as a doc is that it connects internally vs using external page
is there a difference between link rel="stylesheet" type="text/css" at the beginning or end of the url link ? I heard that one might be more preferred over the other
Quote from: bugsmi0 at Jun 07, 2006, 12:34 PM
is there a difference between link rel="stylesheet" type="text/css" at the beginning or end of the url link ? I heard that one might be more preferred over the other
It doesn’t matter what order the attributes of a tag are. Any tag.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Have a look at the page Settings tab when editing a document. You should see the content type options.
Using a document as a CSS stylesheet will allow you to generate dynamic style sheets. Meaning you and include Snippets and chunks inside the document.
Thank you, can we please delete this embarrasment?