1

I created a custom block with Full HTML format selected using the following code:

<img src="myimage.jpg" atl="myimage" width="xx" height="yy" />

However, Drupal seems to always display the image at it's actual size. Is there a way to achieve this in a block?

1 Answer 1

2

Is that everything that's in your block? I've tried to replicate this and it works fine for me.

Have you tried setting your CSS in the appropriate css file instead of adding it inline? Like:

#block-id-title img {
   height: 100px; 
   width: 100px;
}

Or, try inspecting that img element in firebug or equivalent, and see how the css is being rendered. You might have a css styling set for all img tags which is unintentionally overriding your block image.

3
  • I am wondering if the theme has anything to do with it. I am using the zen theme. The width and height attributes don't work, but it seems inline styling does change the dimensions. I guess I was so caught up with why the attributes didn't work that I forgot to try css.
    – macj7
    Sep 22, 2015 at 14:30
  • Zen theme has a barebones structure to it so I would be surprised if it had css styling that was messing with your images. Did your developer console reveal anything when you inspected the img element?
    – Bryden
    Sep 22, 2015 at 16:42
  • No, it didn't reveal anything unusual. Except that the width and height attribute of the <img> was shown as being the same width and height as the actual image regardless of what I changed it to.
    – macj7
    Sep 22, 2015 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.