[Support request] Unwanted padding around images

Home Forums Support [Support request] Unwanted padding around images

Home Forums Support Unwanted padding around images

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #1018833
    Tom
    Lead Developer
    Lead Developer

    Hmm, doesn’t make much sense – the Layout Element does the same thing that the individual sidebar layout option does. Super strange.

    What if you do this?:

    add_action( 'wp', function() {
        global $content_width;
    
        $content_width = 980;
    }, 20 );
    #1018900
    Alexander

    That fixes it for galleries and attachment pages. Everything else looks normal too. Could there be any unwanted side effects? πŸ˜›

    Single captioned images are still 10 pixels too small (970 pixels instead of 980, which makes them a bit soft).
    For example https://www.alex-kunz.com/oh-mockingbird/

    (the fix for that one you gave me in https://generatepress.com/forums/topic/unwanted-padding-around-images/#post-1014672 works but disconnects the caption text itself from the image; ie. the image is centered then – as it should – but the caption text becomes left-aligned)

    Thanks for your continued help
    Alex.

    #1019153
    Tom
    Lead Developer
    Lead Developer

    Shouldn’t be any side effects.

    And this doesn’t remove the need for that CSS?: https://generatepress.com/forums/topic/unwanted-padding-around-images/#post-1014084

    #1019221
    Alexander

    No the remove_filter snippet didn’t and doesn’t change anything, unfortunately.

    I left the CSS fix you gave me in https://generatepress.com/forums/topic/unwanted-padding-around-images/#post-1014672 active so you can see how figcaption gets “disconnected” from the photo’s alignment: https://www.alex-kunz.com/oh-mockingbird/

    Thanks
    Alex.

    #1019774
    Tom
    Lead Developer
    Lead Developer

    Try this instead:

    figure.wp-caption {
        width: auto !important;
        max-width: 980px;
    }
    #1019809
    Alexander

    Thanks Tom πŸ™‚

    I’m beginning to fear that I’ll drive you nuts and that I appear to be too picky – but this solution would limit the width of the image as well.

    Sorry if I wasn’t cleared to begin with: I don’t want to limit *ALL* images to 980 pixels width – I just want them to be shown at the size that I defined as “large” without scaling (when the 980 pixels wide version gets scaled down by just a couple of pixels, to 960 or 970 in my case, it doesn’t appear as crisp – on a photography site, these details matter).

    A size of ~1000 pixels width is a good compromise to fit the entire photo on a smaller screen in its entirety – say on an iPad in horizontal orientation (it’s actually too wide already for phones, but I found that people rarely rotate their phones to horizontal).

    Now if I have a panorama, or other photo that is using an aspect ratio wider than 3:2 (ie. not as high), I’ll want to be able to show it wider than 980 pixels, to fill larger screens with more of the photo.

    So in addition to your original CSS fix, I added CSS to make the caption-text center-aligned instead – which actually matches the center-aligned caption of photos in a gallery, so it’s visually more consistent too. I should’ve thought of that sooner.

    .wp-caption .wp-caption-text {
        text-align: center;
    }

    (and for the attachment pages, I created a new class .wp-att-caption-text where I left-align the text)

    I hope you don’t mind me saying this, but perhaps you can get to the bottom of why a “large” captioned image is reduced by 10 pixels in width. If that’s beyond what you can do right now via the support forum I understand. Maybe something for the to-do list in the next theme update? πŸ™‚

    Thanks again
    Alex.

    #1020068
    Tom
    Lead Developer
    Lead Developer

    I’ll definitely dig into this before our next theme update. We’ve tried disabling everything the theme might do to adjust the figure width, but hopefully, I find something.

    Luckily, the image block in Gutenberg no longer uses weird inline widths like this, so it shouldn’t be an issue in the future (unless you continue to use the Classic Editor).

    #1020146
    Alexander

    I’m still on team Classic Editor, and for the foreseeable future too I guess… πŸ˜›

    (from a user perspective who writes simple posts with images, Gutenberg is a click-orgy that just makes me nervous – it’s completely over the top for my everyday usage, constantly gets in the way of simply getting things done, and I’m sure I sound like a cranky old man now!;-))

    #1020576
    Tom
    Lead Developer
    Lead Developer

    I get it πŸ™‚

    It should become more and more usable as time goes on I’d think.

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.