Tailwind CSS Tutorial #3 - Fonts & Colors

Net Ninja · Beginner ·🌐 Frontend Engineering ·6y ago

Key Takeaways

Explores font and color utility classes in Tailwind CSS, demonstrating their usage in a project

Full Transcript

or rather than gang so now we have the HTML file and were previewing that page in a browser by using the live server package that we installed in the previous video so now we can start to style this page using tailwind so the way the tailwind works is that it gives us a huge amount of low-level utility classes to style our elements and by low-level I mean that the classes only do one or two things for us like change the color or the font size or the position or the padding etc and that's instead of a class tee with a bunch of things for us to create some kind of style component like a card or a button which is the kind of behavior you normally get with something like bootstrap so there's loads of a low-level classes that we can use but in this lesson we're going to be focusing on text and colors so if we just head to the Tailwind documentation and by the way this link will be left down below and I would advise you to check through it as you go through these tutorials but if we take a look at the font size classes we can see down here these are the different classes available to us so it's text - excess for a very small text and that would apply this CSS property font size of points seven five ramps so Ram is just a unit of measurement instead of a pixel and it stands for roots MS if we take a look at this one text - SM for small then it's not point eight seven five rims and it goes all the way up to six XL which is a very large font and that would be four rims okay so these are the different classes that we can use for giving our different elements different font sizes we also have access to a very large color palette directly out of the box with tailwind and we have classes for all of these colors as well whether it's applying it to a background or a fonts color and you can see all of these colors right here so let's have a little play around with the fonts and colors in our project so let's go back to our project and let's play around with these classes to change the color of text and also the size or maybe the font weight of text as well so imagine I want to colorize all of the text on the page I want to set it to be a certain color well I could apply a text color class to the body because then it's going to hit everything inside the body so if I say class is equal to something the way we apply a text color is by saying text - then the color and that could be anything from the color palette so for example it could be yellow and then a strength now the strength is 100 all the way to 900 in 100 increments so if I say yellow - 400 for example I get this color right here and we can do that for any color in the color palette so let me try this I'm gonna say text - yellow - 400 save it and come over here and we can see all of the text is now this yellow color now I could do this for any color so let me say red and we'll change this to 700 that would be a very deep red come over here and we can see that deep red now what I want to do is call all of my text gray and the strength is going to be 600 because I don't like black text on a white background typically I think a softer gray text looks a bit better so I'm going to use that for the text color of the text on my web page now we can override this at element level so if I want something else to be a darker shade of grey later on I can just apply a different text color class to that element so for example if I want this whole thing right here to be a darker shade of grey I could style this Li or the a or the span let's do the Li tag I'm gonna say the class is equal to text - grey and this time I'm going to use 700 as the strength which is slightly darker than 600 so let me save that and we can see now this home is just about noticeable that this is a bit darker if I change this to 900 it's gonna become more obvious we can see this is darkening now I only want the change to be subtle so I'm gonna say 700 instead okay so we can also call it other things dark as well so for example in the header I want to color maybe this thing darker right here so again I'm gonna give this a class and that is going to be text gray again and again it will be 700 so if I save this and preview we can see that this is now dark as well all right so that's how we play around with text colors we say text - then the color then the strength all right and that colors the text that's color okay so what about the font size well imagine I want to make this h2 much bigger because at the end of the day it is a title and it shouldn't be this small so I could say well I'm going to use a text - LG class and that would be large text now it's not going to be that large but it will be a little larger than current so you can see this is very slightly larger than the rest now now say I want to make it much larger well I could say Excel and if I save that that's extra large again not that much larger but it goes all the way up to 6x else so I could say 6 XL right here save that and now it is much larger so same for this one down here I'm gonna make this a bit larger this is more of a subtitle it's gonna go underneath this but I still want to make it larger just not as large as this one so I'm gonna say class is equal to and it's gonna be text - and this time we'll say - Excel so still very big but not as big as this one preview that and we can see now this is bigger but again this is much bigger than this so that's all there is to it with text size it's just text - then the size you want to use and remember all of those different classes are right here if you forget them okay so what about font weight well I could make something bold or semi bold or lights and I can do that by using it classes as well so say for example I want to come down to these H fours right here this one and this one and I want to make them both bold well let me just position my cursor in both of these h4 so we can do it at once and we'll say the class is equal to and to make it bold we say fonts - bold if I save that and preview of a hill then we can see that this and this is now bold now what if I set them to light so again let me select both of these and change it to the light save it and we can see now this is a lighter font way so let me go back to bold because that's what I want to keep it at and I also want to make some other things bold as well so let's go right up to the top so I want to make this H one right here bold so to do that I'm gonna say class is equal to font - bold like so and also I want to make this uppercase now I could change this right here but I don't want to I just want to give this a style of uppercase now to do that I can just say uppercase and that is a class to make something uppercase so if I save this and preview we can see now this is all in capitals and it's bold all right again I want to make this one bold right here where it says home so I'm gonna say font - bold and save that we should see that this is bold as well and now we can see that dark call it is more prominent when something is bold all right so let's do two more things let's go down to these things right here the h2 and the h3 and instead of being bold this time I want to make them semi bold so not quite as bold but still a little bolder than normal so to do that we can say font - semi bold and the same down here fonts - semi bold save it and let's come over here and now we can see these are quite bold as well awesome so there we've got my friends that's how simple it is to control the text color and the font size and also the font weight and again do check out the docs because all of the classes - everything you could possibly want in here and all you need to do is search for whatever you want to find so next up we're going to look at margin padding and borders

Original Description

Hey gang, in this tailwind tutorial we'll take a look at some of the font & color utility classes. 🐱‍👤🐱‍👤 JOIN THE GANG - 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 Files: + https://github.com/iamshaunjp/tailwind-tutorial + Full html template - https://github.com/iamshaunjp/tailwind-tutorial/blob/lesson-2/public/index.html 🐱‍💻 🐱‍💻 Other Related Free Courses: + https://www.youtube.com/watch?v=hu-q2zYwEYs&list=PL4cUxeGkcC9ivBf_eKCPIAYXWzLlPAm6G Download node.js - https://nodejs.org/en/ Get VS Code - https://code.visualstudio.com/
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 Reads

📰
React Introduction
Learn the basics of ReactJS and how to build dynamic user interfaces with this popular JavaScript library
Dev.to · Karthick (k)
📰
Why SnapDOM Beats html2canvas for DOM-to-Image Capture
Learn why SnapDOM outperforms html2canvas for DOM-to-image capture and how to use it in your frontend projects
Dev.to · Juan Martin
📰
I built 42 landing page templates as single HTML files (no npm, no build step)
Learn how to create simple landing page templates as single HTML files without relying on npm or build steps, and why this approach matters for efficient web development
Dev.to · Segcam spa
📰
Part 7B — Section 2 — React Event Handling Explained: Forms, Event Object & User Input.
Learn React event handling for forms and user input to improve your frontend skills
Medium · JavaScript
Up next
Elementor Angie Ai Plugin Tutorial
Quick Tips - Web Desiign & Ai Tools
Watch →