Need help? Check out our Support site, then

Extra space before and after a gallery

  1. When I insert a gallery into my post, there are extra lines before and after my text. I am doing shift + enter for all returns. I can get rid of the extra lines before the gallery, but not after. I tried to press delete and backspace to remove the lines in Visual mode, but when I view the post, the extras space is still there.

    I’m not familiar with HTML editor, but if someone can tell me where to go and how to delete what’s necessary, or some other workaround, that would be great.

    My theme is twenty eleven.

    The post is in private mode so I’m not able to enter the url here.

    Note: I googled for this issue and came up with some solutions for, which is not useful as I have and I didn’t understand the coding they suggested.

    Thanks in advance!

    The blog I need help with is

  2. I have a hunch what's happening is that you're getting some extra nonbreaking spaces inserted into the posts.

    Go into your HTML view and look for extraneous instances of the following code:


    You can remove them pretty much at will. Conversely, if you want to force an extra line, adding one can be helpful too.

  3. Let's try this again. Look for the following code:


  4. hah, I haven't ever typed the character into the forum.


  5. If in the HTML Editor you aren't seeing those non-break spaces that jackiedana mentioned, it's quite possible that the extra space is coded into the theme's style sheet (CSS) for the Gallery feature. If so, you would have to purchase the Custom Design upgrade to tinker with the spacing and a working knowledge of CSS is recommended before upgrading.

  6. It might also be possible to tinker with the spacing in the HTML editor, but we can't tell that without a link to the post in question.

  7. I think it must be the theme, I don't see any extra spaces otherwise, I can live with it as is.

    Thank you.

  8. Hi everyone, well, I thought I could live with the extra space, but it just looks awful to me. I checked for the code " " under the HTML editor and didn't find any. I also noticed an extra line between my gallery and the first sentence where the white space occurs, so while in HTML (which is very new to me), I deleted the extra space. I also use shift+enter for all my hard returns. Those steps didn't worki.

    Here is the link:

    I am using twenty eleven theme. Can someone confirm if I do have to purchase the Custom Design upgrade? I'd like to know if there is a work-around, but I am not experienced with HTML.


  9. Sorry, I did include the link but it doesn't seem to be appearing?

    Here it is again:

  10. The extra space after a gallery is part of the default styling of the theme. You can counter it by enclosing the gallery in a div with negative bottom margin (in the HTML post editor):
    <div style="margin-bottom:-1.4em;">[gallery]</div>

    Change the number to adjust the space.

  11. Would you mind to explain it more for me, I am at a loss with HTML, codes, etc.
    You suggested to enclose the gallery with your code.

    Would I copy the code given before "gallery" and then the remaining after the "gallery"

    Thanks again

  12. If you switch the editor to HTML, you'll see this:

    Replace it with the code I gave above.

  13. It deleted a bit more of the white space. Thank you so much!
    I'll keep the code on hand for my next gallery inserts.

    Thanks also for explaining it in simpler terms for me!

    I'm curious, for those that are very new to codes and HTML, do they just keep a list of codes on hand (that they've found) and it's just knowing where to insert them?

  14. You're welcome.

    Yes, when you're a beginner you probably start with collecting useful bits of coding. But that's comparable to a phrase book with phrases of a language you don't speak: little by little you need to start understanding what each word means, and start understanding the grammar, till you get to the point where you can build your own phrases. This article of mine might help you get acquainted with the basics:

  15. Actually, bookmark that entire site. You'll be coming back to it often. :)

  16. I did, thanks again!

  17. I'm starting to think I need an upgrade! I currently have the twentyeleven theme.

    While the code for deleting some white space worked perfectly (thanks again justpi), when I insert multiple galleries (which I just learned by using the include/exclude codes), I'm getting the white space again.

    I can't delete [gallery] since I am now entering a different code all together, such as:

    Could someone tell me if I'm just stuck with extra white space while using multiple galleries in one post, if there is a workaround, or I'm asking too much (lol) and I'll have to look at an upgrade?

    Thanks again!

  18. I meant to add that I'm not able to add a link as my post is still in edit/private mode.

  19. This is the basic form of the gallery shortcode:

    It means insert a gallery here, with default settings ( = all the images that are attached to the post, thumbnail size, three columns).
    You can change the settings, by adding the appropriate commands inside the brackets. Examples:
    [gallery columns="2"]
    ( = insert a gallery here, but display the thumbnails in 2 columns instead of 3 )

    [gallery size="full" columns="1"]
    ( = insert a gallery here, but display full-size images in one column )

    [gallery exclude="1128,1130"]
    ( = insert a gallery here, but exclude those two images )

    But all these are just different versions of the same shortcode. So think of my code like this:

    <div style="margin-bottom:-1.6em;">

    By the way, having to find and use so many image ID numbers is a very tedious way to insert multiple galleries. After I see your post I can suggest alternatives. (Do you want the carousel slideshow that shows up when you click on gallery images or not?)

  20. Hi justpi, wow, thank you for taking the time to provide all those codes.

    I was so proud to learn the include/exclude code, but it is a pain! I have too many pictures and the hover feature to “see” the picture I.D. doesn’t work for me, I have to click on each image to get the I.D #, then sort them all out on a word document, edit the code and then insert.

    I tried uploading the second gallery in another published post to get the ID of that post and use it in the post I want with this:[gallery id="NUMBER_HERE"]. I found this method to be way easier, however, I’m left with several posts that are marked private, but I can see them on my homepage, which is an eyesore for me. I tried to google for a way to hide them from my view, but I don’t think there is.

    You mentioned the carousel, is that the same as the slideshow? I would like the pictures to show in columns. Yes, I would love to know some shortcuts!

    I just wanted to add that I’m grateful for your help, along with timethief and others. I’m slowly figuring things out .... and couldn’t have reached this far without the forum support members!

  21. Yes, the one possible alternative is the gallery ID trick. Instead of using private posts, you can use static pages (created in Pages > Add New). You don't need to make them private: you'll just create a custom menu in Appearance > Menus and add only Home and About to the menu.*
    This way your top menu will display only those two tabs, no matter how many other pages you publish, and no one (including you) will be able to see those other pages.
    *Details here:

    When you click on a gallery thumbnail you get a larger view of the image against a dark background, with previous/next arrows left and right: that's the gallery carousel slideshow. Do you want that or not? If not, there's a second alternative to using ID numbers.

  22. Yes, the gallery carousel is what I'm currently using and what I would want. Thanks for explaining it, I was confusing it with the slideshow option.

    I've printed off your link above to practice creating a static page (I knew there must be a way to hide private posts, but I certainly wouldn't know)!

    Please share with me the second alternative to using ID numbers.

    Thanks again!!

  23. Hi justpi,

    I realized your post “did” indicate the steps for creating a carousel already, using a static page. You’re right, the include/exclude workaround is ok, but very time consuming. I’m practicing with the static pages and how to hide them.

    Thanks again for all your assistance!

  24. You're welcome. Seems you're practicing successfully!

  25. justpi - just wanted to post back that the static pages worked like a charm!! Can't thank you enough!! I did read your instructions (first about the difference between menus/tabs) and when I was in the menus section, I just started playing around, trial and error and figured other things out as well, such as what happened to my "About" tab. It all made sense to me once I was in there.

    1. So, the static pages are always hidden on the left side because I only chose to drag "home and "about" to my menu bar, clicked saved, and that's it.
    2. Do a lot of bloggers choose static pages for this reason (as well as others), to create multiple galleries?
    3. Am I correct that when I created a new page and named it "Vacation," I then needed more pages, so I named each one Day 1, Day 2, but under "Page Attributes", I chose the Parent of "Vacation," to keep them organized?

    Thanks again, your time and assistance is much appreciated!

  26. sorry, forgot to add that I used my second blog as a test blog (tihmban is me, cravingthis).


Topic Closed

This topic has been closed to new replies.

About this Topic