Skip to main content

How to change the layout of a responsive website for mobile vs desktop

Lesson 81 from: Build a Responsive Website Using HTML5 & CSS3

Daniel Walter Scott

How to change the layout of a responsive website for mobile vs desktop

Lesson 81 from: Build a Responsive Website Using HTML5 & CSS3

Daniel Walter Scott

buy this class

$00

$00
Sale Ends Soon!

starting under

$13/month*

Unlock this classplus 2200+ more >

Lesson Info

81. How to change the layout of a responsive website for mobile vs desktop

Lessons

Class Trailer

Getting Started

1

How This Class is Structured

01:41
2

What to Download

02:57

Introduction to HTML & CSS

3

Creating Our First Webpage

05:55
4

What is HTML5 & CSS3

08:24
5

Head vs. Body vs. Html Tag

09:01
6

Title & Description

05:54
7

What Code Editor Should I Use

02:42
8

Using Diy Tags

06:26
9

What is a CSS Class

09:05
10

How to Create Nested Divs

05:03
11

Class Project

05:24
12

External CSS

09:07
13

Creating Our Index Style Pages

12:16

Project 1: Restaurant Website

14

Testing Your Website

08:47
15

Check Your Code For Errors

11:01
16

What are HTML5 Structure Tags

05:47
17

Add HTML5 structure elements

16:02
18

How to Set the Color of the Background

05:10
19

Adding Images to a Website

04:38
20

How to Center an Image

01:14
21

Change the Font Size & Color

14:11
22

Make a Clickable Link

08:45
23

Stretching Background Image

05:38
24

Making a Div Tag Transparent

02:36
25

Simple Website Text Navigation

06:43
26

CSS Compound Classes

07:02
27

Class Project 02

02:05
28

Class Project 02 - COMPLETE

04:48
29

Add an Email Button to a Website

03:49
30

Add Google Maps to Your Website

11:25
31

Making a Website Live

16:50
32

Uploading via SFTP

11:50
33

Setting Up Our New Project

03:46

Project 2: Bike Repair Website

34

CSS Reset

15:22
35

Min-height vs. Height

07:01
36

Div Tags Onto One Line

05:23
37

Getting div tags onto one line using Flexbox in HTML & CSS

05:23
38

Evenly Spaced Div Tags

04:42
39

Two Div Tags of Different Sizes

07:13
40

Vertically Center Content

07:20
41

Class Project 3

02:51
42

Class Project 3 - COMPLETE

05:39
43

Change Default Fonts

04:19
44

Installing Google Fonts

12:44
45

What are PX & EM & REM

14:56
46

Change Line Height

04:33
47

SVG vs. JPG vs. PNG

07:04
48

How to Create a SVG, JPG, or PNG

11:00
49

Block Images vs. Background Images

08:32
50

Finishing Up Our Cards

09:10
51

Icons via Font Awesome

16:31
52

Making a Div Container Clickable

09:55
53

Box-sizing & Border-box

06:19
54

How to Make A Colored Button

07:46
55

Why Can't I Add Margin or Paddding

11:08
56

Rounded Corners

04:17
57

Drop Shadows

06:24
58

Backup Your Website

05:00
59

Reusing a Button Class

03:10
60

Class Project 04

02:58
61

Class Project 04 -COMPLETE

05:45
62

Adding a Horizontal Rule

03:51
63

Make Divs Wrap Onto Separate Lines

12:14
64

Hover Color & Animating a Button

03:33
65

Pseudo Classes

09:31
66

Simple Dropdown Navigation

20:04
67

Adding Our Dropdown to the Website

14:50
68

Useful Shortcuts and Tips in VS Code

13:28
69

Large Background Image

09:24
70

How to Connect 2 Pages

10:42
71

Simple PHP Form Work

17:49
72

Placeholder Form Text

05:46
73

Multi Line Form Text Box

02:18
74

Form Check Marks

03:04
75

Form Radio Button

06:07
76

Form Drop Down Menu

05:48
77

How to Style Your Form

12:55

Project 3: Responsive Portfolio Website

78

What does responsive website design mean

04:17
79

How to change a website layout size color when at different sizes using media queries

11:28
80

How to test your website on a tablet or mobile phone from Visual Studio Code

06:00
81

How to change the layout of a responsive website for mobile vs desktop

16:02
82

How to turn things on and off for mobile tablet & desktop responsive websites

06:03
83

What is pixel density responsive images pixel ratio dp px in webdesign

14:47
84

How to export responsive images for website from XD Photoshop Illustrator

05:11
85

How to add responsive images to website using 100% width in HTML & CSS

06:08
86

How to use srcset to change images in HTML for responsive website

10:15
87

How to add a css style to the first line of a p tag on a website (

11:18
88

How to make the header footer full width but the inside centered

05:36
89

Class Project 05 – Header design

03:12
90

Class Project 05 – Header design COMPLETE

06:25
91

How to use a span tag or span class in HTML to change text

10:32
92

How to pin the navigation to the top of a website fixed nav

03:17
93

How to make a simple responsive mobile menu using CSS only

08:21
94

What is Javascript vs Jquery in website web design

06:35
95

How to make a burger menu 3 line mobile navigation for a website

15:11
96

How to switch a menu nav from desktop to mobile phone

21:45

Project 4: Bootstrap Yogurt Website

97

Overview of what Bootstrap 4 is in website design

07:57
98

How to install Bootstrap 4 on a website using Visual Studio Code

06:27
99

Quick overview of how the Bootstrap Grid Layout works in VS Code

10:49
100

Quick overview of how Bootstrap Components works in VS Code

09:23
101

Quick overview of how Bootstrap CSS Styles works in VS Code

08:20
102

How to customize the default Bootstrap 4 css styles

13:51
103

How to use Bootstrap Layout Grid Experiment 1

10:20
104

How to make 100% header & uneven widths in Bootstrap 4

07:16
105

How to create uneven col widths in Bootstrap 4

07:27
106

How to add padding & margins using Bootstrap 4 in VS Code

12:03
107

How to change layout of Bootstrap depending on mobile or desktop

15:46
108

How to turn things on & off on your website using Bootstrap 4

05:30
109

Google Chrome Inspect

12:40
110

Add Shadows to Text & Boxes

07:06
111

Change the Default Buttons

06:16
112

Responsive Images in Bootstrap 4

09:34
113

How to Center Text & Div Tags

04:16
114

Customize the Bootstrap Navbar

07:29
115

Add Your Own Logo

03:58
116

Change the Default Nav Styles

12:12
117

Fix the Navigation to the Top

04:41
118

Col Images & Col Background

07:56
119

Bootstrap Border & Rounded Corners

04:20
120

Bootstrap 4 Carousels

05:13
121

Card Groups

03:29
122

Drop Shadows On Bootstrap Cards

02:25
123

Clickable Boxes in Bootstrap 4

04:02

Final Quiz

124

Final Quiz

Lesson Info

How to change the layout of a responsive website for mobile vs desktop

Hi there in this video. We are going to take our sweet new media query skills along with some of our past flex box skills to do this. Go from desktop view where it's three across ready for tablet, tablet, tablet to look at that mobile one. Now this is proper responsiveness where we start changing the structure oversight to make best use of the screen real estate available. Let's jump into V. S. Code and work out how to do it. All right. First up, let's get rid of this stuff. Don't need the H one. Don't need the starting there. We'll leave our media queries. Okay? So when you are deleting the H one at the media query, don't delete the second brackets. Okay. Because it'll half work. The browser is pretty clever and c as well. I'm missing this but I'll still work kind of. Okay, So just make sure we don't. All right. We're going to add a container. Okay. Remember containers. Weird one where it feels like there should be like a specifically named H html five tag. Like what div and header bu...

t it's not. We have to call it a class called container. Okay. So this is where everything is going to go. Let's style this container. So we're going to do all of it in Global. We're going to say container. I would like you to be we'll put a background color in first to make sure it's actually appearing background color. I'm sick of these colors. I'm gonna pick my own by clicking on it and then dealing with the color picker. Cool background color. Let's preview, make sure it's working. Nothing is working. Why not? Because it doesn't have a height. I knew that. Okay, so we need a height and we're not going to use this regular height. Remember we're going to use min height. Okay. In height even I'm gonna throw in 500 pixels just so that there's some kind of guts to it. There it is there That is not, it can be any size actually I'll probably leave it off and just start building knowing that it will appear at some stage but it's a bit weird for classes. Okay, we're going to add a width like we did before, we're going to say a width of 10, pixels wide. Now, the problem with doing that A width by itself, like that is an absolute size. So it's going to always be 124 but I don't care if you're a mobile tablet. So what we're gonna do is we're going to say you can be a maximum of up to that. Okay, Because that sort of decided my like it's a bit weird having computer issues. Okay, so a max width is just going to say you go up to that but no further, but you can go smaller because that's just the maximum width. Alright, last thing we'll do is we'll get it to centered. Okay, do you remember what this was? Remember it was margin left and right. Set to auto. We're going to use our shortcut. Okay, so we're going to margin to the top and the bottom, we're going to be zero but the left and the right are going to be auto. So just the space between them that should work nice. So that's my container. I now inside of this container, I'm going to add a bunch of those kind of blocks you saw in there. So up until now we've been calling them cards in some instances boxes. Okay, in this case we're going to start calling them coals. Okay, sure. For column for no good reason, it's not like a predefined tag in here. It's just very common to use it. And when we start looking at things later on something called bootstrap, they use the word coal as a box instead of box or card tile. So we also just get in the habit of doing that. So I want 10 of them and I want inside of those boxes of one H one. So I'm going to try and impress you with some emmett. So what do we want we want to call? Okay, and inside of that coal. So the greater than bracket and so inside of it's gonna have an H one and I'll show you another fancy thing if you put in curly braces here and say so on boxing there, the curly braces is going to put inside of that H one. It's going to put some text just plain old text called box. Okay, so that's kinda half of what I want. Right? But curly braces return so that's kind of what I want. Okay, so, but if I do times 10 it's not gonna quite work because it's going to give me a call one coal and then 10 H ones. So remember we kind of did this before you put it in brackets, coding. Help tries to put two in them. So all of this to be working and you're like, that wasn't worth it and it totally wasn't. I just, I guess I'm getting used to this index showing you cool, helpful things like putting in curly braces and the other weird thing about it is that we're not weird. It's giving me kind of some nice structure but it actually looks a little bit nicer. If I just do it the long way. So I'm going to do cole I'm not going to going to use the right case. I was just duplicated. It seems easier in this case. So coal inside of here is an H1 inside of this is going to be box. That's what I wanted. Right? So to duplicate it, you hold down the option key on a Mac and the shift key down arrow. So that's option shift down arrow if you're on a Mac, Sorry, that was for a Mac. If you're on a Pc it's shift down arrow And you should count. I didn't count. We need 10 of them. I'm going to add numbering to them. That will help me and no fancy way that I know of for doing this except for ah look at that that went well. Let me guess the right number as well. That was just down arrow and start typing. Let's have a little look what we got. Okay, a bunch of boxes now let's style those boxes. So they're called coal over here, my global I'm gonna say dot cole you're going to be a color? No, you need to be a background color back. Ground color. Okay. And I'm going to pick any old color so I can click in it and pick a color that I like. Makes no real purpose. There we go. Just pick some nice colors down. Alright, so we've started the coal. Let's have a little look. Let's give it a width and a height. Sorry, going a bit fast. So yeah, it's just doing that because I have not given any dimensions. So let's give it a minimum height of I don't know, 200 pixels Nice. Let's give it a width. Okay, Because they're taking up the whole thing, let's see if the width will fix it. So instead of doing a max width or a min width we could do absolute sizes and start playing with max width but we're gonna use percentages which is basically the same thing because it's a it's not a fixed size And what I want in this case is let's look at our mock up. This is the desktop view. So I wanted to be about that. So three across and two across and one across. So kind of 100% width. This one is going to be 50% with fish. This was going to be 33.3. I'll leave it a bit of space in between them so it might just make this 30% across. Let's have a little look. It's not gonna work. Okay. The reason it's not going to work is why are they sticking on top of each other and not beside themselves or in line? You got it. Okay. So it is, we could say columns are display display in line. Okay. And you'd be totally right in line block. Okay. And that would work. Okay. But what we're going to use is go back to our flex box. Remember what we could do with flex box about display And we're gonna use flicks. It's going to be part of the thing for us. No, it's not display flex. 30%. Yes. Why are you displaying flicks? Oh, I've done to the wrong one. Has to be the parent. You remember that Dan. Okay. A good test for you to pretend it was a test. Okay. So the container. Okay. You applied to the container. So it applies to all the Children which are these coals. Let's have a look now. That kind of works. It squeezed them all in and by default it squeezed all 10 of them into the same row. Okay. And it made it 100% of the parent. What I'd like to do is actually do here do flex, flex wrap. Okay. And what kind of rap? Just the regular old rap. Okay, save it awesome. So 30%. They're rapping. Okay, so 30 30 30 we get we get to 90 K. Leaving our gap. So a couple of things actually before we go wrap you can you saw it there? I can't remember if I read reverse. Okay, so box 10 is at the top. Never use that. But it seemed I felt like I wanted to share that they're now what I want to do is put the spacing in. Okay. We could play with margins but remember that fancy thing we learned earlier on, we can justify the content. And we're going to use which one? Space around. Space between. There you go. Save it. There you go. Space around. Might be a good exposure. You'll see it here. I had to kind of like point it to you before, but we had a white background. So space around is evenly either side. Okay. And I never want that. I always want space between let's go add a bit of padding to the bottom of them. So the coals let's have a little bit of padding margin bottom of 40 pixels. Alright. It's looking good. Okay. The cool thing about them because the 30%. Okay, they responsive by themselves. They get to a max with okay, but they're allowed to go smaller, the container can get smaller. Okay, but they can't go past that and it's going to work for us at the moment. You could design for a heaps larger size and it depends on your audience but they might not have you might be designing a whole big website for all for people that just are never going to see it. There might not be that many people who have this ginormous desktop to you. Alright, that is it for that now I'm ready to adjust them for the different media queries. So down here and it's the same thing. So cole okay at our curly braces, I'm going to say coal, we're only going to do the width. Okay, so the width down here is going to be a different percentage so remember 50, it's kind of 50% for our tablet view. Okay, but a little bit less for this. So maybe 45%. I don't have to reiterate things like justify or flash flex wrap because it's already globally applied to everything. Let's have a little look. Alright, so just of you, Let's use our proper fancy one. Right click inspect. Okay, let's go to our show me decrees they're not on by default show show show. Oh they are right there in blue. Okay, Let's go to this bigger size. Alright. It's not adjusting its because of this. Okay. I left it said to IPhone four and it will not change. You could get the responsive and it will change. Okay, so Let's go big version three boxes go to this morning. Hey, it's only 45. The gap there is a bit big in the middle there so maybe 47 might be a better percentage. Okay, but you get the idea right? We did it with plain old H ones before now we're doing it with actually the structure of the site which is kind of tends to be more what you're doing. Okay, we've done it for tablet, tablet, desktop, tablet mobile. Let's do that. Next. Okay, so let's look at our media query here. Still you It's going to put in 100 because I don't have any gas and it's going to kind of fill it up probably. Here you go go. A little bit smaller, bigger 321. How cool are we? All right. And that is the kind of really big takeaway for this video is we're using the exact same thing. Okay. We have to do some styling to make it kind of looks like a website. We made some boxes but to do it with structure. All we really need to do is we need to add these two bits. Really we just need these two. Okay to get them in line and then to wrap onto the next line And then we just said at this different size, I want to change that. I don't want to be with anymore of 30%. It's gonna be 45. So we don't really say to rose or two on a row. We just kind of make it so that that happens by giving it a size that only allows for two to fit. All right, a couple of little things. One that I ignored is down here at mobile. You'll notice that there's still a white line around the outside. Okay. That's one of the first things I did, I'm like, man, that's annoying. Okay. So by default, you know like the default the H1 is black and it's times new Roman and it's nice and big and bold. It's the same with the body. The body has a global of margin. I can't I don't even know what it is but I always go through and set margin to zero. Okay, So that there's none around the outside at any of you. Okay. I didn't want it for any of them and it gets it from the top from the sides and from the mobile gets it right around the outside. It's nice and kind of joined up because on mobile you want every pixel counts right to get as much detail as you can into that width. Now we did it here and we're fighting with the defaults. Okay, so that is a really good opportunity to say actually I'm doing this, I'm about to build out some CSS resets myself. How about I just use that CSS reset? We already have. Okay, and we already got one. Remember we've got one, so I'm gonna delete that so it'll come back. Okay, I've got one. Remember the Rhys Meyers one. Okay, so I'm just going to copy and paste that and use that. So I'll show you what I do. Now as I dig around in my files for an old folder I'd go into here and say remember project to on my desktop there. Was that CSS reset? I'm just gonna copy it. Find my project three minds on my desktop. I had some shortcuts to speed things up. I'm just going to paste it in here, add it to my CSS Okay, it's a link. It's a link and it's a six S one and it's not called style so it's called CSS If you delete the text in here, it should hopefully suggest it CSS reset and I've totally done it wrong and you're like he's done it wrong. If you haven't gay, we'll discuss what I've done because it's actually done done. We wanted got rid of the margin around the outside for all the views. It also got rid of the giant text. Okay, it's now just a regular old size now, what it didn't do or what's going to run into problems later on Is let's say that I want to start the H1. So I go, Alright, each one now you are going to be a font size of let's say something big. 100 pixels. Okay, good awesome. Check it. Hmm, ticket, check it not working. Why is it not working? Okay, pause it. Have a think about it. Um pause it your own paws now. Okay, You didn't pause it? I know you didn't. It's this thing. Okay, they're in the wrong order. Okay, so my style is being applied. Remember the flow kind of goes along and it says alright, B and H one of font size 100 then this one loads. Okay, And if we have a look at that and take it over here, it says H one is a font size of 100%. Any other things that are telling you what to do? No, that thing is making us just go to 100% of the one. M Okay, So we're just gonna make sure the order is right way around. So you is there now that shortcut, you can just cut it and paste it Okay, above it. But if you click in it anywhere and hold down the option key on a Mac. Ok. On a pc. No highlight the whole line. Okay? And hold down the option key on a Mac OK. On a pc can you see I can kind of just tap my arrow key as long as I hold down my option or or alternate pc. I can just kind of move this thing along. Okay, So make sure the CSS reset first, then do that now. My phone size nice and big. I don't want get the idea to save it. Alright, So that's the kind of real foundation for our responsive website. There's a lot more to do. Okay. But that's the core of it. We're using flex box, which we kind of know or a little bit about already and we're using medical berries to kind of turn bits of CSS on and off. All right. I hope you're feeling good about responsive web design. I'll see you in the next video.

Class Materials

Bonus Materials with Purchase

Exercise Files
Completed Files

Ratings and Reviews

Viwosoft Technologies
 

Great tutorial - your clear instructions and concise explanations make learning HTML5 & CSS3 a breeze!

Student Work

RELATED ARTICLES

RELATED ARTICLES