What are Responsive Website Designs?

Responsive websites are designed to adjust and reformat their content to fit on any screen size, from a small phone all the way up to a giant TV. That means they look great on your iPhone and even better on your iPad.

This blog post will go over what responsive website designs are, why they’re useful for you as a site owner and for site visitors, some of the benefits of responsive web design, and how you can create one in just 7 easy steps!

Ready to start building? Turn back now if you have no idea what HTML or CSS is; this is going to be an in-depth tutorial that’s more practical than philosophical.

So What are Responsive Websites?

A responsive website is a website that looks good on any device; it adjusts its design to fit within a predetermined number of pixels. For example, a desktop version of your site can be 1024 pixels wide while the iPhone version is only 446 pixels wide. (Comodo was nice enough to point this out in their infographic, which I’ve also included in the link above. Great job!)

What’s important to note is that this specific device size doesn’t matter. You could have a desktop that looks great at 1280px and a phone version that’s 650px wide, and it would still be considered responsive.

Another thing to note is that this type of design isn’t new; websites have been adjusting their layouts and looks since the earliest web browsers became available. The difference with responsive designs is that you can now choose your own device size, so you don’t need to sacrifice functionality for aesthetics.

Responsive website designs are becoming more popular as more people view their work on mobile devices. In fact, nearly half of all searches are performed on a mobile device these days, and as a result sites like Facebook and Google have begun focusing on being mobile-friendly.

Part of Google’s mobile-friendly initiative centers around responsive designs. I’m sure you’ve noticed how the search bar changes when you’re on your phone. This is done through a responsive design, and it works by adapting to the screen size on your phone (or tablet).

Benefits of Responsive Web Design

The benefits of having a responsive website don’t stop at the aesthetics; there are a number of other features that come with this type of design. Here are some…

1. Your website will be available to more people

This is the obvious benefit, and it’s the main reason why responsive designs are so popular. If you have a site that’s not optimized for mobile, there’s a good chance that people will have a hard time reading your content. This creates an unnecessary barrier between you and your audience, and it won’t give them much incentive to stay on your site.

2. Your site will work on any device (desktop or mobile)

This is another obvious benefit; if you design an HTML5 website that works well on mobile devices, then you’re also designing it for larger laptops and desktops as well.

3. Your site will load faster on all devices

Mobile sites have the ability to load quicker because they don’t contain as much content as a desktop site. Not only that, but mobile sites are also less likely to contain third-party components and plug-ins. This is because these components require more space and memory, and they’re often not even necessary on mobile devices.

4. You can easily update your site with new content (and look) on any device

When you have a responsive design, updating your site is easier than ever before! Since the design adjusts to fit any screen size, you don’t need to worry about creating different versions of your content for every different device out there. All you need to do is keep your content organized and make sure it looks good on any of the leading devices.

5. Your website will be more responsive to search engine algorithms

Mobile websites are only going to become more popular over the years, and Google has already stated that responsive sites will be preferred over separate mobile versions or subdomains. While it’s not a requirement yet, it’s best to head into the future with a responsive design so that you can take advantage of this trend.

How to Build a Responsive Website in 7 Steps: A Tutorial

Here we go! We’re going to show you how easy it is to build your own mobile-friendly website in just 7 steps…

1. Create a responsive navigation menu using a CSS reset

A CSS reset is designed to make your site look good across multiple browsers. This is done by resetting any unnecessary styles and giving the site a clean and reliable foundation. You’ll also want to make sure to include useful information like the viewport (the width of your browser), the device type, and the screen size that you’re using.

Here’s how to create a CSS reset using a tool called Grunt: First, you need to install Node.js on your computer if it’s not already installed. Next, you need to create a folder called “grunt-npm.

Mac: ~/Documents/My Documents/Grunt-NPM

Windows: C:\Users\User\Documents\My Documents\Grunt-NPM

Then you need to go to your directory and clone the tool using the following command (which adds it to your directory). Windows: git clone –depth=1 https://github.com/gruntjs/grunt-init Mac: git clone –depth=1 https://github.com/gruntjs/grunt-init.git Then you need to open up a command prompt (on Windows) and navigate to your folder using the following command (and Once there, type “npm install” without quotes). Windows: cd grunt-init Mac: cd grunt-init Then you need to type “npm install” under the command prompt (not quotes). Mac: node_modules/grunt-cli/bin/grunt –config=path\to\gruntfile.js You may or may not get a message that the Grunt file is deprecated. If you do, just close the window and try again, but be sure to use the new version. If you don’t get a message, ignore this step. Now that your files have been properly set up, head over to your Gruntfile and add in this code: /* jshint node: true */ /* globals $, grunt */ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON(‘package.json’), /* Default Task */ default: `$sudo node_modules/grunt-contrib-connect/bin/node_modules/grunt-contrib-connect/lib/node_modules/.bin/*` }); /* Include the default task */ this.default($sudo node_modules/grunt-contrib-connect/.bin/*); }; The first few lines of code are the setup for our Gruntfile, and the rest is where we’re going to put in our CSS reset code. Save your file, then head over to the pkg folder where your package.json file should be. Open up the package.json file and add the following code: “main”: “dist/css/reset-min.js” Save your files, then return to your Gruntfile, and under the default function we created previously, type in this line: connect: { dist: { options: { base: ‘../dist’, src: [ ‘**/*.css’ ], dest: ‘../dist/’ } } } The connect option is a helper method provided by Grunt-Connect that allows you to automate some common tasks when using grunt to build a distribution (aka it will minify all of our css files). Save your file, then go back to the command line. Run grunt connect:dist . This will tell Grunt to build the dist folder we created at the root of our project with any of our CSS files in layout/ and partials/ that may have changed (we’re not building the dist folder yet, just making a note that it needs to be built). When you run this, you will get a lot of output from Grunt, but you will see one line that looks like this: Uglify-js 0.1.2 – a JavaScript minifier Then go back to your browser and refresh your site. If all goes well, your site should look exactly as it did before but using less css. If things are still messed up, you may need to run the build command again.

Step 2: Create a new index.html file in your project folder and replace all references to your old css files with references to your new minified css file. The way a browser sees JavaScript is directly inspired by CSS, so we have to make sure our JS files are referencing the right CSS files too. If you open up our index.html file in your project folder, you will see that it has references to three different CSS files. Here’s an excerpt from the first one: <link rel=”stylesheet” href=”/css/bootstrap/css/bootstrap.min.css”> <link rel=”stylesheet” href=”/css/bootstrap-theme.min.css”> <link rel=”stylesheet” href=”/css/style.min.css”> Change this to look like this: <link rel=”stylesheet” href=”./dist/responsive-bootstrap-theme.min.css”> Save your CSS files, then go back to your Gruntfile file, and under the default function we created previously, add the following line: connect: { dist: { options: { base: ‘../dist’, src: [ ‘**/*.min’ ], dest: ‘.././dist’ } } } When you run this, you will get output similar to the following: UglifyJS 2.4.11 – Compress JavaScript UglifyJS is a tool used by Grunt to minify our JavaScript files, so that they are smaller in size. Our CSS files are already minified, but it’s good to run it on our JS as well. When you go back to your browser and refresh your site again, you should see that everything worked!

Step 3: Create a new index.css file in your project folder and reference it in your index.html file. We will use this file as a place to house our entire CSS reset for the entire website. Create a new index.css file by right-clicking and creating a CSS File. Then add the following code to it: body { /* Reset */ font-size: 100%; } html, body { height: 100%; width: 100%; margin: 0; padding: 0; } Save the file, then open up your index.html page, and under the <head> tag where you have references to bootstrap and style.css, add another reference that will point to your newly created index.css file: <link rel=”stylesheet” href=”index.css”> Save your files and refresh your site in the browser. Everything should look exactly the same as before, so if that’s the case, you’re doing great!

Step 4: Create a new folder in your project called partials (and place the new CSS file we created there), and create a new index.html file inside of partials. The reason for this is we are going to be using this as our navigation bar, so we need to be able to add CSS elements to it. Create a new index.html file inside of partials by right-clicking and creating a HTML File. Then add the following code to it: <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”utf-8″> <meta name=”viewport” content=”initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width”> <!– Google Maps –> <script src=”/platform/js/maps/maps.min.js”></script> </head> This will create an HTML page with a sidebar we can use for our navigation bar. Save your file and open up your new partials folder (in the project root). Inside of this folder should be a new index.css file. Inside of this file, add the following code: /* Navigation Bar */ #navbar { text-align: center; margin-top: 20px; } Save your CSS files, then add a reference to this HTML page from your index.html file by adding the following code inside of the <body> tag where you would like your sidebar to appear: <body> <div id=”navbar”> <div class=”container”> <ul class=”nav nav-pills nav-stacked”> </ul> </div> </div> </body> Save your files, then refresh your site in the browser. It should look exactly as it did before, so if you’re good, this is the time to go back and change some of our other references in our CSS files.

Step 5: Create a new partials folder inside of partials and place your new HTML file there. This is where we will be storing all of our page templates that we use when creating individual pages for our website. Create a new partials folder by right-clicking and creating a New Folder… Then add the following code to it: index.html #partials/index.html Also, make sure that your new partials folder is positioned in the same location as your index.html page (otherwise you need to change the link to it). Save your file and add a reference to it from your index.html page in the <body> tag using the following code: <body> … <div id=”partials”> <div class=”container”> … <ul id=”navbar”> … </ul> </div> </div> </body> Save your files and refresh your site in the browser. It should look exactly the same as before, so if you’re good, this is the time to go back and add more HTML pages for each of our individual pages.

Step 6: Create a new partials folder inside of partials and place your newly created HTML page there. This is where we will be storing each of our individual website pages. Create a new partials folder by right-clicking and creating a New Folder… Then add the following code to it: index.html #partials/index.html Also, make sure that your new partials folder is positioned in the same location as your index.html page (otherwise you need to change the link to it). Save your file and add a reference to it from inside of your index.html page in the <body> tag using the following code: <body>… <div id=”partials”> <div class=”container”>… <ul id=”navbar”>… </ul> </div> </div> </body> Save your files and refresh your site in the browser. It should look exactly as it did before, so if you’re good, this is the time to go back and add more HTML pages for each of our individual pages.

Step 7: Create a new partials folder inside of partials and place your newly created HTML page there. This is where we will be storing each of our individual pages for our website. Create a new partials folder by right-clicking and creating a New Folder… Then add the following code to it: index.html #partials/index.html Also, make sure that your new partials folder is positioned in the same location as your index.html page (otherwise you need to change the link to it). Save your file and add a reference to it from inside of your index.html page in the <body> tag using the following code: <body>… <div id=”partials”> <div class=”container”>… <ul id=”navbar”>… </ul> </div> </div> </body> Save your files and refresh your site in the browser. It should look exactly as it did before, so if you’re good, this is the time to go back and add more HTML pages for each of our individual pages.

Step 8: Create a new partials folder inside of partials and place your newly created HTML page there. This is where we will be storing each of our individual pages for our website. Create a new partials folder by right-clicking and creating a New Folder… Then add the following code to it: index.html #partials/index.html Also, make sure that your new partials folder is positioned in the same location as your index.html page (otherwise you need to change the link to it).

Leave a comment

Your email address will not be published. Required fields are marked *