How to use a span tag or span class in HTML to change text
Daniel Walter Scott
Lesson Info
91. How to use a span tag or span class in HTML to change text
Lessons
How This Class is Structured
01:41 2What to Download
02:57 3Creating Our First Webpage
05:55 4What is HTML5 & CSS3
08:24 5Head vs. Body vs. Html Tag
09:01 6Title & Description
05:54What Code Editor Should I Use
02:42 8Using Diy Tags
06:26 9What is a CSS Class
09:05 10How to Create Nested Divs
05:03 11Class Project
05:24 12External CSS
09:07 13Creating Our Index Style Pages
12:16 14Testing Your Website
08:47 15Check Your Code For Errors
11:01 16What are HTML5 Structure Tags
05:47 17Add HTML5 structure elements
16:02 18How to Set the Color of the Background
05:10 19Adding Images to a Website
04:38 20How to Center an Image
01:14 21Change the Font Size & Color
14:11 22Make a Clickable Link
08:45 23Stretching Background Image
05:38 24Making a Div Tag Transparent
02:36 25Simple Website Text Navigation
06:43 26CSS Compound Classes
07:02 27Class Project 02
02:05 28Class Project 02 - COMPLETE
04:48 29Add an Email Button to a Website
03:49 30Add Google Maps to Your Website
11:25 31Making a Website Live
16:50 32Uploading via SFTP
11:50 33Setting Up Our New Project
03:46 34CSS Reset
15:22 35Min-height vs. Height
07:01 36Div Tags Onto One Line
05:23 37Getting div tags onto one line using Flexbox in HTML & CSS
05:23 38Evenly Spaced Div Tags
04:42 39Two Div Tags of Different Sizes
07:13 40Vertically Center Content
07:20 41Class Project 3
02:51 42Class Project 3 - COMPLETE
05:39 43Change Default Fonts
04:19 44Installing Google Fonts
12:44 45What are PX & EM & REM
14:56 46Change Line Height
04:33 47SVG vs. JPG vs. PNG
07:04 48How to Create a SVG, JPG, or PNG
11:00 49Block Images vs. Background Images
08:32 50Finishing Up Our Cards
09:10 51Icons via Font Awesome
16:31 52Making a Div Container Clickable
09:55 53Box-sizing & Border-box
06:19 54How to Make A Colored Button
07:46 55Why Can't I Add Margin or Paddding
11:08 56Rounded Corners
04:17 57Drop Shadows
06:24 58Backup Your Website
05:00 59Reusing a Button Class
03:10 60Class Project 04
02:58 61Class Project 04 -COMPLETE
05:45 62Adding a Horizontal Rule
03:51 63Make Divs Wrap Onto Separate Lines
12:14 64Hover Color & Animating a Button
03:33 65Pseudo Classes
09:31 66Simple Dropdown Navigation
20:04 67Adding Our Dropdown to the Website
14:50 68Useful Shortcuts and Tips in VS Code
13:28 69Large Background Image
09:24 70How to Connect 2 Pages
10:42 71Simple PHP Form Work
17:49 72Placeholder Form Text
05:46 73Multi Line Form Text Box
02:18 74Form Check Marks
03:04 75Form Radio Button
06:07 76Form Drop Down Menu
05:48 77How to Style Your Form
12:55 78What does responsive website design mean
04:17 79How to change a website layout size color when at different sizes using media queries
11:28 80How to test your website on a tablet or mobile phone from Visual Studio Code
06:00 81How to change the layout of a responsive website for mobile vs desktop
16:02 82How to turn things on and off for mobile tablet & desktop responsive websites
06:03 83What is pixel density responsive images pixel ratio dp px in webdesign
14:47 84How to export responsive images for website from XD Photoshop Illustrator
05:11 85How to add responsive images to website using 100% width in HTML & CSS
06:08 86How to use srcset to change images in HTML for responsive website
10:15 87How to add a css style to the first line of a p tag on a website (
11:18 88How to make the header footer full width but the inside centered
05:36 89Class Project 05 – Header design
03:12 90Class Project 05 – Header design COMPLETE
06:25 91How to use a span tag or span class in HTML to change text
10:32 92How to pin the navigation to the top of a website fixed nav
03:17 93How to make a simple responsive mobile menu using CSS only
08:21 94What is Javascript vs Jquery in website web design
06:35 95How to make a burger menu 3 line mobile navigation for a website
15:11 96How to switch a menu nav from desktop to mobile phone
21:45 97Overview of what Bootstrap 4 is in website design
07:57 98How to install Bootstrap 4 on a website using Visual Studio Code
06:27 99Quick overview of how the Bootstrap Grid Layout works in VS Code
10:49 100Quick overview of how Bootstrap Components works in VS Code
09:23 101Quick overview of how Bootstrap CSS Styles works in VS Code
08:20 102How to customize the default Bootstrap 4 css styles
13:51 103How to use Bootstrap Layout Grid Experiment 1
10:20 104How to make 100% header & uneven widths in Bootstrap 4
07:16 105How to create uneven col widths in Bootstrap 4
07:27 106How to add padding & margins using Bootstrap 4 in VS Code
12:03 107How to change layout of Bootstrap depending on mobile or desktop
15:46 108How to turn things on & off on your website using Bootstrap 4
05:30 109Google Chrome Inspect
12:40 110Add Shadows to Text & Boxes
07:06 111Change the Default Buttons
06:16 112Responsive Images in Bootstrap 4
09:34 113How to Center Text & Div Tags
04:16 114Customize the Bootstrap Navbar
07:29 115Add Your Own Logo
03:58 116Change the Default Nav Styles
12:12 117Fix the Navigation to the Top
04:41 118Col Images & Col Background
07:56 119Bootstrap Border & Rounded Corners
04:20 120Bootstrap 4 Carousels
05:13 121Card Groups
03:29 122Drop Shadows On Bootstrap Cards
02:25 123Clickable Boxes in Bootstrap 4
04:02 124Final Quiz
Lesson Info
How to use a span tag or span class in HTML to change text
Hi there this video we are going to make this part of the single line bold by leaving this not bold using something called a span tag. Okay. It looks like that. We're using a span class in this case it just wraps around just the words that we want to change. It doesn't break onto two lines and you style it in your CSS. Let's jump in, work out how to do it and then why we'd want to do it. Plus if you've already done a span tag, you're like don't need this one flip to the end of this video. I've got like a secret extra little bit that we're going to do in terms of changing our preferences. Little tasty treat at the end. Alright, let's get started. Okay, so let's talk about word wrap. I want to wrap just around this line here. Okay, well just these words here, so let's figure out how to do it. There's kind of two ways. So depending on your research project, depends if you've got Yeah, it depends who you got. I'm going to show you both ways so first of all find the text Okay here And we ne...
ed to wrap it up in a span tag. Okay? So I'm going to use my sweet command shift P. Or control shift P. Okay. And I'm going to type in rap wrap even so we're gonna wrap without abbreviation and we're gonna type in span. So either side of it needs span S. P. A N. It's my accent so you don't have to wrap it. You can just type it in either side. Now. You've got two ways of implementing it. You've got kind of straight up in line CSS or you can do what's called a span class. So we'll do the straight up CSS straight in here. And what you do is you style it. Okay. And you start doing, what is that font? Wait and you do, it's called in line CSS. Okay. We're going to go to our bold and that hopefully should do it. Let's have a little look. Refresh. My review is not working. Go live now. It's working awesome. Alright, so old version, I'm not sure why that died. But anyway, we're back and that has made it bold. Okay. And that is perfectly fine job done. If you did it that way we're in business. The only trouble with this way is let's say we also want to color it. If you want to change the colors, you're gonna put in a semi colon, you type in color like we normally do colon and I'm going to pick a random color. Forest green, save it. Let's have a little look and its forest green. Okay. And let's say we also want to do something else and you can see how ugly is not the word, it's ugly as the word. It just gets long and there's so much going on here. This should be over here in our CSS. Okay. So the other problem is it's not reusable. So I want to do this again. Okay. I want to wrap something else. I'm gonna have to grab that bit. Okay. And let's say I want to do it to this last word in our first tab here. Okay. So I wrapped the beginning there. Okay. And it's given me automatically my span and the end closing of the spans opens up says all our stuff. There's our word closes with a slash span and it works okay. But I've got it twice and it's starting to get big and heavy. Ok. So essentially nothing wrong with that. But let's show you a classier way to do it. That's a good word. Classy because it's class. See what I did there. All right. We're going to give this class a name. We're gonna call this one bold. Okay. And over here let's style it where maybe just before the tablet starts. Okay. So at the end of my global, so this one's gonna be called bold. You can kind of see the the niceness of this. So what is that font weight. Okay. And we're gonna pick and that's just a classier way. You can't use the joke twice then come on. Just a nicer way of applying it. Okay. Instead of in line it is this and the cool thing about it is it's reusable. Okay, Because we could call this bold and we could call this one like highlight. Okay. Okay. Then we get to add a bunch of stuff to it high light and then we could say all right, it's going to be a color of random color. What's today? Medium purple, You know? And we can do font size. You get what I mean? Right. 20 pixels just for giggles. So this is quite nice. It's a bit heavier over here. Let's have a little look at how it's doing. Okay. But I can reuse that as well so I can say down here. You are also going to be a span tag of who random shortcuts. What did I do? There we go. You are going to have my command shift. P control shift P. You're gonna have a span tag and you're going to have a span class of what was it called, highlight highlight. All right. Let's have a little look. There we go. Alright, I'm going to switch it back to bold and one thing we'll do before we go. A little a little tasty treat at the end of this video. I'm going to show you something cool. So let me just get this back to I'm gonna leave it as highlight. But okay. And just get rid of this. How does it look now? Perfect. The last one's bold. I'm okay with that. But that was the thing I wanted to do. All right. One thing before we go is explain why we're not doing it in like say two separate div classes or P tags. Let's just have a little look, I'm going to close down the styles for the moment just to show you what it looks like. So I'm going to duplicate it. I'm clicking anywhere in the div and I'm using its option shift down arrow on a Mac. And that will be able to shift down arrow on a Pc. Okay. And I'll look at doing it this way. We'll separate them out so you can see. So let's say we get rid of our span class and we're gonna do it a slightly different way and and I'll pretend that I only want to like the word daniel. Okay, on make a bowl of just daniel. So what I could do is I could create. So I've got a div tag for logo. I could make P two P tags. Right? I'm gonna wrap that in a P tag, nope wrong one. Let's go commercial p wrap with abbreviation P tag. Great. So alright, that's kind of nice ish. Okay, so I'm gonna wrap that up. The first big problem is even though it's on the same line because a P tag is a block level tag, even though it's on its own line. Okay, let's wrap this in a different P tag. P let's go wrapping tag previous. Previous. Let's tidy that up now when I'm moving around in these big chunks, some on a Mac. I don't know if this is true on a pc. It probably is. I had done the option key and use my left and right arrow. That's how I kind of jump across these lines on a pc. Give it a try. It might be all that's left and right arrow. And if I hold down the shift key at the same time, so my MAC its option shift, it kind of selects that big jump so I can kind of hold option and shift and click my left arrow and you can see it just kind of highlights all of that. Alright, that wasn't what I'm telling you. But these are two separate P tex and now I get to style this with a class of highlight. Okay, highlight. Okay. And it'll work kind of except now and here. Oh, there's my second one there it is on two separate lines. Okay, so I wanted to be on one line and a span tag does that is in line not block. So I could now go and find my P tag and say if it's the P tag inside of logo display in line. Okay. Online block So that it doesn't drop on to own its own lines and that would work. My problem with it though, is that google, its search engine will see that as a separate bit of content from this. So let's say we did it for logo. So logo was bold but this wasn't that end up on two separate lines and google would not connected to easily. Okay. It doesn't know you're all about logo design, it knows you're all about logo design. So the two separate kind of parts to the page. So I like to make sure like especially for things like H ones and headings very often I want them on two lines and I want to do some different styling to those two lines just because I'm a designer and unfortunately separating with P tags or two H ones, it's going to break up the content so that it might not string together for the search engine and this is just a little nicer. Right? Alright, goodbye you. Let's close it all up. Oh, I promised a little treat at the end. Cool. So I'm gonna open up my styles double click it, drag it over here. Okay, Every time I close down V. S. Code to go have lunch or go to sleep, okay, I'll wake back up and I have to do this. You've noticed it before we have to go to view were like would wrap again, there's a shortcut but imagine if we just turn it on forever. So I'm going to show you some parts of going through and editing this thing and changing the preferences. It's kind of weird compared to other programs. So what you do is you go to view command palette, we've been using our shortcut. Command shift P on a Mac. It's control shift P on a Pc and you end up with this and we've been using it to do em it wraps. What we want to do is go to settings. Okay. And out of all of these, we want to go to this one that says user settings. Let's open that up. And in here it's worth taking some time to go. Have a little look through things that you were like, oh I'd like to change this. The one that I want is word wrap. So this little search box up here is searching the settings and I can say rep okay. And there's word wrap and controls. It's off by default. We're gonna turn it on by default and we can turn it off if we don't need to. There's also the other fun stuff in there. But that's the one I want at the moment it's closed down settings And now every time I open it up for the rest of this course it's gonna word wrap hopefully. Alright. That is it span tax. We did span in line CSS. Okay, so just a span tag and now we've done a span class. If you did something slightly different. How else could you have done it? If you did something else different and it works? Send me a screenshot of the code that you made it work. Okay put it in the comments or tag me on social media. I'd be interested to see what other ways you creative ways you made it work. Alright. That is it for spent tanks
Class Materials
Ratings and Reviews
Viwosoft Technologies
Great tutorial - your clear instructions and concise explanations make learning HTML5 & CSS3 a breeze!