• ryan-nobby

    (@ryan-nobby)


    Hi,

    I have just noticed that some of my galleries have #gallery-1 and other have #gallery-2 or even #gallery-3. What is generating these? Is there any way of stating which gallery has which as each have different styles?

    Many Thanks,
    Ryan

Viewing 10 replies - 1 through 10 (of 10 total)
  • ThemeSumo

    (@themesumo)

    Can you provide a link to your site please so I can inspect further as they just look like identifiers, which shouldn’t be applying different styles.

    Thanks.

    Thread Starter ryan-nobby

    (@ryan-nobby)

    Sorry, the site is currently set as private as it is under construction. What causes the galleries to each have different identifiers?

    Thanks.

    ThemeSumo

    (@themesumo)

    Are you using a plugin for your galleries, my default WP galleries don’t appear to have the same ID information?

    They’re simply used to identify each gallery so they don’t have the same ID’s, which would be invalid code. Usually, they won’t have styles applied to these identifiers, but without being able to check out your site’s code it’s hard to say for certain.

    Thread Starter ryan-nobby

    (@ryan-nobby)

    Can I send you a link privately so you could have a quick look, please?

    As with regards to different styles, I have had to add CSS for each gallery number to keep them looking the same.

    Many Thanks.

    ThemeSumo

    (@themesumo)

    In that case, you can use a wildcard in your CSS to target all galeries, instead of targeting each individual gallery, like so:

    [id*='gallery-'] {
        /* styles here */
    }

    This should fix the issue.

    • This reply was modified 8 years ago by ThemeSumo.
    Thread Starter ryan-nobby

    (@ryan-nobby)

    How do I add a ‘wildcard’ to CSS?

    This is my current CSS for the galleries:

    #gallery-2 img {
    border:2px solid #F5F5F5 !important;
    }

    #gallery-3 img {
    border:2px solid #F5F5F5 !important;
    }

    #gallery-4 img {
    border:2px solid #F5F5F5 !important;
    }

    Thanks.

    ThemeSumo

    (@themesumo)

    [id*='gallery-'] img {
        border: 2px solid #f5f5f5 !important;
    }

    Hope this helps.

    Thread Starter ryan-nobby

    (@ryan-nobby)

    Perfect – Thank you! Do you know why certain galleries would have different identifiers?

    Many thanks.

    ThemeSumo

    (@themesumo)

    If each gallery had the same ID then it would be invalid code (it wouldn’t be broken though), you would also struggle to target individual galleries (if you needed to), I’m surprised that each gallery has different styles being applied though, are you just using the default WP galleries?

    Thread Starter ryan-nobby

    (@ryan-nobby)

    Yes, the standard WP Gallery. Not to worry, it’s all looking how it should be now, thanks for your help. Much appreciated.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘What is causing my WP galleries to have different styles?’ is closed to new replies.