WordPress.org

Ready to get started?Download WordPress

Forums

How do I change margins in css--Mantra Theme? (5 posts)

  1. leirose
    Member
    Posted 8 months ago #

    I want to add more white space around the text in my Mantra theme website. How can I change the margins--i.e. adding 30px on left and right? I've never worked with the css in a WordPress theme, and I'm hesitant to play around with it for fear of messing it up. Any advice for me?

  2. Thimothe
    Member
    Posted 8 months ago #

    Hi,

    It is relatively safe to change css as long as you keep track of what you are changing and knowing where to change it. If mantra has an option for custom css, your changes should be made there. If it doesn't, you should either use a custom css plugin or make a child theme and make your changes there.

    An other thing which will be really useful is the built in Developer Tools in Chrome or Firebug. These tools will let you inspect your code and see change css on the fly.

    To change the margins, you'll need to target your element either through its class or its id. If you provide a link to your site, I'll be able to tell you what they are. You can find that info by right clicking on the element in your page and choosing Inspect. Classes are targeted in CSS with a period in front of the class name (ex: .this-class) and id which are unique are targeted with a sharp symbol (ex: #this-unique-id).

    In the end, if your content is being displayed in a div with id "content", your code would look like this

    #content {
    margin-left: 30px;
    margin-right:3 30px;
    // You could also use the shorthand margin: 0 30px; to change top and bottom margin to 0 and left and right to 30px
    }

    And be placed in a custom css location.

    I hope this helps you getting started with CSS.

  3. leirose
    Member
    Posted 8 months ago #

    Thanks so much for your help. I'll try this, and if I'm stuck, count on my sending you my link!

  4. leirose
    Member
    Posted 8 months ago #

    Well, I tried... but I messed it up. I lost whatever white space I had on the left.
    If you could give me any more specific advice by looking at the site, I'd be VERY grateful! It's: leilarosen.net

  5. Thimothe
    Member
    Posted 8 months ago #

    Hi,

    there seems to be a good amount of white space on both sides of your content. You wish to add more or the issue has been resolved?

    Do you want the padding to be applied only to the content or to the header and the content?

Reply

You must log in to post.

About this Topic