Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: not2easy
and then let's say that I have another webpage that I want to also use this style information, but I don't want to write it out again... can I somehow link to, or import, the embedded style information from the first webpage?
<link rel='stylesheet' href='http://example.com/somepage.html' type='text/css' />
Now, to be acurate, this isn't exactly how I did it, since my site runs on php, but this is what the html output amounts to. Anyway, I'll check it later in straight html, just for my own curiousity, but this is working for me now.
Kind of a long story: I have a site that allows users to create their own sub-sites within the main site. Each user has a page named "style", which contains their embedded style information, which is automatically applied to all the pages in their sub-site. Each user also has a rich-text editor, which they can use to create pages on their sub-site. So I wanted the rich-text editor to use the style from their own site, so they would see what their page would actually look like as they were creating it - and since the style information is embedded into one of their other pages, and not an external css file, I needed the rich-text editor to link to the embedded style.
It is surprizing that that works, it was such a simple solution that I almost didn't even try it.
I wouldn't call this a technique to learn from....
Anyway interestingly enough I'm doing something similar to this on a site of my own (where I require embedded CSS per article, which sometimes extends to a multi page article, or gets displayed in a list along with other articles) - I did it through the CMS PHP code based on the article ID number
- in theory (and remember my PHP is not the best ;)) I created a unique variable based on the unique article number then used that variable to pull in the required CSS, via an if/else statement in the CMS code, I'm guessing this theory could be used to create a unique variable by user ID to do the same thing?
This is not really a css question (though I'm interested to see how/why your solution works) more a PHP one perhaps, your users can already store their own CSS you just need to find the cleanest way to store/retrieve the info based on your site programming