Combining CSS

I have loaded the Community Theme by Social Apparatus on a site of mine. In duing so I am trying to get the same look for everything. I have found a few plug-ins that are not in the default CSS. I am wondering should I just combine the CSS from these plug-in's into the default one or should I just add a new folder under the theme for these plug-ins and copy & modify the CSS there?

 

  • Sometimes a plugin will include a separate css file not using the views - I know some of my earlier plugins do/did that simply because at the time I didn't know any better.

    These files are included after the default css using the metatags view, so they will always overwrite the default css unfortunately.

    Without modifying the offending plugins, the best option is probably to create your own external css file to include at the very bottom.

    In start.php, in the init function add:

    elgg_extend_view('metatags', '<theme_name>/metatags', 1000);

    create a file in the theme directory at /views/<theme_name>/metatags.php with the following content:

    <link rel="stylesheet" href="<?php echo $vars['url']; ?>mod/<theme_name>/css/style.css" type="text/css" />

    This will include your css file at the very bottom of the head section of the markup (assuming your theme is the lowest mod on the list.

     

    Another option is the liberal use of "!important" in your css.

    eg.

    div {

         background-color: #ffffff !important;

         padding: 5px !important;

    }

    You can define css in the default theme and anything tagged with !important will not get modified, unless the original author used !important too.

    I don't really recommend this though as it can make identifying the source of css styling very tricky to identify later on.