In this task, you will use the Internet Explorer Developer Tools to view the source of a web page in your SharePoint site and identify the appropriate CSS style to override to set a new banner background image.
- Launch Internet Explorer.
- Navigate to your top-level SharePoint site, e.g., http://intranet.contoso.com.
- Press F12 to open the Developer Tools window.
If the Developer Tools open in a separate window, click the Pin button in the top right corner of the window to pin the tools to the bottom of the Internet Explorer window.
See that the source for the page has been loaded in the HTML tab of the Developer Tools window. Expand the nodes of the document tree to see the page structure.
Click on the CSS tab and open the dropdown. This shows you the different style sheets that have been loaded for the page including the main SharePoint style sheet, corev4.css. Selecting a style sheet in the dropdown will show the styles defined.
The Developer Tools allow you quickly find the page source that corresponds to the area you to click in the browser. The element hovered over by the mouse will be outlined in blue as you move the mouse and clicking will select the element and its source. To do this in the Developer Tools window, click Find >> Select Element by Click.
To identify the area that makes up the banner, in Internet Explorer, position your mouse to the left of the site logo and click when the blue box outlines the header banner area.
Note that the div element with the class s4-title in the HTML tab of the Developer Tools window is now selected. This div makes up the banner area that we want to restyle.
- Note that in the Style window you can see that the background url image is set to /_layouts/images/bgximg.png and that this style was defined in corev4.css. In the next exercise, you will override this style to set a new background image.
In this task, you will find the appropriate style to override to set a new background color for the left navigation and change the color using the IE Developer Tools.
In the Developer Tools window, enter “s4-leftpanel-content” into the Search HTML box and click the Search button.
The div element with the id s4-leftpanel-content will be selected in the HTML Tab of the Developer Tools window and the left navigation will be outlined in blue.
- See that the background-color is set to #fcfcfc in the Style window. The div is styled using the selector BODY #s4-leftpanel-content in corev4.css. You will override this style in the next exercise.
To experiment with modifying this style, click the value to right of the background-color in the Style window, change the value to #e8e8e8 and press Enter. This will change the background to be the gray we ultimately want.
This type of experimentation with styles will be helpful in determining what changes are needed. It will also improve productivity by quickly making changes without having to redeploy to see the results.