Friday, December 4, 2015

SharePoint - Responsive Design (Framework)

You can go to my previous post where I have explained how to implement responsive design in a SharePoint site using Bootstrap from scratch. Now we you will quickly figure out that implementing responsive design from scratch will take a lot of time, effort and learning. So in order to save time we will use a pre-built framework developed by a team of awesome people.

Perform following steps for SharePoint Online sites:
  1. Download the WSP.
  2. Follow page 17-22 of the documentation.
  3. And the site will look like this:



    Desktop
    Mobile
  4. Now after the site has been made responsive and works all great. You can download the Master Page foundation-4.3.2-server.master and customize according to your own branding. See pages 23-25 of the documentation.




Tuesday, December 1, 2015

SharePoint - Responsive Design (Bootstrap)

SharePoint Online pages are after all rendered as HTML/CSS and Java Script. In this post I will show how to create a responsive design for SharePoint Online pages using Bootstrap so that they look elegant on different screen sizes (Desktop, tablet, phone) .

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web. You can start learning about bootstrap here.

HTML Framework:
Following is the HTML framework that a HTML page should match in order to be responsive to multiple screen sizes.

<html lang="en">
  <head>
    <title>Bootstrap 101</title>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    
  </head>
  <body>
    
    <div class="container">
        <div class="row">
            <div class="col-sm-6" style="border:1px red solid">Hello</div>
            <div class="col-sm-6" style="border:1px green solid">World</div>
        </div>
    </div>
    
  </body>
</html>

This code will create 2 responsive divs inside a main container div. Container div will render the content inside the two divs as following on Desktop and the Mobile devices with the help of Bootstrap libraries:

Desktop
Mobile

Responsive SharePoint Page:
Now lets incorporate this framework in to a SharePoint Site.
  1. Add following lines in the head tag of Master Page:
  2. Add the container div in the page inside the PlaceHolderMain tag so that all the HTML of the page resides inside the container div:
  3. Add the row div and then add the column divs to hold the actual web parts:
  4. Now the web parts on the page will be managed by container div and page will look like this on different screens:


    Desktop
    Mobile