samedi 29 avril 2017

remove all CSS image style but keep html attributes (width and height)

i am storing html text in the database for example:

<p><img title="dasdasd" src="storage/posts/April2017/lKZCxXpP.jpg" alt="asdasd" width="100" height="100"/></p>

and then in another page i am displaying this text as html, consider it as a post body that need to be displayed with formatting.

the problem is that i am using a template that contain a lot of styling. in the style.css i have

img {  max-width: 100%;   height: auto;   width: 100%; }

its from the template styling and i cannot change this because it will mess up all my template.

the problem

the template styling is overriding the style of the image width ="100" height="100" that is stored with the html in the database, so i need the image to use the width and height that are provided by the creator of the post and stored in the database.

i already tried

height: unset;  width: unset;

but it will revert back the image to its original size not the one provided by the post creator.

is there anything i can do beside changing all the img style of themplate?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire