Close

Responsive Web Design

Forget responsive web design. Just use HTML tables

Well then…

My message, yesterday, sparked this doozy from PJ:

“If you just stuck to tables this entire time, imagine the years of frustration you could have avoided by ignoring floated divs, Bootstrap, flexbox and now CSS Grid! These ‘new’ methods add no additional benefit to the client or user, and the syntax is not any better either! I use floated divs and flexbox only because I was gullible enough to drink the koolaid. But if I had used tables all this time, really nobody would have noticed, and I would have been more productive.”

Bahahahahaha!

Wait. No. Don’t do it. Straight face. Be nice.

Okay… so…

Let me tell you why this is horribly wrong.

He’s talking about using tables for layouts.

Yes… sigh… this used to be a thing. Back in 2009, Smashing Magazine wrote an article about this and in it they referenced this thing called MAMA.

Metadata Analysis and Mining Application.

Say that three times fast.

Anyhow, this was a structural search engine that returned the details of a pages HTML structure. The table element was found on over 80% of the pages crawled.

Table, td and tr were all on the top 10 tags.

We did this.

I did this.

(Hangs head in shame.)

Then, divs came along.

Then, HTML5.

And, it was all a progression toward semantic markup.

And, PJ has a small, if very narrow-minded, point that the average site visitor probably doesn’t care about most of this… until they do.

The point of semantic mark up is adding meaning.

And, primarily that meaning is for machines…

But, it’s for the benefit of users.

Let’s take the nav tag.

You use it to define navigational elements.

Why is it any better than <div id=”nav”> or putting a <ul> inside of a table cell? Because, when we use nav, we are telegraphing that this is indeed a navigational element.

And, a screen reader can safely skip this element.

If you’re not blind, who cares?

But, if you are… not having to listen to: “Home, about, contact” in robot voice is quite nice. Especially, on those mega menus with dozens of different list items.

That’s real-world value to real people.

You may not care, but they sure do.

And, that’s just one example.

Search engines use semantic markup to better understand what a web page is about. So, if SEO and, ya know, getting website traffic matters to you…

Not to mention…

All the different ways machines will use this in the future.

Semantic markup helps create a better, more useful and accessible internet, helps search engines better understand your website…

And, future-proofs your code…

For when the machines take over.

Maybe, they’ll appreciate your semantic markup…

And, not kill you… right away.

Anyway, table-based layouts was always a hack.

A horrible, horrible hack.

So, PJ.

My man.

That you think what’s happened over the last decade or so is all about responsive design and we could’ve skipped it all by just “sticking to tables”…

Because it has “no additional benefit to the client”…

Just shows that you don’t really understand it. Not that the rest of us are crazy for embracing it. But, hey, do your table thing, my dude.

You can build ’em how you want.

That said, if you want to learn more about all of this and how to do it properly, when to use certain tags, when not to… all of it…

It’s inside my new Beginner’s Guide to HTML course.

I break it all down Barney-style.

And, help you master…

“Dis herr new-fangled aH eM eeeL Tees.”

The link to get started for nada on SkillShare is right hrr: https://skl.sh/2Lqhh1v

Later,

John

August 4, 2018

JMS057: 4 Responsive Web Design Principles Every Web Developer Should Know

In this episode of the John Morris Show, I share the 4 responsive web design principles every web developer should know, CES, Oculus Rift, how I’m launching my wife’s freelancing career, answers to your questions and more:

Subscribe to the Podcast

[saf]

Here’s the line-up:

  • Dealing with depression during the holidays [00:47]
  • CES, Oculus Rift and how it relates to web development [13:00]
  • How to avoid being a “hard to work with” developer [22:26]
  • Responsive design principles every web developer should know[31:09]
  • How I’m launching my wife’s freelance career [44:19]
  • Answers to your questions [59:02]

Links mentioned in this episode:

If you liked the show, give it a like and share with the communities and people you think will benefit.

Finally, you can always find all my tutorials, podcast episodes and more on johnmorrisonline.com, @jpmorris on Twitter and youtube.com/johnmorrisvideo.

January 6, 2016

How to Use Media Queries to Build a Responsive Web Site

Media queries are the cornerstone of responsive web design. They are what make the kind of advanced responsive design we see today even possible.

So, here’s how to master using them…

How to Use Media Queries

So, What ARE Media Queries?

Here’s the official definition from the Mozilla Developer Network:

Media queries consist of a media type and can, as of the CSS3 specification, contain one or more expressions, expressed as media features, which resolve to either true or false.

Huh?

Think of media queries as conditional statements. You create a query that either resolves as true or false… and if TRUE, you designate certain CSS that then gets applied.

Here’s an example snippet:

@media screen and (max-width: 600px) {
.facet_sidebar {
display: none;
}
}

The above query says:

If the media type equals screen and the width is 600px or less… then apply these styles.

The “screen” part is the media type and can be things like “all”, “screen”, “print”, “tv”, etc ( Click here for a list of available media types).

The “max-width: 600px” part is the “expression expressed as a media feature” and can be things like max-width, max-device-width, orientation, etc (Click here for list of available media features).

And, the above statement will also resolve to true or false.

This is what allows us to target certain screen widths and change the way our site behaves based on that screen size. Essentially, this is responsive web design.

Finally, you have logical operators that help you “chain together” multiple expressions to target certain scenarios more specifically. Here’s an example snippet:

@media (min-width: 700px) and (orientation: landscape) { … }

Here’s you’ll notice the word “and” sandwiched between two expressions. This query states:

The screen must be at least 700px wide and the orientation of the device must be landscape.

You can use different logical operators like: and, comma-separated lists (or), not, etc (Click here for a list of available logical operators).

Where Do I Start?

At this point, you’re probably wondering where to start with all this. The most common way media queries are used is to target certain devices widths in order to change the display of a web site for different devices.

Here’s a common set of media queries (taken from Bootstrap 3.0):

@media (min-width: 768px) and (max-width: 979px) {}

@media (max-width: 767px) {}

@media (min-width: 1200px) {}

Here we’re targeting three different widths:

  • BETWEEN 768px and 979px
  • LESS THAN 767px
  • MORE THAN 1200px

Now, you might be wondering WHY these widths?

In my Responsive Web Design 101 course, I cover that particular question in great detail and show how you exactly how to structure your media queries to target different devices…

But, in a nutshell, these widths are based on common device widths. A number of devices (included iPads) have a width of 768px in the portrait orientation… thus the focus on widths around 768 pixels.

Also, common laptop widths are 1280px and 1366px… so the min-width:1200px is target those devices and anything bigger… while excluding iPads in the landscape position (1024px).

Why the 979px?

Well, 980px became a design standard on the web. So, designers (and web users for that matter) have gotten used to using that width. So,  you’ll often see media queries based around that width, as well.

All in all… media queries are about targeting certain groups of devices based on their widths. This allows us to create different designs for different devices and make our site look and function good no matter the device viewing it.

QUESTION: How do you use media queries in  your responsive designs? Do you have a standard set of queries that you use?

December 24, 2013

How to Fail in 2014

Brace for impact. As we near the end of 2013, you’re going to be hit with an onslaught of “how to succeed in 2014” posts. That’s all fine and well…

But, sometimes knowing what NOT to do can be more powerful that knowing what TO do. This is one of the times.

Imagine this…

Imagine if you were around 100 or so years ago and were a horse and buggy maker. Imagine if you had ignore this new “fancy” technology called a combustion engine that was making waves at the time.

Imagine how in a few short years you’d be put out of business as the automobile made your product obsolete.

Or, imagine even just a couple decades ago when this “fancy” new technology called the internet came out. Imagine if you ignored THAT.

Now, fast-forward to right now. Consider all the “fancy” mobile technology that’s taking the world by storm.

Wanna know how to fail as a web developer right now?

Ignore mobile.

Ignore mobile and watch as clients and site visitors slowly fade away. Ignore mobile and watch as your competitors slowly run you out of business. Ignore mobile and watch as your online business dreams vanish.

If you really want of fail in 2014… that’s exactly how.

Now, here’s what TO do in order to succeed…

Of course, you don’t want to fail and that’s why responsive web design is now more important than ever. The world has gone mobile and as a web developer you have to keep up if you want to stay relevant.

That said, LEARNING responsive web design isn’t necessarily easy. In fact, at first it can be quite confusing. Plus, there’s a very specific set of skills you need to learn in order to master responsive design… and, if you don’t know what those skills are…

Well, that makes it about 100x harder.

Thankfully, I’m going to tell you what you need to learn:

  1. the 3 different approaches to responsive web design and which one you should be taking
  2. the 5 individual skills that make responsive design “happen”
  3. how to work with and extend responsive frameworks

Once you master those things, you’ll be all set with responsive design.

Of course, if you want to fast-track your learning curve, I offer a responsive web design course that will teach you all of the above and more.

But, whether you take that course, a different course, and you learn it all on your own (not recommended)… make 2014 about mastering responsive design and building mobile-friendly web sites.

Frankly, you can’t afford not to.

December 10, 2013