Solved

CSS WIld Cards

Posted on 2016-09-26
2
43 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Asp in script 6 37
Use Images instead of radio button and get the checked value and pass it to a h2 tag 3 17
Ahax pagination 9 32
CSS Style Effect 2 7
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 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