• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

100% Width, But Apply Margins To Certain Elements

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › 100% Width, But Apply Margins To Certain Elements

This topic is: not resolved

Tagged: 100%, class, css, structure, Width, wrap

  • This topic has 4 replies, 3 voices, and was last updated 9 years, 1 month ago by handsun.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • December 27, 2016 at 6:17 am #198262
    Porter
    Participant

    I want the vast majority of my site to be 100% width in design, so given that's the greatest common denominator, I changed my CSS to look like so:

    .site-inner,
    .wrap {
    	margin: 0 auto;
    	max-width: 100%;
    }

    That's great, everything is 100%, easy enough. Now I want various elements (fewer than not) to have a margin so that they're indented like a "normal" non-100% width site. I wrote a class called "common-margin", which applies this. What I'm stuck on, is how to "apply" or "inject" that class to say my header, x, and y.

    Furthermore, if there's a better way to accomplish this, I'm all ears.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    December 27, 2016 at 6:42 am #198265
    Christoph
    Member

    Hi,

    you could use the genesis_attr_ filter http://wpbeaches.com/adding-attribute-html-section-genesis/
    or jQuery / vanilla Javascript to add the class.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    December 27, 2016 at 6:49 am #198266
    Porter
    Participant

    Neat, that looks like it will do the trick - thanks!

    Do you know off-hand if there's any way to supply an array for the target element to filter? Rather than target just "genesis_attr_site-header", supply an array that contains that, as well as a few others. Not a big deal if I have to copy / paste a few lines, but if an array is accepted, or I can come up with something clever using a for loop, that would be neat 😀


    Buy me a beer? | Try DigitalOcean VPS Hosting

    December 27, 2016 at 7:09 am #198273
    Christoph
    Member

    Good idea. 🙂
    I'd try a foreach loop.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    January 4, 2017 at 8:57 am #198746
    handsun
    Participant

    Hi Porter, I am trying to reach you for php work (you helped me last year) , can you respond to this post and we can find a way to connect, I clicked your Buy Me A Beer link and sent you an email but have not heard back, Carin


    Clean affordable water by Kinetico

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble