The MU forums have moved to WordPress.org

Can I pad things globally? (9 posts)

  1. willeffects
    Member
    Posted 17 years ago #

    I am using the plugin:
    http://wpmudevorg.wordpress.com/project/MU-Admin-Bar as suggested in my last post (thanks for that!). But it requires me to put a margin of 28px on every theme to not have the bar overlay the theme. Is there a way to add this margin into one file and pad all the themes at once?

    Thanks,
    Will

  2. lunabyte
    Member
    Posted 17 years ago #

    Maybe add a function in the plugin which inserts a style tag, where you put a margin-top of 28px on the body, then add an action call for wp_head? Or something like that.

    Don't know if it would work, but it's worth a try.

  3. willeffects
    Member
    Posted 17 years ago #

    This is why two heads are always better then one!

    That worked perfectly. that should definitly be the default for this plugin instead of editing each theme as the author suggests.

    Thanks

  4. lunabyte
    Member
    Posted 17 years ago #

    I'd check it to make sure in IE and FF though, to be safe.

    You'd be surprised sometimes at the "simple" crap IE pukes on.

  5. corourke
    Member
    Posted 17 years ago #

    When in doubt use parent > child selectors in your css. It makes the CSS still validate but neatly sidesteps the issue of IE being moronic.

    So for the admin bar css you'd go:

    .styletag {
    margin: 28px 0 0 0;
    }
    body > .styletag {
    margin: 28px 0 0 0;
    }

    The first line would be followed by IE 6 and IE 5+ would ignore the second rule.
    Firefox on the other hand would use the second rule since .styletag is a child of the body.
    I have so much vehement hatred for the MS IE team. Of course all this is rather hopeful anyways since Firefox renders pages differently based on platform (well worth it to get ubuntu live or something to check your css in linux firefox just in case).

  6. lunabyte
    Member
    Posted 17 years ago #

    Personally, I prefer to target IE with conditional comments, vice css hacks. Mainly to keep everything in one place, and be able to stick in an addition for 6, or 7 (yes, 7 still has lots of issues).

    Then, when one needs to change or be removed, they're all there in one nice little package.

  7. jaredbangs
    Member
    Posted 17 years ago #

    I agree with lunabyte; conditional comments really are the way to go.

    In addition to the ease of maintenance and the ability to target specific browser versions with different styles, all while remaining valid, you also get forward compatibility. That is to say when IE does eventually get around to fixing their support for selectors, you won't have to go back and fork your code again, you can just keep applying the alternate style to only those versions lower than the most recent.

  8. ColinFilmJournal
    Member
    Posted 17 years ago #

    willeffects - could you post the function here as I'm thinking of including the admin bar soon

  9. suleiman
    Member
    Posted 17 years ago #

    I saw this thread and thought I would point you to the MyCSS hack which I made for MU. It's part of the "Signup Badge" widget on my personal blog. MyCSS is basically a way of setting global CSS in all the themes. The hack I produced is set so that the MyCSS item only displays under the Presentation menu if the Site Admin is logged in.

    You can get it here: http://suleiman.hadithuna.com/wpmu/

About this Topic

  • Started 17 years ago by willeffects
  • Latest reply from suleiman