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.

Something that worries me about designing in %

Featured Replies

So obviously when developing a responsive site, I give elements their widths by using %. So say a two column layout would have

 

.left-column {
             width:80%;
}

.right-column {
             width:20%;
}

 

 

this would then be changed as the screen gets smaller to probably:

.left-column {
            width:100%
}

.right-column {
             width:100%
}

 

 

 

But what about on really large/wide screens? The 80% and 20% wide columns would actually be very wide in terms of px and could potentially have text that would span many lines on a normal screen, spanning just a few line or even one! Also say you've got an image in the right column that is 100% of that 20% width, that would surely be huge on a wider screen?

 

I haven't got a screen wide enough to test this out so am I bit concerned. Would a suitable way around this be to add a max-width to all elements? Or am I worrying about a problem that doesn't exist?

Edited by jpwd

You can wrap all your elements in a container div and add max-width to it. That way you don't need to specify max width for each element.

 

For example:

<div id="wrapper">
--Site content here--
</div>
#wrapper{
width:90%;
max-width:1300px; //specify width
}

You could use css to set your column widths for spicific device/screen widths.

 


/* All sizes up to 960px */
@media only screen and (max-width: 959px) {

.left-column { width:80%; }
.right-column { width:20%; }

}

/* Tablet Portrait to all sizes */
@media only screen and (min-width: 768px) and (max-width: 959px) {

.left-column { width:80%; }
.right-column { width:20%; }

}

/* All mobiles? */
@media only screen and (max-width: 767px) {

.left-column { width:80%; }
.right-column { width:20%; }

}

/* Mobile landscape */
@media only screen and (min-width: 480px) and (max-width: 767px) {

.left-column { width:100%; }
.right-column { width:100%; }

}

/* Mobile Phones */
@media only screen and (max-width: 479px) {

.left-column { width:100%; }
.right-column { width:100%; }

}

 

 

Maybe something like that.

Second vote for wrapping the content and applying a max-width.

 

You might also want to center your content once the viewport has exceeded your max-width property with margin:0 auto;

 

Bear in mind if you're designing for IE-6 or lower that it doesn't recognize max or min-width properties.

  • Author

Yeah, a wrapper does appear to be a safe bet and apply the max-width to it. I tend not to use a wrapper but suppose I'll have to.

 

Cheers for the replies.

While wrappers themselves are not strictly semantic they are often a necessity and I wouldn't hesitate at using them. However they are quite often used when not needed creating more non semantic markup than is required - this won't break a site but is undesirable.

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.