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.

Fixed layout compatible with all browsers and devices

Featured Replies

Hello all!

I've been trying to design a website for a couple of weeks now and it's been really stressful wanting to learn everything about html/5 and css/3 (I've just started learning), and I'm being pretty impatient.

What I've done is built a basic HTML5 structure with a navigation inside a header, you lose sight of the header/nav as you scroll down.

What I would like which I've failed at is an interface compatible with all browsers and devices, a design that adjusts to the users browser size not matter what browser/device. Which also allows zooming in on smaller devices like tablets/iPhones etc. Every aspect of the site needs to be fixed in place (at the moment my navigation moves up and down when I'm resizing the browser) where the user can move around and zoom in and out.

I've also read into the benefits of em, so I set the default font to 100%, and all the headers/paragraphs etc I set to em accordingly. Would it be wise to set all fonts to em and the rest of my website like margins etc to percentages?

Thanks for the help in advance!

research responsive design.

 

For fonts this is what I do.

I set up a base percentage in the html element:

html {
	font-size: 62.5%;
	@media screen and (max-width: 900px) {
		font-size: 60%;
	}
	@media screen and (max-width: 768px) {
		font-size: 56%;
	}
	@media screen and (max-width: 480px) {
		font-size: 52%;
	}
}

 

This allows the font's to scale down as the window size reduces. Now the reason I go with 62.5% for the base font size is for easy conversion between REM and PX sizes (REM doesn't work in IE8 so it needs a px fallback.

 

Then you set the font sizes on the selected elements to scale from the % font sizes above:

h1 {
   font-size: 30px;
   font-size: 3rem;
}

h2 {
   font-size: 25px;
   font-size: 2.5rem
}

Use % for your elements and margins that'll make your layout flexible , and read about media-queries to make your layout look good on all screen sizes ;)

  • Author

Interesting info on the font there I'll definitely do it.

 

Though is there not a way for the page to automatically change dimensions?

Remember to disable the zoom-out which is default on most handheld devices. You do this by adding a viewport meta-tag to your document:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

If you need to mix % and pixels in your css for widths, margin and padding it might also be a good idea to use border box-sizing on your elements:

#leftDiv, #rightDiv{
box-sizing:border-box;
}

That will prevent your elements from breaking out of the grid at all resolutions.

Edited by Nillervision

Yes, like Nillervision said, you need to change the box model using the box-sizing property, this makes it a lot easier to work with % based designs. I the grids I design like this:

 

Based on a 12 column grid with a 10px gutter. The gutter width should be in pixels and not % in a responsive design.

 

.row {
  /* set the negative margins equal to the gutter width that will stop the outermost columns being pushed in. */
  
  ;
  margin: 0 -10px;
}

.row:before {
  /* clearfix */
  display: table;
  clear: both;
  content: " ";
}

[class^="col-"] {
  float: left;
  padding-left: 10px;
  padding-right: 10px;
}

.col-8 {
  width: 66.666%;
}

.col-6 {
  width: 50%;
}

.col-4 {
   width: 33.333%;
}

Edited by rbrtsmith

  • Author

Sorry but why disable zoom-out if users need it on smaller devices? I want the user to be able to move around, zoom in and out.

 

Thanks for the border box sizing tip, thats something I needed as my nav bar was collapsing..

That doesn't disable the users ability to zoom in on the screen. You need the meta tag in order for your responsive design to be correctly displayed in the device (the initial scale value that is).

Edited by rbrtsmith

Sorry but why disable zoom-out if users need it on smaller devices? I want the user to be able to move around, zoom in and out.

 

Thanks for the border box sizing tip, thats something I needed as my nav bar was collapsing..

While there are arguments for both, one could argue that you wouldn't need to have the user zoom if the layout was done correctly. Just one side of the argument. Just depends on your site and how you want it to act. I typically disable it.

  • Author

Ah i see, I just don't want to make it too complex. Just so when the user clicks on the site it is displayed as 100% then they just zoom in and move around etc to perform tasks.

 

The majority of users will be connecting to the site from home i.e laptop/pc

 

Thanks for the help people, probably have all the info I now need to start working on the site tonight..

Edited by legg92

You shouldn't need to zoom in the view the content, a well designed responsive site will never require the user to scroll left or right, the whole point of architecting the layout based on percentages is that it will always adapt to the width of the screen. Look at the UI you get on native Iphone apps, this is the kind of layout you should get with a good responsive website when viewed on a mobile device.

Edited by rbrtsmith

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.