Site logo

[Resolved] Custom class to image

Home Forums Support [Resolved] Custom class to image

Home Forums Support Custom class to image

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1754970
    Henk

    Hi,

    I want to add the following custom class to one of my images:

    img {
       padding: 10px;
       border: 4px solid #ffffff;
       background-color:#F0F5F9;
    }
    

    The problem is, this is only working when I use IMG. But when I add a custom class (because I want it to be applied on one image only) it’s not working. Under advanced –> Additional CSS class(es) I have added my custom class. But then the custom class is applied to the container, and not to the image.

    What am I doing wrong?

    #1755225
    David
    Staff
    Customer Support

    Hi there,

    img is the elements tag – so it will apply to all images.
    Instead you would create your own custom class eg.

    .img-has-border {
       padding: 10px;
       border: 4px solid #ffffff;
       background-color:#F0F5F9;
    }

    Then add the Additional CSS Class to your block of: img-has-border

    #1755240
    Henk

    Hi David,

    That is the problem, that does not work. When I do that, I get a border around my div instead of around my image.

    I now have: is-style-rounded img-has-border
    – is-style-rounded for the round image
    – img-has-border for the border

    See my website adress in the private information field.

    #1755356
    David
    Staff
    Customer Support

    Update your CSS to this:

    .img-has-border img {
       padding: 10px;
       border: 4px solid #ffffff;
       background-color:#F0F5F9;
    }

    This will target the img that is inside the <div class="img-has-border">

    #1757160
    Henk

    Thanks David!

    #1757273
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.