YouTube Transcript:
CISIWEB 72 Chapter 3
Skip watching entire videos - get the full transcript, search for keywords, and copy with one click.
Share:
Video Transcript
Available languages:
View:
hi everybody
we're gonna cover chapter three so we're
gonna learn
how to uh code using
css cascading style sheets so a little
bit of
bit different than what we did before with
with
html we'll kind of do a quick review of
what we've done with html and then get
started with our css
okay and here's what we've got so this
is what we did the basic
10 tags um for html
last week we have our doctype we have
our html language equals
english we have our head our open head tag
tag
we have our title close title meta
character set up is going to be the um
standards of utf-8 then we close our head
head
remember anything that's inside the head
will not show up in the body
of our document and then we open our body
body
close our body and close
html okay so those are our basic tags
that we worked with
last week the stuff we're going to be
dealing with this week
yes we're going to still use html but
we're going to add
some new things this is called css
cascading style sheets and i'll show you
what it looks like
it looks completely different so you
have these things that you have
selectors like this one here the body is
called the body
selector and then we have declaration
properties and declaration values
now the declaration property in this
instance is color and the value
declaration value
is blue it's a very standard layout
you're going to have your body
you can tab over you're going to put the
scrolly bar
put your declaration property
put a colon a space and your declaration
value and always end with a
semicolon now there's a few errors in
your book
your book will show you um i think the
first instance they have it without
a semicolon at the end and with no space
in between here that's not
that's not how you do this you're going
to want to make sure you have a space in between
between
your colon and always end with
a semicolon we can also
add to this let me make sure i've got my
list of everything i want to add on this
uh we can stack them okay so we can have
more than one set of
properties and values declaration
properties and values
in one so we can type it like this
you can type it like
this and spread it out
that's perfectly fine you can
you can add additional
decorations in here so let's say we want
to do a background color
we can put a space and then background
and you'll see that it's in um notepad
plus plus
screen pop up so that you don't even
have to type the whole thing so you can
just click on it
and there you go background color we'll
say is
yellow semicolon and
always close your
scrolling bars now you can do it like this
this
you can keep that scrolling bar up top
like this you can spread it out
i prefer doing this uh you will have to tab
tab
tab over on the first line and then tab
again for the second line
but if we add an additional declaration
it automatically all it's not doing is
making a liar at me
we can have an another one that it
generally will automatically tab over
for you i'm not sure why it didn't do it
just then
um let me think of like another what we
can do we can do a font size sure
um font oh my tabs got screwed up that's fine
fine
and say 18 point
semicolon and you can keep
adding to this list you just need to
make sure you have your open and closed
codes in css so this here
is the selector and these are
your declaration property and
declaration value
the color and then the blue okay so this
is what we're going to use
we can use css several different ways
there are three different ways that
we're going to talk about we've got
inline css we've got embedded
css and we have external css
inline css means it's in line
with the html which means i can
put inside any of these html tags
let's say i've got an h1 that i want to
put in here
and i can put style
which means it's going to be a style sheet
sheet
uh type tag but i still have to follow
the rules
of css so this is like an attribute and remember
remember
when we have an attribute so if we look
up here at the lang
equals in quotes
en you still have to lay it out very
similar to that
so we would still put style we would
still put in equals and we would still
put a
quote but then we would type
our declaration property and declaration value
value
so let's say i want to do
style equals uh we'll say color
this actually is for the font
equals and then i'm going to show you a
hexadecimal don't worry right now i'll i'll
i'll
talk about this
and then close our quote
this is called an inline style sheet
so it's in the same line as our html
there is an embedded style sheet
embedded style sheets go up in the head
and remember
last week we had head header and headings
headings
okay this is the head of
our html document this is a
head ing h1
there will be also a header when we are designating
designating
a header a footer a
um the main the navigation area
divs divisions
so don't get those three head types
screwed up the plane head is up at the
top of our html
h1 h2 h3r head
in tags and then there's head
embedded css
is inside the head okay
and we would add a style tag
type in all of our uh
selectors and declaration properties and then
then
okay give me one second to make my
daughter be quiet [Music]
okay
so again
inline is going to be in the same line
as the html code
embedded will be embedded inside
of the head and then
external we will move it from this document
document
to its own document that is saved as a dot
dot
css file okay
so let's work on some of what these
uh selectors and declarations look like
and get used to those so we can
inside let's let's just go ahead and
work with a
uh an embedded so let's say we want to change
change
the body and do some coding for that
so we type in body and again we use
these curly
brackets and let's say we want to give a
background color
so background dash color and again i can
just scroll right in this list and hit enter
enter
and it will enter that in for me so i
don't even have to type the whole thing in
in
background color and here's colors
there are 256 pre-defined
colors so there's red there's blue
there's yellow there's green there's
aqua there's
silver there's white there's black
there's all kinds of colors
if it's a common color name you can
probably just type the name
or you can do something called
hexadecimal code which is more
flexible and allows you more colors
if you scroll to the back of your
book there is a
you find it what page that's on
there is a table that is
teeny teeny teeny tiny
um and it's in
the where is it
in the appendix it's one of the early appendices
it's got very teeny tiny writing so if
you've got good eyes you can see that otherwise
otherwise
it might be easier for you to google
hexadecimal code
color properties and find that table
let me see they do it all on one table
here it is web saved color palette
it is
appendix h in the back of your book
um if you have the bound book it's on
663 and the way it breaks down
the colors is it
16 colors so hexadecimal
x 6 plus deca 10
0 1 2 3 4 5 6 7
8 9 a b c d e
and f okay so you get 10 numbers and six letters
letters
that give you a total of sixteen zero
is the lowest number f is the
highest and the way it breaks down
is red
green and blue there are two digits for red
red
two digits for green and then two digits
for blue
so let's say we want just
red okay pound sign
and it's rgb so i would go to the
the highest number which is f f f
and then zero zero zero zero what that
gives me
is all red
zero green and zero blue
so that will end up giving me a bright
red background color
if i want a blue background color
zero zero so that would give me zero red
i'm sorry if i want a green background
zero red all green no blue
if i want a blue background it would be
zero zero
zero zero f f so all of the color would
be in the blue designation
so let's think about this what is
that would be white i know
your first instinct is to think okay all
the colors it's got to be black
it's not that's white that's just a
spectrum thing
uh color spectrum thing all colors together
together
are make white black is actually the
absence of color so i would have no red
no green and no blue which would be
that's black um and then
everything in between so you can have
you know
a a e e
1 1 okay so you have red some red some green
green
and some blue
okay but less blue in in that instance so
so
zero is the lowest so zero one two three
four five six seven eight nine
and then a b c d e f f is the highest
okay there's also a three digit
code one red one green one blue uh but
this is pretty standard for you to use
the actual hexadecimal
some people will throw down the
predefined colors you know red or green
or blue or something like that
but just about everybody is going to
really use the hexadecimal
uh numbering system so you should you
should probably get very used to that
okay so that will give you a background
color uh
it well you should probably not to do
black let's do a light blue so if
i say i want a light blue i would say no red
red
no green and maybe
a three for blue that'll give me a light blue
the color declaration
that is actually font color okay so you don't
don't
type font dash color it's just color
that will be your font color
there's a colon for that and we would
use some hexadecimal code
a very dark blue so let's say
zero zero zero zero zero zero and we'll
say ff
again we can stack them inside of each
and then make sure you would close your
scrolling bracket
but let's say we want to just do a quick
down and dirty
um font color
we can do that down here for that h say
the h1
we're going to change that let's make
that actually um
black so let's say
and we are going to do we're going to
just do a website on cats tonight i have no
no
imagination we did dogs last time we're
going to do cats this time
close that h1 now what i've got here
is an inline style that
will override
what's inside inside the embedded style
sheet now i will talk about how they
cascade and why they're called
cascading style sheets once we have an
idea of what they actually look like
so h1 style color
cats close rh1
save this i've already i've already
the dot cats.html.a is super important
if you don't do that it will default to
a text file
and then it won't work everything will
look funky
so file i'm just going to go to save as
you can see
it is cats.html type that out
oh it doesn't like me to do it doesn't
want me to rename it but
let's say in my h1 i want more than one
style can i add that inside those quotations
quotations
yes i can go ahead and do that so [Applause]
[Applause]
we need to make sure we separate it with
a semicolon
and let's say we do a
colon and then space pound sign and
let's see what kind of background color
we want for it um
we can save this uh let me put a little
bit of text
down below so that it's not just a title
with the word cat
and we'll just pretend to take a
make sure if this uh if your
typing goes all the way over to the
right go up at the top and go to view
and make sure that word wrap is has a
check mark next to it so
you can see how mine has a check mark
next to it
and so it's wrapping my words
okay let me give you some blank lines
all right so save this and then we're
going to
uh oh what did they do um
this one's saying that it's saved as a
text file oh
i must have selected the wrong one
okay let's go back in and see what we
got wrong in here obviously something's funky
html and we'll save it in documents
save one here
i don't know what was wrong with that i
didn't change anything
okay so obviously the colors are crazy
but we do have a background color of blue
blue
we have a it's way too dark
uh we have a an h1
with a background color of white and the
font is black
so let's go in and change the
background color of the entire body
where did i do it did i do it at the top
i did okay so
let's change this to look up a decent
if and we'll go with that
it's terrible but it's at least we can
see what we've got going on okay
there are a bunch of tags that i would
like to teach you in this
so it's all css so we're going to go
through and
look at what this stuff kind of looks
like so we might as well stay in the
body that's probably fine we're going to go
go
up to the top just understand that you can
can
put css in line
that
we'll need you to put a style tag and
the more common way is to do
a embedded which means it's embedded
inside the head
and we can just keep going and type tons
and tons and tons of css code
all the way up here in the head so
let's kind of look at some of these
other ones we've got
font and and notice if you look at
what comes up for you you've got font
family that's basically what
your font is you've got your font size
you've got font stretch font
size adjust you've got font style font
variant font weight
a bunch of different things that we can
do with the font so we're going to go to font
font
short little font size now
font size generally you're going to just
put some kind of
point font so font size let's say we
want it 20.5
and then there's something called font weight
weight
font dash weight font weight
if we were just using html the font
weight would be um
done with strong
okay it's a an html tag called
and you would use that for something
if we want to do that just in html it is
text align is going to be your left
right or center
by the way this is not what you're going
to use for your
homework when you're centering the entire
entire
page for your homework they want you to
do a wrapper and we'll get to a wrapper
at the very end
we've got text decoration now
in your navigation text decoration
colon none and we will change this eventually
eventually
for our navigation area because if you
create a hyperlink
it automatically changes it to blue
and it will automatically put a line underneath
underneath
and sometimes we don't want to line
underneath it just looks weird looks funny
funny
you're going to have text dash
decoration equals none [Music]
[Music]
we've got text indent
there are several ways we can do a text indent
indent
you can do it in pixels which will be px
so we could say indented 10 pixels
we can say um
indented 10 ems okay so this is
like we've used before we had em for
emphasis for italics
m's is also something else it
actually stands for how
big the letter m is
so the letter m is the is the longest letter
letter
it is you know it's a certain width and
we can say
indented five the equivalent of the
letter m's
okay so five m's em so we would change
that px
that's a very big indent so let's change
that to
you can have text shadowing let's not
put that in the body let's put that in
something like an h1
i just type h1 tab over
and open my scrolling bar i'm
immediately going to close my scrolling
bar because i'm big on forgetting that
i'll just push it down at the bottom
and let's say we want to do a text
shadow now text
has four components to it
okay it has the horizontal offset
so left and right how far the shadow
shadows gonna go it's
got the vertical offset so top and
bottom of how far the
shadow is gonna go it's got a blur
radius and then it's got a color
so when we do a text shadow colon you to
have four things
laid on that so we i'm gonna say three px
px
so three pixels of a horizontal offset
we'll say it's a two pixel vertical offset
offset
we'll say it's got a blur of five pixels
red that's fine you can also put
well let's see what all this is done
we've already done quite a bit so let's
control s to save it
and come up here
and refresh this all right so
you'll see in that h1 we have
a vertical offset a horizontal offset
a blur and then a color
of our shadow
you can make this gray you can make this
a normal gray everything
is centered because we did our
text align we have a font style of
italics we have a font weight of bold
we have a font size of i think i did 18 pixels
pixels
we didn't do any letter spacing yet so
we did the text shadow [Music]
[Music]
you can also do something called transformation
transformation
text transformation which means if you
typed it all in lowercase
and you want everything to be an
uppercase you know capital letters
you can do a text transformation uppercase
uppercase
or if you typed everything in uppercase
and you need to transform some of it
there is another thing that you're going
to have to learn to use which is called
the a class
selector or an id selector
these are important we use these a lot a
let me also go in here before we start
doing this
um and set in our
down here in the body of our html document
document
that's going to be our h1 so i'll
surround that in header
so i don't want to forget to do that we
have the main part of our document we
don't have any navigation on this one
yet i guess i can make some
we don't have a footer we'll add one
so we'll put our address here
break the line uh
we'll say ranches red school is rancho [Applause]
i don't know the zip code so we'll just pretend
pretend
uh california and then oops like the
and we'll give it a fake phone number of
909 555.
five five five five okay
we should probably add some type of hyperlink
hyperlink
in a navigation area so let me go after
my footer
we'll insert a nav area
close the nav and
well we'll link to that dogs page that
we made right
quote dogs was a dog or dogs and it was dogs.html
dogs.html
and we put our dog's website there and
then we'll close that a
anchor tag and then i'll put in another one
one
and we'll have a href equals
quote http
www.disney.com
and remember when we're jumping off site
we've got to type the entire url
disney and then close my
anchor remember
anything between the open
and close of an a tag is the hyperlink
so the word dogs here is a hyperlink
i can hit a hard return here it won't matter
matter
it's not going to put it underneath it
because i didn't break the line
and there's enough room for dogs and
disney to be on the same line
so let me save this we'll take a look at this
i hope that's recording properly okay
and see how we have dogs and disney
and they have underlines on it let's
take that underline off
so wonder why that did that let's look
properly
oh because i started the paragraph
that's why
i need to start a paragraph well i
should teach you the proper way
okay um
that is that looks like that's properly centered
centered
but rancho is not perfectly centered
neither is the phone so we'll have to
look at that and see what's going on
here um [Music]
[Music]
we broke the line that shouldn't do
all right not sure why that is getting a
little freaking fine maybe we should
see what it looks like in edge i don't
think i've set any of these
up to run though yeah i haven't leaked anything
yeah i'll do that later hopefully
remember to do that
before my next video uh
maybe it'll look better in edge maybe it
is something
or i know you guys love chrome i don't
even have chrome on my machine because i
don't like it
um let's let's take
off the uh underline
on our navigation
so text decoration on
an a okay so
and we are going to say scrolling bar
pulling scrolly bar save that
and in theory that should take off these
all right back to class selector and id
selectors this is a big deal uh and
you've got to remember which is which
you got to think about this you can be
in more than one class right you can enroll
enroll
in more than one class this is how i
remember it
class selectors you can have more than one
one
time you using it
and you can use it more than one time in
the same document
an id selector once you name an id selector
selector
think of it like there you only have one
driver's license you only have
one id at least legally at least okay so
you can only use the id selector
one time this is what this thing would
look like
if i make an id
selector so i'm going to identify a region
region
so let's see um
well let's just do a wrapper let's
actually do a wrapper
this is something that you're gonna have
so the first thing up right after
opening the body i'm going to
insert a wrapper
so i'm going to put div which is a division
equals wrapper
and then i'm going to close that
division at the very very very
end of the document just before i close
okay so now my open and closed division
is wrapping the entire
document my entire thing that's going to
show then up here at the very top
i'm going to code for that wrapper and
i'm going to put a pound sign
which says look for something in this document
document
called wrapper id wrapper and
let's i'm going to actually use the same
code that your
um book uses so that we stay consistent
960 pixels that's approximately how wide
of a screen you want it
you want a little bit of space on either side
side
960 pixels you can use percentage
instead if you don't want to if you can
say 80 percent of the width of the screen
screen
so width is 960 pixels
margin left
again auto
look that they have one more thing it's
not coming up
fear 329 is what it's referencing
oh so that it looks like 329. i see what
so let's say that and we're going to see
the difference
of doing this id selector
okay so i've told
my html where this id
is going to be in my html and
up in my css oops forgot to close my
scrolling bar
i have given it
what kind of formatting i want so save that
that
go back in here and take a look at what
that's going to do
wrapped the whole thing and centered it
on my page
and gave me a defined width
again i can use percentage if i want the
the bonus with using percentage over
setting pixels
is that in this in that case it doesn't matter
matter
how big or wide or small
the user's screen is
it will take up 85 of whatever monitor
they're using so this is actually a really
really
cool feature to be able to just hit it
into percentages
so i'll show you this is going to make
it a little bit bigger i think
yeah okay so 85 that's what that looks like
class selector okay again
we're gonna have to tell it where it is
in the document and then
up in the css we will code for what we want
want
that region to look like so let's
put a class selector
right here okay so
i don't know you know what let's do
let's do something different here let's do
do
a close my paragraph here i'm
showing very bad habits close my paragraph
paragraph
oops that's capitalized for some reason
and then i'm gonna uh type up really quickly
quickly
in unordered list okay so let's give
myself a break
and we'll make a bulleted list so ul
and again for every line item that i
want on there
i have to have open li and then an immediate
immediate
and then close my unordered list
so let's say i've got three items on my list
i'm going to copy my open li close li
i'm going to paste it twice scroll
up so you can see what i'm doing and
above that ul i better put like an
h i'll call it
h2 and we'll title this
types of dog
breeds close my h2
otherwise i have a really giant
unordered list
and i don't know how to spell shih tzu
so i'm gonna guess as i
i don't know how to spell chihuahuas
we're not going with that one now
there's a bunch of h's in it
look at our new sorry
we're doing cats not dogs see how
everything's centered that looks terrible
terrible
um we should probably modify
our body here we've got text align center
center
let's not let's say text align
left that'll look a little bit better
and we can center say the
h1 so text
in the center and then that way
that part is centered but
okay we're getting some really weird
okay oh i know why because
we did a weird thing up here what is it
um text indent five ems i'm actually
going to take that off
because it's making everything funky [Music]
[Music]
there we go much better okay
we want to center our navigation too i
now that's a region so we can just
add nav oops that needs to back up
nav tab over
scrollybar and we want text align
and i'm actually going to put some
separations here so that we can
spread this out and see where one starts
and the next begin
okay i'll put this one back up
okay save that
uh class selector so let's use the class selector
selector
unordered list so let's say
we want to have
this line item be a
class equals
um your book uses
feature i'm gonna you can use any word
you want on this it doesn't matter what
you use
so class equals um we'll just call it pretty
pretty
we're gonna pretty this up a little bit
okay then at the top up here
like i did with my wrapper it had a
pound sign to designate that it's an
and the word pretty so that period
designates that that is a class
selector so this says it's a class selector
selector
this tells us it's an id selector
pound sign you can only use it once only
one id selector
this class selector i can enter this
class all over my page and i'll show you
so let's do
something here we're going to make the
and i'm just going to do this quick i'm
going to say green
now i'm done okay so that one's going to
be green
and then we're going to say font weight
oh wait everything is bolded already so
never mind
okay so save this
and now this one is green
again class selector i can use it
many times and i can just put it
wherever i want and in
whatever kind of tag i want so let's say
i want to say division
class equals pretty
close my division here so i've
designated the area
and i've called it pretty saying that
it's a class
called pretty again i put class equals pretty
pretty
in an li i can put it in any of
my tags watch i'll take it out of li
and i'll put it in the entire ul
now the entire unordered list will be
green so let's save that
so you can put it in any tag you want
but if you want to just name an
area really quickly just put in a
so let's go in here and you'll see that
now i've got part of my paragraph
as pretty oh i've sorry i put it in a
division tag
um and
my entire thing here now let me think
for a second
of what i can use so that it won't break
um
it's not coming to me there's a bunch of
them that you can use for that um
i don't want it to break the line um
well hopefully it'll come to me by the
all right we've done the id we've done
the wrapper
we've done all of that oh yes last thing
that i want to talk about is the
cascading effect
so the way these apply
is the first kind of
formatting that gets applied to your web
page are the browser defaults there's
nothing you can do about those
the browser defaults are just the
browser defaults they're
whoever's machine whoever owns that machine
machine
can set the browser defaults they can
change it you can't control that
but those get applied first to your page then
then
an external style sheet which i'm going
to show you how to do in one minute
all of that formatting gets applied to
your website
then embedded style sheets so
the code inside of
our head here can
override the code that i have
in my external style sheet
and then the last formatting that gets applied
applied
is in line style sheet
code now why would you ever want to do that
that
why do they do this so let's say your target.com
target.com
okay and you have literally millions of pages
and you just want to change the
formatting on one of your
pages but you want the entire
let's say you decide all of a sudden
target wants to put the background
instead of it being white it wants the
background of every single page
in their website to be read you don't
want to have to go into millions of
pages and enter the code
that the background right here the
background color is going to be red
that would take you just so many hours
it's not even funny
what's better is if you have one
document that controls
every single web page
you want and i'll show you how to do
that we're going to pull it out right now
now [Music]
[Music]
so let's say we're going to make this
an external style sheet so i'm just
going to copy all of this
code i'm going to delete it and i'm
going to throw it in
in its own file i'm going to go file
save as i actually saved it as java jam.css
jam.css
and then i'm going to enter a line of code
code
original head okay and the way you're
going to see how to do that is go
very beginning [Music]
maybe they teach you that at the end yes
uh if you look on this in section
3.8 using external style sheets it'll
give you the code for that
so i have made a
completely separate file with all of the
css and that's all it is it's all it is
it's only css
we go to file save as name it and dot
css then you go back into your html document
document
delete out these style tags and instead
in its place
inside the head you're going to put a
link tag
so link link and then
rel relation 2
equals it's a style sheet
okay and then the href the hyperlink reference
reference
is going to be the name of the style
sheet equals
and we called it cats dot html oh not
html sorry cats.css
and that's it now i have linked this
html file to this
it's much faster to type one line of code
code
into my millions of pages that i am that
i have if i'm target
and only have one css
than it is to type this every time in
every single one of my documents
but let's say i want to overwrite it
let's say one page i want one page to be special
special
i don't want to modify this i want all
of the other millions of pages to be the same
same
but let's say i have one page that i
want to override
well i can because i can do it up
in the head i can do an embedded style sheet
that i can change one little thing
so this all applies the css
applies but i can also enter style i can
also still have
my style tag and override this
particular page
and even more let's say i don't want to
do a big huge thing
where i'm overwriting a whole bunch of
things i just want one little special thing
thing
i can do that in line okay
so that's why this is the last type of
formatting that gets applied
okay so the first thing that gets applied
applied
is any of the browser settings on the machine
machine
that whoever is looking at your website
then the external style sheet
and then overriding that will be the
embedded style sheet
and then overriding that still is the inline
inline
now the very last thing for this chapter
is the validator
okay they want you to run your
websites through a validator and that
means just to look and see
how well your document follows
the rules for [Music]
[Music]
html5 okay so
the website is okay and it's at the very
end of the chapter
the very last page of the chapter it'll
show you what it is
but it is http colon forward slash
forward slash
jig saw j i g
s a w dot w
three which is the organization that
sets up all of these standards
dot org forward slash
okay so it's http colon for forward slash forward slash
dot jigsaw.w3.org forward slash again css dash validator
css dash validator okay and we can say look by up
okay and we can say look by up file upload we're going to tell you
file upload we're going to tell you where our file is
where our file is so we're gonna have it check the
so we're gonna have it check the validation click the file
validation click the file by file upload go to browse
by file upload go to browse um this is cats
oh no kittens kittens isn't it dot open hit check
dot open hit check and let's see how many errors we've got
and let's see how many errors we've got congratulations
congratulations no errors found great
no errors found great okay and if there's errors in it it will
okay and if there's errors in it it will tell you where they are what they look
tell you where they are what they look like
like and how to fix them okay
all right that is it for chapter three have a great week you guys
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.
Works with YouTube, Coursera, Udemy and more educational platforms
Get Instant Transcripts: Just Edit the Domain in Your Address Bar!
YouTube
←
→
↻
https://www.youtube.com/watch?v=UF8uR6Z6KLc
YoutubeToText
←
→
↻
https://youtubetotext.net/watch?v=UF8uR6Z6KLc