photos in css | XM Community
Skip to main content
Hello. When using css, what is the best way to add photos and to address them by css?
Hello @Brosen ,



Hope the following will help you:



We can add photos using `<img>` tag in HTML as follows:

`<img id="imgID" class="imgClass" src="IMAGE_URL" />`



We can refer the `<img>` tag in the css in the following ways:

1. Using Tag -> `img{ //css attributes }`

2. Using id -> ` #imgID{ //css attributes }`

3. Using class -> ` .imgClass{ //css attributes }`



Two or more `<img> `tag can have same class name but different ID name.

The best way is to assingn different ID to different `<img>` tag(if they are several) and target each of them using id, allowing you to add different css property to different `<img>` tag
Thanks!

Leave a Reply