CSS WIld Cards

I need to select a DIV to add a padding-top to and it's id is dynamic.  I know that it will end with _TopNavigationMenu, but the prefix seems random and so I need to have a wildcard to select it in a style sheet.

In this case the searched for string is part of an id.  But in other cases I have to do similar where the searched string is part of a class name.  

In jQuery it would be something like this for the id search: $('div[id$="TopNavigationMenu"]').attr('style','padding-top:10px') .  Again though,  I need to do this in CSS and would appreciate a variation if the value was in a class also.
Howard BashSenior Software EngineerAsked:
Who is Participating?
Terry WoodsConnect With a Mentor IT GuruCommented:
There's a similar way of doing it with CSS3 apparently:
div[id$=“_TopNavigationMenu”] {
  padding-top: 10px;
div[class$=“_TopNavigationMenu”] {
  padding-top: 10px;

Open in new window

Howard BashSenior Software EngineerAuthor Commented:
Just right.
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.