Styling without classes and IDs November 14, 2008
Posted by macfoto in General, Web Design.trackback
Sometimes you get into a situation where you you don’t have all of the control on the web page you would like. I had an image that I had attached to a page with Drupal. Unfortunately it didn’t have a class or ID associated with it for styling. I could have tried going into the theme, but I wanted to know if there were any other options that I could use in my stylesheet. I eventually found the answer was “attribute selectors” this allows you to use the attribute to identify the particular image or other element you need. ie img[src="http://www.example.com/imagefile.jpg"] {} One thing to note is that the URL has to be exact, http://www.example.com/imagefile.jpg will be treated differently than http://example.com/imagefile.jpg.
More info can be found in Eric Meyer’s article on attribute selectors.
Comments»
No comments yet — be the first.