08.08.2017 Views

designer

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating and Attaching CSS Files 341<br />

Inline styles override styles defined in style sheets and mean that you cannot restyle that<br />

part of your page without editing the page. The disadvantages of using inline styles are<br />

that they require more maintenance, are less flexible, and increase the size of the page.<br />

Use internal style sheets if you have a small style change for a page layout or a particular<br />

page. The styles are placed within the tags inside the tags at the top<br />

of a page. The disadvantages of using an internal style sheet are that they require more<br />

maintenance, are less flexible, and increase the size of the page.<br />

The preferred method of adding styles is to use an external style sheet. A CSS file is<br />

linked to a page. The link is placed in the section of the page, usually after the<br />

CSS Link SharePoint control. An external style sheet is easier to maintain, more flexible,<br />

and does not increase the size of your page.<br />

Tip An alternative to using an internal style sheet is to add a tag around the HTML or<br />

section to which you want to apply a specific look and feel. Assign the tag with a unique<br />

ID, and when you create styles in your style sheet, place that ID in front of the style. The only<br />

time the style is applied is when the browser sees a tag with that ID. Using this method,<br />

you can still have special styling for a particular page, retain ease of maintenance for the page,<br />

and keep the file size for your page manageable.<br />

By placing styles in a file, you can centrally manage those styles and apply the same<br />

styles to a number of pages. Both SharePoint Foundation and SharePoint Server make<br />

heavy use of styles that reside in files. You can create a new style sheet in the following<br />

ways:<br />

●●<br />

●●<br />

●●<br />

By using the Assets tab when you display the Site Assets library view in the<br />

workspace<br />

By using the Style tab<br />

In the New Style dialog box, which you can open from the Apply Styles and<br />

Manage Styles task panes and when you select Apply Style from the Target Rule list<br />

in the Style Application group<br />

When you create styles in a cascading style sheet file, you need to attach the file to a<br />

page to apply those styles to the page. Again SharePoint Designer provides you with<br />

many ways to complete this task. For example, you can use the Attach Style command<br />

on the Style tab, or you can use links in the Apply Styles and Manage Styles task panes.<br />

When you attach a file, tags are placed in the tags.<br />

In this exercise, you attach a cascading style sheet file to a page.<br />

SET UP Using SharePoint Designer, open the team site you used in the previous<br />

exercise if it is not already open. The settings page for the site should be displayed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!