CSS for Modules


I'm using a custom index plugin and would like to add background image/color to the tob box (i've got 3 modules on my page: top box, lefthandside and right). Is there a way to do this?

From my code:

$mod_params = array('class' => 'elgg-module-highlight');


// Top box for login or welcome message <<<<<==== would like to add background here
if (elgg_is_logged_in()) {
$top_box = "<h2>" . elgg_echo("Hi") . " ";  

Appreciate your help... cheers



  • This seems to work, but the background shows for all modules... but I just need it particularly for the $top_box 

    .elgg-module-featured > .elgg-body {
    background: url(http://xxx) no-repeat right center;

    any help? thanks

  • Hi Bryan,

    Try this. Change the code in custom_index.php to:

    // Top box for login or welcome message
    if (elgg_is_logged_in()) {
        $top_box = "<h2>" . elgg_echo("welcome") . " ";
        $top_box .= elgg_get_logged_in_user_entity()->name;
        $top_box .= "</h2>";
    } else {
        $top_box = $vars['login'];
    echo elgg_view_module('featured2',  '', $top_box, $mod_params);

    (The only change is "featured2")

    Then the css would be:

    .elgg-module-featured2 {   




  • thanks, Jobo. actually fixed it before I read your post.. I had to add a separate module and css for the topbox and it worked like a charm...

    same as your suggestion, instead of featured2, I created topbox


Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking