Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

#61990 closed enhancement (worksforme)

Target media library svg images

Reported by: neo2k23's profile neo2k23 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

Is it possible to add a class to the images that has the file extension of the image in the media library when viewing the image in the admin area?

This way we can write css to target f.e. all .svg images to go full size when viewing them in the admin area.

It is simply not possible now to target images by css in the admin area it always applies to all images.

so we get

<img class="details-image svg" src="https://mywebsite.com/wp-content/uploads/2022/11/Process.svg" draggable="false" alt="">

Thank you

Change History (3)

#1 @skithund
5 weeks ago

You could target them with CSS attribute selectors.

.details-image[src$=".svg"] {
  border: 1px solid red;
}

#2 @neo2k23
5 weeks ago

@skithund thank you that did the trick.

#3 @sabernhardt
5 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
  • Version trunk deleted

Thanks for confirming that the CSS attribute selector works for you.

Note: See TracTickets for help on using tickets.