Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

responsive website

Featured Replies

I'm wanting to make my website responsive.

I know there are a few downloads like Bootstrap etc. But I don't know how it all works when I integrate it into my website.

I basicly want the website to work with phones.

 

Anyone know any tutorials for to make websites responsive?

Yes, stay away from Bootstrap. Code it yourself and feel like you've achieved something!

 

Responsive design is simple in principle.

 

1.Design a site to scale in Photoshop using a 960 grid or design the mobile version first and work towards the desktop version.

2.Code your website as usual. (Using HTML5 Bolier Plate with Modernizr)

3.Convert all your widths from pixels to percent.

4.Add media queries to target your device sizes.

5.Test, test, test.

 

You can learn from tuts, as posted above, but I prefer to work with books (still). I'd recommend this one 'Responsive Web Design with HTML5 and CSS3 by Ben Frain.

Just want to add a little something before I get shot down...

 

When converting your width in pixels to percent you have to do it relatively. So if your container/wrapper is 960px wide and contains a div that is 500px wide they would become 100%(container) and 52.0833333%(div) wide.

 

Here is the math: 500/960=0.52083333 --> multiply by 100 = 52.0833333% (just do it all in the calculator, I know there are more 3's in the final answer).

 

As long as you apply this rule you'll be ok. If something is not quite right then you can inspect it in the browser.

 

I final tip is to NOT round you percent. Always put the full number displayed in the calculator and let the browser do the rest.

Edited by OliverB

/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

 

All you’ve got to do is to fill the blanks

Just want to add a little something before I get shot down...

 

When converting your width in pixels to percent you have to do it relatively. So if your container/wrapper is 960px wide and contains a div that is 500px wide they would become 100%(container) and 52.0833333%(div) wide.

 

Here is the math: 500/960=0.52083333 --> multiply by 100 = 52.0833333% (just do it all in the calculator, I know there are more 3's in the final answer).

 

As long as you apply this rule you'll be ok. If something is not quite right then you can inspect it in the browser.

 

I final tip is to NOT round you percent. Always put the full number displayed in the calculator and let the browser do the rest.

Just a shameless plug. I created an Air app just for this purpose as well as calculating ems. You can get it at http://cibgraphics.com/projects/responsive-calculator

 

It's free by the way

Hi Vulcan,

 

Fill in the blanks means add your CSS here /* Styles */. So the CSS that is specific to the device you're targeting in placed between the brackets.

 

@media only screen

and (min-device-width : 320px)
and (max-device-width : 480px) {
#div1 {

width: 100%;

height: 200px;

}

#div2 {

width: 100%;

height: 200px;

}

}

 

You want to include your media queries at the bottom of your CSS file. Or you could create a separate one, but then it's another request by the website.

Edited by OliverB

  • Author

Okay, So do I create CSS for each device?

I don't want the website to be fluid, the largest size is 980px.

 

Also how do I convert px into %? I have a container inside that is content div and a side bar.

1.Yes you create a media queries for each device but it doesn't have to be everything. For example;

 

/* Desktop CSS */

#div {

width: 980px;

height: 500px;

background: #ffffff;

{

 

/* Device CSS */

@media only screen

and (min-device-width : 320px)
and (max-device-width : 480px) {
#div {

height: 1000px;

}

}

This means that when viewed on a device, that fits the device width criteria, it will have the same width and background colour as on the desktop, but it will use the height specified in the media query. Sometimes when making you site fit onto a mobile device you will delete elements/content that isn't really needed. You can hide by applying the following;

#deviceDiv {

display:none;

}

2. If you don't want a fluid site then you don't need to convert to percent. The only difference between a fixed width and fluid site is what happens when you resize the browser window on the desktop. If you have it as a fixed width as you resize your browser the content will snap into place once a media query is satisfied. If you have a fluid site then as you resize your browser window the content will move/decrease in size to the next media query.

You basically apply a media query when the website breaks. So if you resize your browser window and realise that your navigation is displaying incorrectly at 768px wide, you apply a media query to fix it.

Check out this site . Resize the browser window and you'll see the site resizing nicely. At a certain point the background and menu changes because a media query has kicked in.

Just a shameless plug. I created an Air app just for this purpose as well as calculating ems. You can get it at http://cibgraphics.com/projects/responsive-calculator

 

It's free by the way

 

Just downloaded this, it's great! Stops me reaching for my phone every 2 seconds.

 

Brilliant!!

Edited by OliverB

Images are fun and need a bit of playing with.

 

If you apply this to your CSS;

 

img {
max-width: 100%;
}
It tells the images that they can't go larger than there file size (the size you created it). Now if you want your images to resize then you have to remove the width and height attributes from the images code. E.g;
<img src="your-image.jpg" width="260" height="295"> becomes <img src="img/your-image.jpg">. Don't forget you alt and title attributes for good SEO.
This cheeky litte page can give some good tips but I preferred to buy the book so that everything is in once place and that I'm following one idea.

I recommend you learn how to use SASS (SCSS). Using this media queries can be nested within elements, for me it helps a lot with maintainability. You can name the breakpoints using a mixin and then you can call the media query by name like a variable or function.

 

I don't like listing breakpoints with names such as 'mobile' I'pad' the're simply to device specific, I just give them generic names like Small, Medium, Large. With the breakpoints themselves not being set at specific device width, but at a width when the content begins to break / look less desirable.

 

Have a read of this for a more in-depth explanation.

http://css-tricks.com/media-queries-sass-3-2-and-codekit/

Edited by rbrtsmith

  • 9 months later...

What kind of website do you have? If your website is related to shopping then I suggest you to try Magento or Joomla.

 

Responsive Web Design really makes the life easier, recently I experienced converting a b2b trade portal on RWD and experiencing good results so far.

  • 2 months later...

If you want creating responsive website just need html and css code only enough.

 

First of all you have to add the meta viewport name and content inside the header position of html.

 

thats given below:

 

<meta name="viewport" content="width=device-width">

 

And then add the @media query in your css style sheet.

that is given below:

 

@media screen and (max-device-width 480px) {

/* css code*/

}

 

Most probably use the width size "%" instead of "px".

  • 10 months later...

Hi,

Just reading through the above posts but cant get my head around 1 issue that i have.

Pc viewing is fine BUT when looking on the iphone the slideshow images do not resize to the screen but rather stays large.

 

Can you advise please.

The page is here http://www.theremotedoctor.co.uk/zzz.html

 

Thanks very much if you could assist.

  • 2 weeks later...
  • 1 month later...

You can use CSS MediaQuery instead of using Bootstarp for making your website responsive (mobile friendly). This is more easy to learn rather than Bootstrap. You just have to use HTML5 and CSS with MediaQuery for making your websire mebile friendly. I have used this technology for designing my personal HTML5 Tutorial website and it worked perfectly. You can have a look in this site for getting an idea -

 

http://www.html5tutorial4u.com/

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.