Mobile-First Responsive Build #9 - Mobile Styles (part 2)
Skills:
HTML & CSS90%
Key Takeaways
Builds mobile-first responsive design using CSS, focusing on mobile styles
Full Transcript
all right then my friends so we've addressed the top section over here the next thing we want to turn our attention to are the projects and also the things I can do so if we head over to the index file we can see the next section this bit is called portfolio so I'm gonna grab that ID and style that first of all so underneath the last selector there I'm going to say portfolio but before I do that I need a hash because it's an ID and then inside this rule what I'd like to do first of all is give it a background image now that background image is going to be a URL and it's going to be this image inside the assets and it should be background something-or-other if I can find it square underscore BG PNG so let me now say we want to go into the assets folder and then we want the square underscore BG PNG file now for the background size I'm going to say cover and then I'm going to say background repeat' is no-repeat because I don't want this to repeat over and over and the background position is going to be bottom so it starts at the bottom and then the padding is going to be 30 pixels at the top and bottom and then 20 pixels to the left and right so that's section in general dot the background that section in general is going to have this padding okay so if I save this now we should see that it's a different color that's the color of the image and we see these kind of gritting in the background I thought it looked quite Spacey so that's the first thing done the next thing I want to do is this h3 at the top now that is not inside the grid remember that sits outside the grid the grid is this div the class of projects so let's do this h3 first of all so portfolio h3 and then inside all I'm going to do is say margin and bottom is going to be zero and then after that also text - a line and we'll put the text in the center save it and okay that's looking a bit better now we want to do these products right here and they sit inside a grid so we have three projects and each one is an anchor tag and they're all grid items so we need to grab those first of all so I'm gonna say dots projects and then a and on mobiles I want these also stack on top of each other so I want each project to be the full width of the grid and that is eight columns so from column line one all the way to column line nine so let me say grid - column and it's going to be from one to nine okay and then also I'm going to give each one a margin of 20 pixels top and bottom zero left and right okay so if we look at that now we can see each one of these now sits on top of each other and each item takes up the full eight columns in the grid right on a different row each time okay so what I'd like to do now is address the image size first of all and also centralize everything so what I'm gonna do is come down here and say projects and katuk and then I'm gonna do an Asterix and that means grab every single element inside those anchor tags so in our case it's going to be the image and the h4 now I want to style them both at the same time which is why I used the Asterix and the first thing I'm going to do is apply a margin to both of these things and it's going to be zero top and bottom 20 pixels left and right then a max width of 40% and that means that basically the image right here is at most going to be 40% of the width of the actual columns so if I save this now we can see they are much smaller like this the last thing I want to do is say text - a line or in fact we don't want text aligned we want aligned self and that basically takes the current things that were select in so the h4 and the image and it's going to align itself into the center like so okay so now what I'd like to do is actually move the text up to the side over here and to do that we could just say that is going to be flex display flex each one of these anchor tags because when that happens the elements automatically sit next to each other so I'm gonna say display is gonna be flex like so and now we can see they go up to the right dead simple alright so that is looking pretty good for that section now I want to do one more thing and that is just to color this h4 so let me come down here and say projects h4 and then the color I'm gonna paste this in is gonna be this color I'm gonna save it and it's more of a purple color now so it kind of makes it a little different from this h3 at the top okay all right cool so next I want to go down and I want to do this skills section so remember down here this has an ID of skills so let me grab that first of all and come down here and we'll say skills and first of all I want to give this some padding so I'm gonna say 30 pixels top and bottom 20 pixels left and right and then I also want to give this a different background color so it kind of matches the bottom bit over here so let me say the background is gonna be and let me just copy this hex code from my github repo so scoot that over there okay and if I save that now it's gonna kind of blend in a little bit more and in fact it's not doing because I haven't spelt background correctly save it now it kind of blends in a bit more awesome alright so now I want to style this h3 as well so skills h3 and I'm gonna say text - a line is going to be to the center save that and we need to make sure that spells skills not kills okay and that's now in the center now next we need to address these things right here remember that is a ul and it has a class of grid now first of all let me just target the UL and give this some margin so I'm going to say again skills and then UL and give this a margin and that margin will be 40 pixels top and bottom zero left and right to give you some breathing room now we want to style each one of these Li tags right because they're all sitting on the grid or grid items and we have four of them in total so what I'm going to say now is skills Li and for each one I'm going to apply a little bit of padding so ten pixels all the way around and then I'm also going to give this a background as well and this background is gonna be our G ba so we can have an alpha Channel zero zero zero four black and then not point two to make it quite transparent so if I save that now it should just look a little bit dark each one okay now I also need to use the grid - column property on each one now instead of me saying each one is going to go from like one to four I'm not going to do that because I don't want them all to go from one to four or anything like that what I need to do is say that each one is just gonna take up four columns in width and that means that each row is gonna have two because we have eight columns in the whole grid now the way we do that is by saying span four and it's automatically going to populate the different items in the grid into those columns and each item is going to take up four columns in width so we should have two on the top and two on the bottom now if I save that we can see we have two on the top and we also have two on the bottom now I'm also going to say text - a line is going to be to the center like so and that is looking okay now I've noticed that we don't have any gap between the elements in the grid so let me scroll back up to where we defined the grid initially and I'm also going to apply a gap property to that of ten pixels so if I save it now it looks a bit nicer now so we have that little gap in between each element so let me scroll all the way down so now we've done these Li tags what I'd like to do is just apply a little bit of styling to these images just to make them a little bit smaller so I'm gonna say skills and then image and each one is going to have a height of 80 pixels and the margin is going to be 10 pixels top and bottom Auto left right so that is looking a bit better awesome so this is starting to take shape now so from the top we have our welcome section we have our projects and also our skills down there and all that remains for the mobile is the contact form and the footer at the bottom and we'll do that in the next video
Original Description
Hey gang, in this mobile-first tutorial we'll carry on with the mobile styles for our design.
🐱👤🐱👤 JOIN THE CAUSE - https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg/join
----------------------------------------
🐱💻 🐱💻 My Udemy Courses:
+ Modern JavaScript - https://www.thenetninja.co.uk/udemy/modern-javascript
+ Vue JS & Firebase - http://www.thenetninja.co.uk/udemy/vue-and-firebase
+ D3.js & Firebase - https://www.thenetninja.co.uk/udemy/d3-and-firebase
🐱💻 🐱💻 Course Links:
Course files - https://github.com/iamshaunjp/responsive-css-grid-build
🐱💻 🐱💻 Other Related Courses:
+ HTML & CSS Crash Course - https://www.youtube.com/playlist?list=PL4cUxeGkcC9ivBf_eKCPIAYXWzLlPAm6G
+ CSS Grid for Beginners - https://www.youtube.com/playlist?list=PL4cUxeGkcC9itC4TxYMzFCfveyutyPOCY
🐱💻 🐱💻 The Net Ninja Community Boards:
https://community.thenetninja.co.uk/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Net Ninja · Net Ninja · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
GraphQL Tutorial #5 - Express App Setup
Net Ninja
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
GraphQL Tutorial #8 - Root Query
Net Ninja
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
GraphQL Tutorial #12 - Author Type
Net Ninja
GraphQL Tutorial #13 - Type Relations
Net Ninja
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
GraphQL Tutorial #18 - Mutations
Net Ninja
GraphQL Tutorial #19 - More on Mutations
Net Ninja
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
GraphQL Tutorial #23 - Create React App
Net Ninja
GraphQL Tutorial #24 - Book List Component
Net Ninja
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
GraphQL Tutorial #28 - Add Book Component
Net Ninja
GraphQL Tutorial #29 - External Query File
Net Ninja
GraphQL Tutorial #30 - Updating Component State
Net Ninja
GraphQL Tutorial #31 - Composing Queries
Net Ninja
GraphQL Tutorial #32 - query variables
Net Ninja
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
GraphQL Tutorial #34 - Book Details Component
Net Ninja
GraphQL Tutorial #36 - Styling the App
Net Ninja
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
Updated Vue & Firebase Course (Udemy)
Net Ninja
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja
More on: HTML & CSS
View skill →
🎓
Tutor Explanation
DeepCamp AI