CSS diagnostics with XRAY and MRI

Several tools that help troubleshooting CSS are available. Some come with the browser, like the Web Inspector in Safari, while others are plugins or extensions, like Firebug or the Web Developer Extension.

There are occasions where you can’t or don’t want to install an extension though, and that’s where John Allsopp’s two bookmarklets XRAY and MRI come in handy.

XRAY lets you inspect the properties of any element on the page by opening a floating palette that displays the element type, id, class, position, size, border, margin, and padding of any element you click on. It also displays the element’s inheritance hierarchy.

MRI opens a similar floating window and has an input field where you can enter a CSS selector. When you click the MRI button, MRI highlights the elements on the page that are matched by the selector. MRI also works the other way around. Click anywhere on the page and it will suggest CSS selectors for the element you clicked on.

XRAY and MRI are obviously not as feature rich or advanced as extension-based tools, but they do have their use. The plan is also to make them work in all contemporary browsers, not just Firefox.

John writes a bit more about the bookmarklets in Introducing XRAY for your browser and Introducing MRI.

Posted on October 30, 2007 in Browsers, CSS


  1. October 31, 2007 by hcabbos

    Awesome tool. Thanks for pointing it out.

  2. I am sure most of your readers are hip to MacRabbit’s CSSEdit.

    It is the best for tracking down those mystery styles!

  3. I still worship Firefox’s webdeveloper addin, both for the css edit and outlines / display element information functions.

    And Mike, I’ve looked at CSSEdit and it looks amazing, apart from me not having access to a mac… :)

  4. Sure, lovely bookmarklets…

    For Firefox I still prefer firebug and webdeveloper plugins, but I think that the power of these bookmarklets will be the cross-browser functionality.

  5. October 31, 2007 by Martin

    just FYI: the above comment (by sam g.) is most likely spam. I saw a very similar comment on TechDirt earlier.

    On-topic: Yeah, those are very nice tools indeed :D

  6. Nice. Thanks Roger. I grabbed Xray.

  7. I really like CSSViewer which is a Firefox extension.

  8. I’ve been using Aardvark for FF for a long time. I don’t know how I’d get along without it!

  9. November 4, 2007 by Jeeves

    I find Allan Jardine’s Grid to another winner. And unlike the above, it actually works in Opera.

  10. If these bookmarklets worked in IE, they’d be pretty helpful. For Firefox, you just can’t beat Firebug :)

  11. Those 2 are very very helpful especially in IE!

    It simply rocks!


Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.