Vuetify Tutorial #12 - Padding & Margin

Net Ninja · Beginner ·🛠️ AI Tools & Apps ·7y ago
Skills: HTML & CSS80%

Key Takeaways

Explains margin and padding classes in Vuetify

Full Transcript

alright then so now I'd like to talk a little bit about padding and margin so the way this works in beautify is by using CSS classes and they follow this structure right here I'm just going to zoom in so you can see this it's the property then the direction then - then the size so first of all the property that's either margin or padding and we use either M or P to refer to those so say for example we want to create a class which is going to control the margin the first property for us would be M then it's the direction so the direction would be where do we want to apply this margin or padding do we want it to the top in which case it will be T the bottom be left L right our x applies to the space in to the left and the rights of the X direction and the y applies it to the top and the bottom so the Y direction a stands for all and it applies the margin or the padding in all directions so say for example I want to apply a margin to the left and right of an element then I would say M X foot left and right - then the size of the margin now the size can be anything between 0 and 5 5 being the biggest and 1 being the lowest now it uses this space of variable to control the size of the margin and x is it by this number right here so you can see as we go up then ik x is it by a larger number which is why we get a larger margin and the same is true for the padding so again we could say something like M X - 3 and that would give us a margin of strength 3 in the X direction so left and right if we wanted to apply padding in all directions to a strength of 2 then it would be P a for all - to make sense ok cool so let's give this a whirl I'm going to go over to our project and you see this is right flush against the navigation I'd like to move this out a little bit now we could do that by going into our different components let's get rid of these files first of all we could go to team and do it here dashboard and do it there and project and do it there as well but instead of doing this three times instead what we could do is just go to app top view and we could do it once right here okay because right here inside the content that is where our other content is being loaded in this stuff so what we could do is just apply a margin to this thing which is going to move whatever is nested inside here so we can just a meet once and every single page is going to get this margin okay so let's add a class here then and do this in non caps so class is going to be equal and we want margin we want it in the x-direction - and a strength of four so if I save that now and preview this then we're going to see this come away from the navigation and the matter what page were on is doing it for each one okay cool so that's the first thing done the next thing I'd like to do is apply a margin bottom to this content as well now the way we do that is by seeing em be and then - whatever the strength is I'm going to say four again and we get a margin of four at the bottom or strength for now we're not going to notice that now but we will notice that later on okay so I'd like to just style this a little bit differently over here so I'm going to go to my projects component and I'm going to give this a class right here and the class is going to be subheading so that's going to make it a little smaller and also we want gray text so gray - - text now I'm going to copy this stuff right here because I'm going to apply this text to each one of the H ones on the pages so let's do the same thing there and then go to team and do exactly the same thing here as well save that and that should start to look a bit better cool that looks nice if we go to dashboard and team they have the same styling awesome okay so we can also apply padding on margin to the main content as well at the minute we're just applying it to the h1 at the top but ideally we want some margin around the main content which is going to sit in the middle as well now when we come to create the content we're going to be probably using the grid system now whenever we use a grid we generally place it inside a container element and a container element keeps everything within a central width on the page and it also helps to stretch our content for different screen sizes so the way we create a container is by saying v - container by the way I'm on the team page at the minute but we'll do this on each page so don't worry and then inside will say content so let me just save this and view the team page first of all and we can see this content right here so I'd like to apply a margin to this content at the top to bring it down quite a bit so to do that I'm going to give this a class equal to M and then we're going to do this in the y-direction top and bottom so we'll do a Y then - 5 which is the top strength so a large margin top and bottom and now you can see it's come down quite a bit okay now watch this when I get rid of the menu this thing right here this stays in a central column and I can demo this what I'm going to do is just add a pizza and then some lorem like so and then I'll add another P tag as well with some lorem and press save view this in a browser again so now we can see all of this is within a central column we have this margin left and the margin right and that is what this container is doing for us it's keeping everything inside that central column and when we do a grid we're going to add it inside the container so that that grid is kept within that central column now if you wanted your container to be full width you can override this behavior by saying fluid like so and that's going to make it full width like so we see we have a much smaller margin now but I don't want to do that I want to keep everything within this central column so I'll take away fluid and do it like that and notice this when I make the screen smaller this is going to jump so at this screen size right here you jumped in and made that central column smaller okay so the margin on each side is larger and then it gets to a certain point where it just goes to 100% width so that's nice and responsive it keeps everything in the center with the margin left and right cool okay then so let me just get rid of this lorem ipsum and just say instead contents and then I'm going to grab this because we're going to do a similar thing on each page we're going to put our content inside a container so let's go to dashboard and do the same thing we have the same margin applied save that and also in projects with the same margin and now let's see this in a browser dashboard we have the content projects content and seeing we have the content awesome so then we've got my friends that is margin and padding for you

Original Description

Hey gang, in this Vuetify tutorial we'll take a look at some of the margin and padding classes / codes available to us. VUE & FIREBASE FULL COURSE - https://www.udemy.com/build-web-apps-with-vuejs-firebase/?couponCode=NINJAYT18 Vue JS free course - https://www.youtube.com/playlist?list=PL4cUxeGkcC9gQcYgjhBoeQH7wiAyZNrYa Vue CLI 3 tutorial - https://www.youtube.com/playlist?list=PL4cUxeGkcC9iCKx06qSncuvEPZ7x1UnKD ---------------------------------------- 🐱‍💻 🐱‍💻 Course Links: + Course files - https://github.com/iamshaunjp/vuetify-playlist + VS Code editor - https://code.visualstudio.com/ 🤑🤑 Donate + https://www.paypal.me/thenetninja 🎓🎓 Find me on Udemy + https://www.udemy.com/user/47fd83f6-5e4a-4e87-a0f0-519ac51f91b6/
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 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

Related AI Lessons

Up next
How to Open HPL Files (HP-GL Plotter)
File Extension Geeks
Watch →