Code monkey says what?

dark_fanboy's picture

< head > < style type="text/css" >

al1 {color: #0000CC}
hd1 {color: #CC0000}

< /style > < /head >

The code above I'm trying to plug into one of my guides, I know the code works because I've tested it on the whiteboard on Am I missing something, or does a style sheet inside of an HTML code inside of a BBcode not work?

*brain melts on keyboard*


Quick thoughts

Each web page is only allowed a single HEAD tag which must be the first tag on the page, the STYLE tag can only be embedded within the HEAD tag.

Since this HEAD tag is pre-generated by the website and you can not overwrite it what you are trying to do should not be possible. It is also generally a bad idea to try to override the style of the site as it defeats the entire purpose of having a single stylesheet.

Part of the benefits of having that is so that all the guides on the site have a single consistent look and feel and that should Jame decide that tomorrow he wants all headings to be red instead of blue he just has to change it in one place and every page on the site will update automatically to the new style. This makes the content of the site appear much more cohesive than it would otherwise appear if every guide author defined their own custom stylesheets.

dark_fanboy's picture

Thought as much, but I like

Thought as much, but I like to drive myself crazy figuring silly things like that out.

Don't be famous, be infamous

Don't be famous, be infamous

Tag's picture

You can use inline styles.

You can use inline styles. They don't have to be in the head of the document. Just use the style attribute.

Here's the pseudo-code:

<htmltag style="cssproperty1: value; cssproperty2: value;"> </htmltag>

Just make sure to follow all normal css rules and never use quotation marks (for example when defining background images) => " <= except when closing your attribute.

Inline CSS actualy has the highest priority of any CSS (above external and internal CSS) so using inline will over-ride the existing defined style.

I'm not sure its a good idea to define your own styles, but that's how you do it without access to the head of a document.

Tag. Smiling

dark_fanboy's picture

Could you provide a generic

Could you provide a generic example of the code and demonstration? This might be noteworthy for the guide creation section.

Don't be famous, be infamous

Don't be famous, be infamous