Blot

Applying CSS to PDF embeds?

I'd like to change the width of PDF iframe embeds – would it be possible to add a class to these so I can target them?

Asked 4 years ago Edit
1 replies

You can target these PDF embeds with a CSS attribute selector. Let's say you have an embed that looks like this:

<iframe src="/files/example.pdf"></iframe>

You can target this and others like it in CSS like so:

iframe[src$=".pdf"] {
  width: 100px
}
4 years ago Edit

Your reply