SharePoint固定的Footer

原文地址:http://www.eliostruyf.com/sticky-footer-solution-for-sharepoint-2013/

照搬全文:

OFFICE 365 & SHAREPOINT SEARCH / DEVELOPMENT / BRANDING

Sticky Footer Solution for SharePoint 2013

ON JAN 23, 2013 BY ELIO STRUYF WITH 52 COMMENTS
 

Footers and SharePoint that was the starting point of this blog. Back in August 2010, I blogged about how to create a sticky footer for your SharePoint 2010 sites (blog post can be found hereand here). Now it is time to upgrade this sticky footer solution to SharePoint 2013.

For this sticky footer solution you will only need to add some HTML and CSS markup to the master page html file.

If you used my solution from 2010, you will see that not much has changed.

Adding the HMTL Footer markup to the master page

  • Open the master page its HTML file in your favorite text editor (in this example I will use the seattle.html file);
  • Do a search for the s4-workspace DIV, and add a new wrapper DIV underneath it;
 
 
 
 
 
 

XHTML

 
1
2
<!-- =Wrapper -->
<div class="wrapper">
SharePoint固定的Footer

Wrapper DIV location

  • Go straight to the bottom of the HTML file and find the last DIV closing tag;
  • Replace the DIV's closing tag with the following code:
 
 
 
 
 
 

XHTML

 
1
2
3
4
5
6
7
8
    <!-- =Push is needed for the footer to be correctly placed on the page. ms-dialogHidden used to hide it in the dialogs. -->
    <div class="push ms-dialogHidden"></div>
  </div>
  <!-- =Footer: ms-dialogHidden used to hide it in the dialogs. -->
  <div class="footer ms-dialogHidden">
    <span>This is my SharePoint 2013 Footer</span>
  </div>
</div>
SharePoint固定的Footer

Footer HTML location

  • Save the file

Styling your footer

Now that you've added your HTML markup to the master page HTML file, we only need to style the footer.

The CSS markup looks like this:

 
 
 
 
 
 

CSS

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.wrapper {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  /* The bottom margin is the negative value of the footer's height */
  margin: 0 auto -30px;
  overflow: visible !important;
}
.footer, .push {
  /* .push must be the same height as .footer */
  height: 30px;
  /* Multicolumn Layout With Sticky Footer */
  clear: both;
}
.footer {
   background: #0072C6;
   color: #fff;
   line-height: 30px;
   text-align: center;
}
body #s4-workspace {
  margin-bottom: -30px;
}

I paced this CSS code for testing purposes in the following location: "/_layouts/15/images/tests/footer.css".

Sticky Footer Result

The result looks like this:

SharePoint固定的Footer

SharePoint 2013 Footer

SharePoint固定的Footer

SharePoint 2013 Footer Scrolling

JavaScript Solution

During the writing of this blog post Randy Drisgill posted his solution of adding a Sticky Footer via JavaScript. The blog post can be found here.

Download the files

Seattle With Sticky Footer

Footer CSS file

上一篇:使用SPM创建新组件


下一篇:C++ traits