Topic: Specifying css in custom module
Mysticle
avatar
Softmore
Softmore
Posts: 84

Posted:
19.Oct 2002 - 10:39

I've saved this until last on the module I'm writing.
Now, bear with me, this *is* my first module. :wink:

Seeing that all font tags, while in a module, don't affect the text (I do have the option of using font with tags turned on), how would I go about specifying a CSS file to be used by the module? Do I need to do this in the theme file? Or is it some type of include statement in my index.php for the module?

Thanks!

Joe
batpuppy
avatar
Posts: 611

Posted:
19.Oct 2002 - 11:15

Wouldn't the module just use the CSS of the theme that you are using?
Mysticle
avatar
Softmore
Softmore
Posts: 84

Posted:
19.Oct 2002 - 18:41

Yes with the Opentable and CloseTable parameters. The thing is, the module looks like hell with the fonts from my current theme CSS. And the site would look like hell if I updated the fonts just for the module. :)

I need the module to have a different CSS than the site.
batpuppy
avatar
Posts: 611

Posted:
19.Oct 2002 - 20:48

Well actually the CSS is called in the header. Opentable and Closetable just open and close a table with preset parameters. I don't know a lot about CSS but outside ones have to be called in the head of the page.
I don't think you can apply a seperate CSS to just part of the page and use another one for the rest? You could make a custom header for the page and change the CSS but that would affect the header and footer for that particular page also.
Mysticle
avatar
Softmore
Softmore
Posts: 84

Posted:
19.Oct 2002 - 21:57

Thanks BatP. I'll have to keep wracking my brain on it for a while then.
alarconcepts
avatar
Professional
Professional
Posts: 2723

Posted:
29.Jun 2004 - 03:47

Ok, yea, I know this post is 18 months old...but maybe someone will get some good from the solution.

Let's say that:

Code

TABLE
    {
        background-color: #FFFFFF;
                          color: #000000    // This one is the font.
    }


Ok...that's fine. Using the above TABLE style, every table that does not have a specific class defined for it, will display with the settings above. So, this following bit of HTML would produce a table with a black background and white text:

Code

<table width="100%" border="1">    //  NOTE: no class def. present in this tag.
    <tr>
        <td width="100%">
        This text will be white!
        </td>
    </tr>
</table>


Ok...I'm sure you've already got all that down pat...so now, if you want to have your modules table display differently, you will access your theme's CSS file, and add this: (for example)

Code

TABLE.myMod
    {
        background-color: #FF00FF;
                          color: #00FF00
    }


...and then save the CSS file back to the server. Now, you've got a *named* table style that you can use with your current theme. The newly styled table would be as follows:

Code

<table class="myMod" width="100%" border="1">    //  NOTE: class def. present.
    <tr>
        <td width="100%">
        This text will be flourescent green!
        </td>
    </tr>
</table>


This technique works on all HTML tags that support the class attribute.

CSS ROCKS!

Enjoy.

John