M
Michiel van der Blonk
Hi,
This might be more interesting to people interested in CSS, but
anyway....
The FF and IE toolbars both do a terrific job with the DOM explorer and
being able to outline almost anything, except... margins.
I have created a javascript solution that outlines elements' margins
when you click on them. Though this has some drawbacks (e.g. links
cannot show their margin) it has been an invaluable resource in CSS
development. I have no monetary gains/goals here, and just want the
best tools for everyone. So my tool is GPL, and should stay that way,
and hopefully someone can cooperate. Let me get some feedback from
everyone.
Now, I do realize that margins are intrinsically different from all
other visible properties, since they are 'not really there'. They are
simply invisible areas.
Here is the general idea of the solution:
- create a new element on top of the target using positioning
- give it padding in the same amount as the margin of the target
- give it a background-color
Some problems I encountered in earlier versions that I had to fix:
- The first version used position:relative. This is problematic since
it has to be a child-element of the target node. Some tags just cannot
have child elements, like e.g. <img> and <input>.
- Setting CSS properties through a style sheet didn't work, so I
reverted to using inline styles for everything.
I am using the Yahoo User Interface library.
You can see it in action here: http://vanderblonk.com/css/tools/mr/
It's quite hard to make this work cross-browser, since positioning is
not implemented the same way in all browsers. I have tested in FF and
IE only upto now.
Michiel
This might be more interesting to people interested in CSS, but
anyway....
The FF and IE toolbars both do a terrific job with the DOM explorer and
being able to outline almost anything, except... margins.
I have created a javascript solution that outlines elements' margins
when you click on them. Though this has some drawbacks (e.g. links
cannot show their margin) it has been an invaluable resource in CSS
development. I have no monetary gains/goals here, and just want the
best tools for everyone. So my tool is GPL, and should stay that way,
and hopefully someone can cooperate. Let me get some feedback from
everyone.
Now, I do realize that margins are intrinsically different from all
other visible properties, since they are 'not really there'. They are
simply invisible areas.
Here is the general idea of the solution:
- create a new element on top of the target using positioning
- give it padding in the same amount as the margin of the target
- give it a background-color
Some problems I encountered in earlier versions that I had to fix:
- The first version used position:relative. This is problematic since
it has to be a child-element of the target node. Some tags just cannot
have child elements, like e.g. <img> and <input>.
- Setting CSS properties through a style sheet didn't work, so I
reverted to using inline styles for everything.
I am using the Yahoo User Interface library.
You can see it in action here: http://vanderblonk.com/css/tools/mr/
It's quite hard to make this work cross-browser, since positioning is
not implemented the same way in all browsers. I have tested in FF and
IE only upto now.
Michiel