• wplearner

    (@wordpresslearner)


    Hey, so I’m wondering what would be the best way to prevent a layout from breaking if a client inserts an oversized image in the sidebar.. For example, say we have a css rule:

    .sidebar{
    width: 300px;

    }

    Then the client puts an image of 2000px in a post, and they think the site is broken..

    Was thinking overflow hidden would solve the break, but they’d still think it’s “broken..” So I’m really thinking some kind of conditional, would nail it, but I don’t really know how I could write this..

    something like:

    on post load that includes an image..

    if(“image-width” > 300px;){make it smaller than 300px, or display a thumbnail..}

    any chance someone could write such a function?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I wouldn’t know about functions, but wouldn’t it be easier to include a max-width: 100%; max-height: auto; to re-size the image since they would still want to image to be in the sidebar?

    Thread Starter wplearner

    (@wordpresslearner)

    hey threesongbirds, yeah that might just do it. good thinking.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Best way to prevent oversized images in sidebar breaking layout’ is closed to new replies.