Skip to main content
Inspiring
November 28, 2018
Answered

Dipping my toe in responsive site design for mobile in 2018 (am I doing it right?)

  • November 28, 2018
  • 6 replies
  • 1121 views

As mentioned in some of my other recent threads, I'm a career designer who picked up the HTML/CSS he needed along the way (usually via trial & error).

With regards to adapting the layout to mobile, I made sure the base layout was responsive enough to at least look great on both desktop and tablets (which really means landscape and portrait). I'm very happy with the results on those two devices.

Phones, on the other hand... well, they get the same thing the tablet gets, only at a fraction of the size. Obviously, this is far from ideal. The layout holds together just fine, and LOOKs nice, but some buttons are too small to even read.

I was hoping to avoid mobile-specific code (by making the base layout so flexible it could accommodate anything) but it looks like I'm not going to be able to avoid showing/hiding different elements based on whether or not we're on :

  1. A phone, or
  2. Literally anything else.

Googling the subject reveals the most common solution to this is a SEPARATE STYLESHEET for mobile (or in my case, just the phones)... single-stylesheets containing conditional statements don't seem to be quite as popular. I did not find much about that.

If I go the "2 stylesheets" way, my first instinct is to duplicate the affected classes from the regular stylesheet to the phone stylesheet, and simply changing the values (so they override the original), making sure the phones stylesheet is loaded after the regular one in the <head>.

Would that be the right way to do it? So the phones stylesheet only ends up containing 5 or 6 classes (ie, the affected ones)?

Thanks!

    This topic has been closed for replies.
    Correct answer Jon Fritz

    You might as well ask "how long is a string?" in this forum. You'll get different answers from everyone, and sometimes multiple answers from the same person.

    Personally, I work Mobile-First with everything being developed around the mobile experience, then I'll add a CSS Media Query at the end of my stylesheet with overrides for larger screens.

    I typically use two stylesheets. One for purely stylistic things (like fonts and background colors) and another for the page layout itself. I don't see any reason to separate them out by device, but that is one of the new fads in development lately.

    6 replies

    Under S.Author
    Inspiring
    November 28, 2018

    What if I just want to make a div go away if there's no room to accommodate it, regardless of device?

    By no room, I mean "whatever would otherwise produce an horizontal scrollbar".

    Do I have to refer to a specific screen resolution or viewport width, or is there a way to tell the browser "if h-scrollbar, then this specific class=display:none"?

    EDIT: Could this if statement not also be handled in the php file itself, rather than the stylesheet, so that the DIV itself is never even read by the browser, rather than read but not displayed, which is what handling it in the stylesheet does?

    pziecina
    Legend
    November 29, 2018

    You do not use fixed sizes in rwd.

    Do not include image px measurements in the img tag. Use vw or max-width in % in your css. If you simply hide content, (or do not include it) then your users have no way of knowing it is there, plus hiding content using css means that your user is still downloading it anyway.

    B i r n o u
    Legend
    November 29, 2018

    as Paula point at... be aware that hiding content doesn't make the hidden content undownloadable...

    then I will add that responsive content doesn't reduce to only viewable on different screen size... but on many other parameters...so it's not necessary based on only changing CSS files

    Nancy OShea
    Community Expert
    Community Expert
    November 28, 2018

    Trial & error was sort of  OK when everyone had fixed width pages and same sized displays.  But that's not going to work in RWD.   You need a very clear vision of how your site should work on Mobile, Tablet and Desktop.    If you don't know what you want beforehand, you can't create it with code.

    Some people use a  prototyping tool  like Adobe XD or Photoshop to design artboards.  Or you can just put your ideas down on paper.   Whatever.  The important thing is to know what you want before you start building it.

    I use a mobile-first framework called Bootstrap because it works well and saves a lot of coding time.   Some people will tell you Bootstrap is overly complex and bloated.  If you're a decent coder and understand how Bootstrap works, it's not complex.   My RWD sites are performing just fine with it. 

    Bootstrap 4 Tutorial

    Dreamweaver supports Bootstrap.

    Design responsive websites using Bootstrap

    Another option is to buy a commercial Template or layout system that you can use in DW. 

    Responsive Web Design Extensions, Apps, Add-ons and Plugins for Dreamweaver

    Nancy O'Shea— Product User & Community Expert
    ALsp
    Legend
    November 28, 2018

    If you're good at picking up CSS, Paula mentioned CSS Grid. Here is a very simple responsive layout using Grid that you can save and study:

    http://www.projectseven.com/products/staging/pvii-grid/base.htm

    We also have automated page-building tools that install into Dreamweaver. Currently, our flagship product (Harmony) uses the Flexbox specification and is far more efficiently coded (and easy to use) than the bloated Bootstrap CSS that comes with the latest versions of Dreamweaver.

    Legend
    November 28, 2018

    ALsp  wrote

    If you're good at picking up CSS, Paula mentioned CSS Grid. Here is a very simple responsive layout using Grid that you can save and study:

    http://www.projectseven.com/products/staging/pvii-grid/base.htm

    We can't use grid yet without fall backs can we? 'Can I use' says 88.3% - that's quite high - how high is high enough?

    What's the opinions?

    pziecina
    Legend
    November 28, 2018

    osgood_  wrote

    We can't use grid yet without fall backs can we? 'Can I use' says 88.3% - that's quite high - how high is high enough?

    What's the opinions?

    Do NOT use css grids without fallback, (reason later) that said if css flexbox is used for 'components' etc inside css grid areas, then it is just a matter of using the @support rule, (once for css grid) IE10/11 is a bit of a problem, but the old grid specs they support, can be used with very good results, (remember you are talking desktop or games console, so easy to code for).

    The reason I say do not use without fallback, is because if you look at the 'can i use' stats, they do not cover Android devices over 1-1and1/2 years old, or iOS devices that cannot be updated, (for whatever reason). They also do not cover smart tvs, and ps3 consoles.

    pziecina
    Legend
    November 28, 2018

    And now for something completely controversial, sorry that should have been different .

    As Jon said every reply you get will be from a different viewpoint. I start with desktop, but for a different reason than Osgood. Hi-dpi monitors and smart TVs are becomming more and more popular in use for web browsing, add to those games consoles, which have browsers built in, (xbox=IE11 and Edge, ps3/4=Chrome but older versions), user base for all such devices all estimated between 5-12%.

    Starting with desktop allows me to start at a middle point in user possibilities, (mobile, tablet, Pro tablets/laptops, desktop, larger screens).

    The simplest method to use is Flexbox as this can go from mobile to anything else, without media-queries if necessary, (much better with one or two). Another way is to use flexbox for components for css grids, that way your site will fallback to flexbox, (if done correctly) if required, and use a css layout which has many possibilities, (css grids).

    No matter what you choose though, there is a learning curve involved, even if you use the old floats method of layout.

    Legend
    November 28, 2018

    https://forums.adobe.com/people/Under+S.  wrote

    As mentioned in some of my other recent threads, I'm a career designer who picked up the HTML/CSS he needed along the way (usually via trial & error).

    With regards to adapting the layout to mobile, I made sure the base layout was responsive enough to at least look great on both desktop and tablets (which really means landscape and portrait). I'm very happy with the results on those two devices.

    Phones, on the other hand... well, they get the same thing the tablet gets, only at a fraction of the size. Obviously, this is far from ideal. The layout holds together just fine, and LOOKs nice, but some buttons are too small to even read.

    I was hoping to avoid mobile-specific code (by making the base layout so flexible it could accommodate anything) but it looks like I'm not going to be able to avoid showing/hiding different elements based on whether or not we're on :

    1. A phone, or
    2. Literally anything else.

    Googling the subject reveals the most common solution to this is a SEPARATE STYLESHEET for mobile (or in my case, just the phones)... single-stylesheets containing conditional statements don't seem to be quite as popular. I did not find much about that.

    If I go the "2 stylesheets" way, my first instinct is to duplicate the affected classes from the regular stylesheet to the phone stylesheet, and simply changing the values (so they override the original), making sure the phones stylesheet is loaded after the regular one in the <head>.

    Would that be the right way to do it? So the phones stylesheet only ends up containing 5 or 6 classes (ie, the affected ones)?

    Thanks!

    I always keep my media queries in the 1 stylesheet, much easier to manage if everything is together - organisation is 99% of web-development. Dont become complacent as it will cost you a lot of time later. I see a number of really crap css stylesheets where element selectors are unorganised, dotted all over the place - keep them together and in roughly the same order as they appear in your page - saves masses of time when you come to manage the website later on:

    /* DESKTOP */

    .wrapper {

    background-color: red;

    }

    /* TABLET */

    @media screen and (max-width: 768px) {

    .wrapper {

    background-color: yellow;

    }

    }

    /* SMARTPHONE */

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

    .wrapper {

    background-color: orange;

    }

    }

    You should probably start off with mobile first rather than desktop first BUT personally I like to construct the desktop first (all singing dancing version) and then take away the elements not required from the smaller devices, rather than add the elements for desktop after, just seems more logical to me.  Others have different views about the workflow.

    Jon Fritz
    Community Expert
    Jon FritzCommunity ExpertCorrect answer
    Community Expert
    November 28, 2018

    You might as well ask "how long is a string?" in this forum. You'll get different answers from everyone, and sometimes multiple answers from the same person.

    Personally, I work Mobile-First with everything being developed around the mobile experience, then I'll add a CSS Media Query at the end of my stylesheet with overrides for larger screens.

    I typically use two stylesheets. One for purely stylistic things (like fonts and background colors) and another for the page layout itself. I don't see any reason to separate them out by device, but that is one of the new fads in development lately.

    Legend
    November 28, 2018

    https://forums.adobe.com/people/Jon+Fritz+II  wrote

    I don't see any reason to separate them out by device, but that is one of the new fads in development lately.

    Has that comeback into vogue, thats what used to happen years back. Next you'll be telling me the use of tables for design has made a come-back. I swear everything just goes around and around in circles regurgitated by the next generation who think its a new way to do something