Skip to main content

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

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

Daniel Walter Scott

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

Lesson 91 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

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

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 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

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