Search code examples
htmlcsshardcoded

Connecting Hardcoded align right HTML with CSS


I have pictures inside articles hardcoded like this:

<img border="0" align="right" src="http://www.domain/picture.jpg" width="300" height="450">

I cannot change this line of code but would like to add CSS for this image (which is aligned right only), is there any way this could be done without changing other alignments? (if I would add CSS to img then it would also change for pictures which are aligned center etc.)

I hope someone has time to answer :)

Thanks!


Solution

  • you can use attribute selector

    img[align="right"] {
      // your css
    }
    

    The CSS attribute selector matches elements based on the presence or value of a given attribute.