Browser Developing Tools

From Dreamwidth Notes
Revision as of 19:29, 23 April 2011 by Foxfirefey (Talk | contribs)

Jump to: navigation, search

This page describes helpful in-browser development tools to help you learn, develop, and debug with HTML and CSS.

They do this in general by:

  • Letting you hover over elements and view the section of HTML it is hovering over
  • Showing the CSS rules that are applying to a particular element
  • Letting you edit the HTML and CSS on the fly to test out a certain effect without the overhead of saving the file to the server

They have more advanced uses, but these are the ones this tutorial focuses on.

Firefox

Firebug

Firebug is an extension that has many tools for web development.

To start the Firebug extension in the window you are in, go to Tools->Firebug->Open Firebug. The browser window should now show the Firebug interface at the bottom of the page.

Inspecting HTML

You'll want to be in the HTML tab. (When you look at the top of the Firebug interface, there is a list like Console, HTML, CSS, etc. If HTML isn't highlighted, click on it.)

This will show the HTML page as a set of collapse-able and expandable nesting tags. There is a button with an arrow over a box whose title is "Click an element in the page to inspect it" that can help you find the element you want on the HTML source. You can also click on elements in the HTML display to select them instead.

Inspecting the CSS applied to an element

The right pane of the Firebug interface should be on the "Style" tab. When using the "click an element in the page to inspect it" feature or clicking the element inside of the HTML inspector, you select that element.

CSS rules that apply to that element will then be displayed in the style tab.

Editing the CSS

You can make simple editing changes to rules in the style tab on the right side of the interface for a selected element; you can only add or tweak rules to existing selectors though. To tweak a rule, click on the part of the rule you want to tweak--the name or value. To add a rule, click on the value of the last rule and press enter or tab; it will give you a blank box below the other rules. Type in the name and press enter, tab, or ":" to then get the box to enter the value portion of the rule.

To make more overaching changes, go to the "CSS" tab of the Firebug interface, find the stylesheet you want to make changes to, and click the "Edit" button. You'll then be able to type anywhere in the original stylesheet and see the changes happen.

Remember that changes made in this interface will NOT be saved! In order for them to actually show up as a permanent change, you will need to add them in some other way.

Web Developer

The Web Developer Toolbar is a lighter tool than Firebug for helping web developers.

Inspecting HTML

Information->Display Element Information will let you explore the different attributes of elements you hover over and then click.

Information->Display Id & Class Details will show all of the items with classes and IDs on the page.

Inspecting the CSS applied to an element

This also requires that the DOM Inspector extension is installed. If it is, you will see a "View Style Information" in the CSS menu of the toolbar. Use it and click on an element--the top of the page will show what element would currently be selected.

A pane should open in the browser with the rules that apply to the element you clicked on.

Editing the CSS

Use the CSS->Edit CSS menu option. You can edit the stylesheets and then press the green arrowed "Apply" button at the top of the interface to see your changes. If you want to revert, click the blue arrowed "Reset All" button.

Remember that changes made in this interface will NOT be saved! In order for them to actually show up as a permanent change, you will need to add them in some other way.

Chrome

To open up the developer interface in Chrome, use this menu item: View -> Developer -> Developer Tools

Inspecting HTML

You'll want to be in the Elements tab. (When you look at the top of the Chrom developer interface, there is a list like Elements, Resources, Network, etc. If Elements isn't highlighted, click on it.)

This will show the HTML page as a set of collapse-able and expandable nesting tags. There is a button at the bottom of the interface with a magnifying glass whose title is "Select an element in the page to inspect it." that can help you find the element you want on the HTML source by hovering over the page and clicking. You can also click on elements in the elements display to select them instead.

Inspecting the CSS applied to an element

The right pane of the Chrome Developer interface should have the "Styles" section expanded. When using the "Select an element in the page to inspect it" feature or clicking the element inside of the elements inspector, you select that element.

CSS rules that apply to that element will then be displayed in the styles section of that pane.

Editing the CSS

You can make editing changes to rules in the Styles section on the right side of the interface for a selected element. To tweak a rule, double click on the part of the rule you want to tweak--the name or value. To add a rule to a selector, double click on the value of the last rule and press enter or tab; it will give you a blank box below the other rules. Type in the name and press enter, tab, or ":" to then get the box to enter the value portion of the rule.

To add a selector, find the gear button on the right side of the Styles section heading. Click to open the menu and select "New Style Rule". You can then edit your new rule.

Remember that changes made in this interface will NOT be saved! In order for them to actually show up as a permanent change, you will need to add them in some other way.

IE

Tools -> Developer Tools or F12

Safari

If the Develop menu does not appear in the menu bar, open Safari preferences, click Advanced, and select "Show Develop menu in menu bar".

To open up the developer interface in Safari, use this menu item: Develop -> Show Web Inspector

Inspecting HTML

You'll want to be in the Elements tab. (When you look at the top of the Safari developer interface, there is a list like Elements, Resources, Scripts, etc. If Elements isn't highlighted, click on it.)

This will show the HTML page as a set of collapse-able and expandable nesting tags. There is a button at the bottom of the interface with a magnifying glass whose title is "Select an element in the page to inspect it." that can help you find the element you want on the HTML source by hovering over the page and clicking. You can also click on elements in the elements display to select them instead.

Inspecting the CSS applied to an element

The right pane of the Chrome Developer interface should have the "Styles" section expanded. When using the "Select an element in the page to inspect it" feature or clicking the element inside of the elements inspector, you select that element.

CSS rules that apply to that element will then be displayed in the styles section of that pane.

Editing the CSS

You can make editing changes to rules in the Styles section on the right side of the interface for a selected element. To tweak a rule, double click on the part of the rule you want to tweak--the name or value or selector. To add a rule to a selector, double click on the value of the last rule and press enter or tab; it will give you a blank box below the other rules. Type in the name and press enter, tab, or ":" to then get the box to enter the value portion of the rule.

To add a selector, find the gear button on the right side of the Styles section heading. Click to open the menu and select "New Style Rule". You can then edit your new rule.

Remember that changes made in this interface will NOT be saved! In order for them to actually show up as a permanent change, you will need to add them in some other way.

Opera

Dragonfly