Skip to content

Setting default max-width and height for img tag  #506

@mvdnbrk

Description

@mvdnbrk

Pull request #426 sets height to auto in combination with a default value of max-width to 100% to the img tag.

This gives unexpected results.
See Codepen.

Loading a 100x200px image fills up the whole space although I am setting width and height specifically.

@adevade mentioned code from Bootsrap, but this is meant for a fluid image with class name image-fluid.

I took a look at the source code of BeardCSS.
BeardCSS is setting only a max-width of 100%, if width or height attributes are set they will be respected by resetting max-width to none on the img tag.

I think we should take the BeardCSS approach.

Example of same code as above with the BeardCSS approach gives the expected result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions