Solved

CSS WIld Cards

Posted on 2016-09-26
2
35 Views
Last Modified: 2016-09-26
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.
0
Comment
Question by:Howard Bash
2 Comments
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 41816632
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

0
 
LVL 1

Author Closing Comment

by:Howard Bash
ID: 41816706
Just right.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now