In css is it posible to use as a selector part of the id? That is: Select if the ID contains the let


Cal Who

Is it possible in css to use as a selector something that means:

Select if the ID contains the letters dp1

That is, only give part of the id string on the element?

Thanks in advance



Nathan Sokalski

No, it isn't possible, since the ID selector is exact match, but since you
are posting this to an ASP.NET group, I am assuming your page is an ASP.NET
page, so why can't you just create a class selector and then set the class
attribute or CssClass Property? What is your exact scenario? Sometimes using
combinations of different types of selectors can be useful, such as
combining the Descendant, Class, ID, and Exact Attribute Value selectors. If
you let us know how you are creating the elements (static or generated by
ASP.NET) and what the basic layout of the elements is we may be able to make
some better suggestions as to what selectors to use and how to add the style
rules to your page (static or generated by ASP.NET). Good Luck!



Cal Who

I am using a UserControl (I think that's what it is called, made in a .ascx

The id is dp1 but when I inspected the element in the source the ID was.

I couldn't get the style I asked for and was therefore looking for another
way to select besides the ID.

The selector contained an anchor descendent and I probably specified it

I'm not sure what was wrong but your suggestion to use a class worked for