Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to show padding, margin, and borders while trying to debug

Status
Not open for further replies.

forumposters

Programmer
Aug 31, 2006
61
US
If i want to see where all the borders are on all my divs, tds, etc I can put this line in my css:

Code:
*{
	border: 1px;
	border-style: solid;
}

But, I'd like to see margins and padding as well... Is this possible?
 
Try using Firefox with the free Firebug extension and examine the layout tab in the console. When you are "inspecting" an element you can view the full css layout details that include the padding and margin details for the element.

Hope that helps,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
you could make a link of the following code to show borders on your divs.
Code:
javascript:void(t=document.getElementsByTagName("div"));for(i=0;i<t.length;i++){void(t[i].border="1")}
having a brain fart on what they're called:-(

Glen
 
thanks for that tip. i'm not sure how to apply it though. If I copy and paste that to the address box in my browse and hit return, it doesn't do anything.
 
Just a few changes and that should sort you out:
Code:
javascript:t=document.getElementsByTagName("div");for(i=0;i<t.length;i++){t[i].style.border="1px solid red"}

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top