Alex Rivera | Logout

Handling a colon in an element ID in a CSS selector

Asked 2008-09-23T16:47:20.453
167

JSF is setting the ID of an input field to search_form:expression. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something?

input#search_form:expression {
  ///...
}
Edit
Report

1 Answer

4

I had the same problem with colons, and I was unable to change them (couldn't access the code outputing colons) and I wanted to fetch them with CSS3 selectors with jQuery.

I put it here, cause it might be helpful for someone

input[id="something:something"] worked fine in jQuery selectors, and it might work in stylesheets as well (might have browser issues)

answered 2010-02-09T11:42:09.840

Your Answer