Re: CSS back into HTML
by halley (Prior) on Mar 17, 2004 at 16:50 UTC
|
Sounds like an ugly task.
(1) HTML cannot express all formatting which CSS can express.
(2) The output is now hardwired to mix content and presentation. I hope you're not throwing away the clean content files.
Can you accept style="..." in your HTML tags? Those are still CSS, but without the dependence on external style sheet files.
If you can accept that, you can probably just accept a <style>...</style> ahead of the body. That should be trivial to piece together. You just replace each stylesheet reference with a style tag.
-- [ e d @ h a l l e y . c c ]
| [reply] [d/l] [select] |
Re: CSS back into HTML
by derby (Abbot) on Mar 17, 2004 at 16:51 UTC
|
so that CSS files ... are not required anymore
Out of curiosity, why do you want to do this. From my readings and observations, having the CSS in a seperate file is a big plus. The CSS file will be cached by the browser. The caching can result in significant bandwidth savings. I would be interested in hearing the reasons for bringing it back into the HTML file.
Thanks.
| [reply] |
|
Another few advantages are centralized presentation definitions -- make a change in one place to update the entire site. importing CSS to the html source seems very very silly to me.
| [reply] |
|
I'm not sure I'm interpretting you correctly, but if you're trying to put styling back into the HTML tags, you're not going to be able to keep the browser-specific stuff.
Can you give us more information about what your end goal is? There's always more than one way to do it.
| [reply] |
Re: CSS back into HTML
by kutsu (Priest) on Mar 17, 2004 at 17:32 UTC
|
If you still can use CSS, just not external, you can embed the style sheet in the head tag.
<HEAD>
<STYLE TYPE="text/css" MEDIA=screen>
<!--
BODY { background: url(foo.gif) red; color: black }
P EM { background: yellow; color: black }
.note { margin-left: 5em; margin-right: 5em }
-->
</STYLE>
</HEAD>
html help has more information on how to do that.
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce
| [reply] [d/l] |
Re: CSS back into HTML
by CloneArmyCommander (Friar) on Mar 17, 2004 at 17:21 UTC
|
It really would be more beneficial for you to keep the external CSS file. It saves so much more time when you want to make a quick update on the appearance of your site. Also, unless I have misunderstood what you are trying to do, CSS is what you will want to stick to if you would like to conform to XHTML standards, because most of the formatting tags (such as the bold, italic, underline, and center tags to name a few) have been dpreciated. | [reply] |
Re: CSS back into HTML
by Willard B. Trophy (Hermit) on Mar 17, 2004 at 17:20 UTC
|
Unless you are having to support Netscape 4, CSS should be identical for all browsers. Since older browsers constitute less than 1% of the traffic to my sites, I've forgotten all about the browser wars.
It sounds like you are being asked to do this from above. Now would be a very good idea to suggest some of the strategies put forward by Jeffrey Zeldman on designing with web standards.
If you are using HTML as a machine-readable data format, how will any presentational style information be used?
-- bowling trophy thieves, die!
| [reply] |
|
| [reply] |
Re: CSS back into HTML
by kutsu (Priest) on Mar 21, 2004 at 22:13 UTC
|
After reading your second Update, I wonder if you might be able to use Html::Template, or are using it. If that's so you might look at Re: HTML::Template Tutorial which shows how to include css with Html::Template, the second working on older browsers because of the comments.
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce
| [reply] |
Re: CSS back into HTML
by inman (Curate) on Mar 18, 2004 at 11:52 UTC
|
Macromedia Dreamweaver 3 had an option for doing this. I don't have it installed right now so I can't tell you more but the option was there to allow you to produce code for non CSS compliant browsers.
| [reply] |