• Hi!

    I want to add a background behind all of my images.

    But there is different image sizes.

    First I thought I could add backgorund-image to the img tag in CSS, but if there are more than one size, I got problem.

    My second thought was to add a pictur with different sizes to all pciture size.

    How can I do to add a background-image and deside which size of the picture I will use I would use (in CSS)

    Thanks ??

Viewing 6 replies - 16 through 21 (of 21 total)
  • @webbhelp

    To answer your question: if you want different backgrounds for various image sizes, you have to either:

    • give every image size a different class, so you can style them differently in your stylesheet (=giving them different backgrounds)
    • embed your image in 4 divs, to specify the corner images of your frame, and fill the rest with some repeating image. This is a popular technique for creating boxes with rounded corners

    Anything else will be very difficult to implement, if you’re not familiar with the stuff.

    Peter

    Thread Starter webbhelp

    (@webbhelp)

    Exactly what I want to do.

    But to do it, is the hardest thing I think is:

    How to add a class to the image different sizes… I very new to WP but I’m good at CSS…

    So… how can I add a class for the different image with different sizes…?

    I cant add corners because I need to add ID/classes before and after the IMG tag then…

    Please I really need to get this work ??

    I think I found something for you: this article.

    Just one question: why don’t you resize all images to a specific size and put your border around that one size?

    Peter

    Thread Starter webbhelp

    (@webbhelp)

    Because the blogg is already “running” so… the image that already have been added…

    That was bad english I think…

    I mean, the author that has write blogposts already, have also add picture, how can I resize them (to good quality)

    Either I like that idea to only use one IMG size… but isn’t that to late, or?

    how can I resize them (to good quality)

    in your css:

    img {
      height: auto;
      width: 400px;
    }

    assuming the images all have the same ratio. If not, you could alter the height parameter to a specific amount of pixels, however you will find the images with a different ratio look distorted.

    Peter

    Thread Starter webbhelp

    (@webbhelp)

    Ok, Thanks!

    That’s a good solution, sad to say that the quality cant’ be 100%

    But. it’s a good solution…

    If I want perfect quality I need to use JavaScript to add classes for each image with different sizes…

    Thanks a lot for replying ??

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Picture background many sizes’ is closed to new replies.