I am currently integrating new code into an existing WordPress theme. The section where the new code is placed is being affected by this line in the style sheet:
#content img {
height: auto; }
My code, which runs within a plugin/widget, interacts with thumbnail images and displays them within an img tag. Depending on the image size, I include either a height or width attribute in the tag (the width attribute functions correctly). However, the height attribute is being disregarded due to the height: auto declaration.
The smaller box within #content is identified as #CPGimage. I can override the height setting, but I need to determine the appropriate height value based on the image dimensions. For example, if the maximum desired width is 100 and the maximum desired height is 100, and the image size is 100x200, I would set the height attribute of the img tag to 100.
Is there a way to negate the height declaration under #content or somehow instruct it to obtain the height from the img tag?