css selector for tag whose id starts with

If i have an html tag like this:

<iframe id="MyIframe" width="100%" height="808px"></iframe>

I can apply some CSS to it my it's id like this:

        #MyIframe {
            overflow-x: scroll;
        }


If I have some tags like this on my page:

<iframe id="MyIframe83039434303" width="100%" height="808px"></iframe>
<iframe id="MyIframe83039dfdfd3" width="100%" height="808px"></iframe>
<iframe id="DifferentIframe83039dfdf34" width="100%" height="808px"></iframe>

Is there a way to apply the following css, to only the tags whose id starts with MyIframe

        #?? {
            overflow-x: scroll;
        }
LVL 1
maqskywalkerAsked:
Who is Participating?
 
Russ SuterCommented:
You should be able to do it like this:
frame[id^="MyIframe"]
{
 ...
}

Open in new window

This works fine for classes. I haven't tried it with id though
0
 
maqskywalkerAuthor Commented:
cool.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.