CAPITULO II. Marco teórico
IV. Vejez Exitosa y sus tres teorías
The easiest way to find the ribbon control on a master page is to simply search for the text “ribbon”. Easy, isn’t it? You will reach to the specific div tag with the ID s4-ribbonrow and contents under this division comprise and relate to the ribbon control. However, if you would like to know what the ribbon control is, it is tagged with <SharePoint:SPRibbon>, which is found under the same s4-ribbonrow div. Overall, the ribbon is encapsulated and its styles are controlled with many CSS files. We will discuss a few of them here, but for a designer or developer, the fastest way to learn how to modify a ribbon style on the fly is to play around using either Firefox Firebug or the Internet Explorer Developer tool bar. OK, let’s get to some internals now.
Primarily, SharePoint 2010 CSS files are all defined under the corev4.css file located in
{SharePointRoot}/_layouts/1033/Styles/Themable/. This file controls not just the ribbon but the entire look and feel of your web application.
■Note In
v4.master, you can find the
corev4.cssreference, as follows:
<SharePoint:CssLink runat="server" Version="4"/>
It’s virtually impossible to override all the classes in this file, hence you can only change those that are relevant to your design. What does that mean? The corev4.css file and your custom CSS file will coexist in your master page.and to override the corev4.css classes, you will have to make sure of couple of things.
First, you will have to register your custom CSS file using CssRegistration on the master page and make sure to set the After attribute to corev4.css. This will ensure that your custom CSS file is loaded after the corev4.css file, as shown in Listing 3-5.
Listing 3-5. Loading a Custom Style Class in the Master Page
<SharePoint:CssRegistration name="customstyle.css" After="corev4.css" runat="server"/>
Second, in your custom CSS file, wherever you are overriding core classes, make sure to use the !important override model for those classes. Now, as discussed earlier, ribbon control is under the div tag s4-ribbonrow, as shown in Listing 3-6.
Listing 3-6. Listing Ribbon Control Elements
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle"> <div id="s4-ribboncont"> <SharePoint:SPRibbon runat="server" PlaceholderElementId="RibbonContainer" CssFile=""> <SharePoint:SPRibbonPeripheralContent runat="server" Location="TabRowLeft" CssClass="ms-siteactionscontainer s4-notdlg">
<!-- Site Actions Content Goes Here -->
</SharePoint:SPRibbonPeripheralContent> <SharePoint:SPRibbonPeripheralContent runat="server" Location="TabRowRight" ID="RibbonTabRowRight" CssClass="s4-trc-container s4-notdlg">
CHAPTER 3 BRANDING AND DESIGN CHANGES
</SharePoint:SPRibbonPeripheralContent> </SharePoint:SPRibbon>
</div>
<div id="notificationArea" class="s4-noti">
<!— All Notifications Go Here -->
</div>
<asp:ContentPlaceHolder ID="SPNavigation" runat="server"> <SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Id="PublishingConsoleDelegate"> </SharePoint:DelegateControl> </asp:ContentPlaceHolder> <div id="WebPartAdderUpdatePanelContainer"> <asp:UpdatePanel ID="WebPartAdderUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server"> <ContentTemplate>
<WebPartPages:WebPartAdder ID="WebPartAdder" runat="server"/> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="WebPartAdder" /> </Triggers> </asp:UpdatePanel> </div> </div>
Table 3-6 shows the CSS elements around the ribbon; a detailed list is provided in Appendix C as well.
Table 3-6. Ribbon CSS Elements
CSS Class
Description
s4-ribbonrow Top div of the ribbon
s4-ribboncont Used to globally control the ribbon, such as its background ms-cui-groupSeparator Controls the ribbon separators
ms-cui-ribbonTopBars Controls the area around ribbon top tabs ms-cui-tt-s
ms-cui-tt-a Controls the styles for the ribbon selected tabs (Browse, Page, etc.) ms-cui-tabBody Controls the style for the selected tab body
ms-cui-cg-db ms-cui-cg-t ms-cui-cg-gr ms-cui-cg-s ms-cui-cg-t
Controls the text on the tab headers
ms-cui-cg-db
ms-cui-tt-a:hover Controls the text on the tabs and the anchor links ms-cui-cg-db ms-cui-cg-i ms-cui-cg-db ms-cui-cg-s ms-cui-cg-i ms-cui-cg-gr ms-cui-cg-s ms-cui-tt-a:hover ms-cui-cg-gr ms-cui-cg-s ms-cui-tt-s ms-cui-tt-a:hover
Controls the borders of the tab groups (Library Tools, etc) and subgroups (Documents, Library, etc.)
ms-cui-cg-db ms-cui-cg-s ms-cui-ct-ul
Controls the spaces between the menu items under a group
ms-cui-cg-db ms-cui-cg-s ms-cui-cg-t
Controls the background elements when a subitem is selected
ms-cui-cg-db ms-cui-ct-first ms-cui-tt-a ms-cui-cg-db ms-cui-ct-last ms-cui-tt-a
Controls the borders of the tabs
ms-cui-cg-db ms-cui-cg-s ms-cui-tt-a
Controls the submenu item background, text, etc.
ms-cui-cg-db ms-cui-cg-s ms-cui-tt-a:hover ms-cui-cg-gr ms-cui-tt-a:hover
Controls hover settings of submenu items
ms-cui-cg-gr
CHAPTER 3 BRANDING AND DESIGN CHANGES
ms-cui-tt-s ms-cui-tt-a
As mentioned earlier, not every CSS class needs to be overridden, you can verify your requirements, and based on them you can override, customize, or add custom CSS classes to define your new ribbon branding CSS file. This is all good and easy. Now, what do these changes mean to your existing master page migration and your already branded artifacts?