navigate site menu

Become a member and get unlimited access to every course in the library. Try it free for 7 days

XHTML and HTML Essential Training

XHTML and HTML Essential Training

with Bill Weinman

 


In XHTML and HTML Essential Training, Bill Weinman helps designers and coders understand XHTML and HTML. In the process, Bill covers document structure, block and inline-level tags, floating images, controlling white space, phrase and font markup, and tables and frames. He even provides a good introduction to CSS. Bill offers step-by-step guidance for building a complete working web site. Exercise files accompany the course.
Topics include:
  • Understanding the structure of an HTML or XHTML document
  • Creating and using templates
  • Controlling white space and line breaks
  • Making effective use of tables and frames
  • Flowing text around an image
  • Formatting tables with CSS
  • Creating web pages that work properly across platforms and devices
  • Reviewing a case study of a complete web site

show more

author
Bill Weinman
subject
Developer, Web, Web Design, Web Foundations, Programming Languages, Web Development
software
HTML , XHTML
level
Beginner
duration
4h 44m
released
Jul 28, 2009

Share this course

Ready to join? subscribe


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:00(Music playing.)
00:03Hi! I'm Bill Weinman and welcome to XHTML & HTML Essential Training.
00:09In this course, I'll show you how to use XHTML & HTML to create and modify web pages
00:14that will work properly across platforms and devices, and continue to work
00:18well into the future.
00:19We'll start getting you up to speed by reviewing the different versions of XHTML
00:24and HTML, so you can choose the version that's right for your project.
00:29We'll go over the structure of the document and how to create and use templates.
00:33We'll cover how to use all the major tags and features, paragraphs and line
00:38breaks, phrase elements, font markup, headings, lists, hyperlinks, and URLs,
00:46tables, frames, and inline frames.
00:50And when we're done with that, we'll go over basic CSS so you can fine-tune the
00:54look of your documents.
00:56I've targeted this course for web designers and coders who work with XHTML and
01:01HTML either directly or with a WYSIWYG editor.
01:04I'm always excited to show both new and experienced designers the best practices
01:09to get the job done and to get it done well.
01:11Now let's get started with XHTML and HTML Essential Training.
Collapse this transcript
Using the exercise files
00:00 If you're a premium member of the lynda.com Online Training Library or if you're
00:04 watching this tutorial on a DVD ROM, you have access to the Exercise Files used
00:09 throughout this title.
00:10 So this is how the Exercise Files are organized.
00:13 You'll see I've got this folder opened from the Desktop here and you can see
00:18 that each of these folders corresponds to a chapter in the course and some of
00:24 the folders have sub-folders like this one here and it has these different files within it.
00:30 So it has sub-folders, then the sub- folders are numbered according to the lesson
00:35 within that chapter.
00:36 And if it doesn't, like in the case of this one, then it just has files within it
00:41 that are numbered according to the lessons within the chapter.
00:43 So this makes it easy for you to follow along.
00:45 You can open up these files in your own text editor and follow along as I
00:50 demonstrate the techniques in that particular lesson.
00:54 As a final note, this final chapter here, the website, has a different
00:57 organization and I'll explain that in the first lesson within that chapter.
01:02 If you're a monthly subscriber or an annual subscriber to Lynda.com, but do
01:06 not have access to the Exercise Files, you can still follow along from scratch
01:10 with your own assets, typing the lessons as you see me demonstrating them on the screen.
01:15 So there we have it.
01:16 That's the organization of the Exercise Files and the whole spiel about
01:20 the Exercise Files.
01:21 So let's get started.
01:23
Collapse this transcript
Choosing a text editor
00:00Let's talk about text editors.
00:02As you're working with HTML and XHTML and CSS and other computer code kinds of things,
00:09you're going to want to be using a text editor and not a word processor.
00:15So here's the difference.
00:17A word processor formats text.
00:20It has italics and it has bold and it has columns and it has graphics and
00:26all kinds of stuff.
00:28So as you type in your text, it's not just saving the text.
00:31It's also saving all of this formatting information what we in the biz call meta
00:36information along with the text.
00:39So when you're editing code like HTML or XHTML or CSS or a language like Perl or
00:46PHP or C or anything that's supposed to be just plain text, then you need a text
00:52editor that is not a word processor.
00:54If you use a word processor to do the exercises in this course, it will not work.
00:59You need to be using a text editor.
01:01Here are your choices.
01:03If you are on a Mac, and I use a Mac at home, I happen to use BBEdit.
01:08BBEdit is a fantastic text editor.
01:11It is not free, but it has many, many cool and useful features and
01:15I personally love it.
01:17Like I said, it's not free.
01:18The same people that make BBEdit make TextWrangler and the TextWrangler is free
01:24and it has almost all the features of BBEdit.
01:27It's actually a great text editor and if you don't want to spend the money
01:30on BBEdit, go ahead and get TextWrangler and you'll find that it works great for you.
01:35If you're on a PC and I work on a PC often and when I do I use Notepad++.
01:41I used to use another text editor that I'd paid for that was not free.
01:45That was a great text editor and over the years Notepad++ has eclipsed this
01:50other pay-for-it text editor and Notepad++ is free.
01:54It has many, many fantastic and useful features and the text editor that I'm
01:57using in this course on this video is Notepad++.
02:01Only bad thing about Notepad++ is the annoying animation on their homepage.
02:06The rest of the application is really, really cool and works very well.
02:10So there you have it.
02:11You must use a text editor, a plain text editor. You cannot use a word processor
02:16for this purpose and here are a couple of good choices.
02:19For the Mac, you have BBEdit and you have TextWrangler, which is free and is
02:24almost all of BBEdit, and you have Notepad++ for the PC environment.
Collapse this transcript
1. Introducing XHTML and HTML
Introducing HTML and XHTML
00:00What are HTML and XHTML?
00:02HTML is HyperText Markup Language, developed by Propellerhead scientists in the
00:08early 1990s so that they could share scientific papers over the Internet.
00:12It was based on SGML, Standard Generalized Markup Language, because SGML was
00:18designed to deal with documents and that seemed like the thing to do with the time.
00:22As the use of HTML spread and people started using its hyperlinks feature a lot,
00:27the World Wide Web was born.
00:29Then things got ugly.
00:31As the World Wide Web grew and grew, it became a more popular medium and a
00:34less scientific medium and HTML's limitations became a barrier to the web's development.
00:40People didn't want just words and pictures; they wanted presentation and they
00:44got it and HTML was extended to meet that need.
00:46As the saying goes, check all the parks in all your cities, you'll find no
00:51statues of any committees.
00:53As the web grew, the market demanded more presentation-oriented features in
00:57HTML and the scientists on the HTML committees, being scientists and not graphic artists,
01:01dragged their feet and the market said, okay, then we'll do it ourselves.
01:05Features were born of the necessity and they were chaotic and they were useful
01:09and they were chaotic.
01:11Over time, the Standards Committees caught up with the market and we now
01:14have HTML 4 and it's mostly functional and it mostly does what it needs to do
01:18and it's still chaotic.
01:20HTML 4 works and it works well and it has serious flaws that most people will never notice.
01:26What makes them serious is it takes a lot of computing power to take the average
01:30HTML page and render it in a coherent and consistent manner.
01:33That's what XHTML is for.
01:36XHTML stands for eXtensible HyperText Markup Language.
01:40Don't let the name fool you.
01:41It's not actually extensible.
01:43The X is there because it's based upon XML, eXtensible Markup Language.
01:48So it's technically an extension of XML, but XHTML was not itself extensible.
01:54Think of it as HTML but with stricter rules.
01:57The strictness of XHTML is good for computers.
02:00It makes it easier to build a program that reads the markup and renders the page
02:04or reads it to blind people or something else.
02:07Of course, the other side of the coin is that no one can force the whole
02:10Internet to stop using messy old HTML.
02:12So it's really useless, right?
02:13Well, perhaps that's true, but it's really not that much harder to write strict
02:18XHTML than it is to write sloppy HTML.
02:21So, I'm going to do my part and I'm going to show you how all of this works.
02:25Why should you use XHTML instead of HTML?
02:29HTML is very forgiving of inconsistent and even erroneous documents.
02:34XHTML requires the documents follow a specific and well-defined structure.
02:40Stricter rules means less variance among browsers and more consistent results.
02:43It means your web pages will behave more consistently on new devices and
02:47it makes it easier for developers to create wonderful new applications that will
02:50ultimately enhance all of our lives.
Collapse this transcript
Understanding versions of HTML and XHTML
00:00 There are a number of versions of HTML and XHTML available.
00:03 Let's take a look at them.
00:05 HTML 4.01 is the current version of HTML.
00:09 It has been in use since 1999 and it is still standard today.
00:15 XHTML 1.0 is based on HTML 4.01.
00:18 It is in wide use today for working websites.
00:22 It's easy to use and most sites that are XHTML use 1.0.
00:27 XHTML 1.1 is a very strict and stripped down version of XHTML.
00:32 It has no presentation features.
00:34 Instead, you must rely on CSS style sheets to do all your layout.
00:38 Unfortunately, not all browsers implement CSS with sufficient consistency to
00:43 make this work in all cases.
00:45 So, sites that use XHTML 1.1 are still pretty rare and for good reason.
00:51 XHTML 2.0 began in 2002 and was actively in development until 2006.
00:56 As of this recording, it's been pretty much abandoned.
01:01 XHTML 2.0 was designed to be a clean break from HTML with no requirement for
01:06 backward compatibility.
01:07 This never worked very well.
01:09 The browser companies weren't really very interested in it.
01:11 So it has substantially failed.
01:13 HTML 5 picks up where XHTML 2.0 left off, except that it is backward compatible.
01:19 It has a lot of exciting new features including XForms, which extend the
01:24 capabilities of HTML forms to include more data types, better formatting, data
01:28 validation and many other useful features.
01:31 XForms has been around since 2003 and is now in its second full version, but it
01:36 is not yet adopted by any of the major browsers.
01:39 The problem is that websites are already doing what XForms is supposed to do
01:44 with AJAX, Asynchronous JavaScript and XML.
01:47 So, XForms may be dead in the water. We'll see.
01:50 Although it's promising and interesting for geeky types like me, HTML 5 is not
01:55 very close to implementation.
01:56 A few of its features are supported by a few browsers, but not enough for it to
02:00 be useful for a public website.
02:03 This course will use XHTML 1.0 as much as possible.
02:07 All things considered, it's the best choice for a public website today.
02:11 Where it's relevant?
02:13 I'll discuss how examples relate to HTML 4, but I'll always show you the
02:17 strictness to most compatible XHTML 1.0, so that you know how to make your
02:21 websites functional, compatible and attractive.
02:25
Collapse this transcript
Exploring a simple XHTML page
00:00This is the simplest possible HTML document.
00:03This is all that's required in a document in HTML.
00:06You have a title and you have a paragraph.
00:09That's all that's really required.
00:11This is the same document in XHTML.
00:14This is the simplest possible XHTML document.
00:17You'll notice it's got a lot more stuff.
00:19You look at this document and you look at this HTML document and you've got
00:23to be asking yourself, why would I want to go through all this trouble when I
00:27can get away with this?
00:29That is an excellent question.
00:31The difference is the XHTML document is going to work more consistently across
00:37more platforms on in to the future.
00:40So that's why we care about XHTML.
00:42The truth is writing this document is no more trouble at all than writing this document.
00:48All you have to do is have all of this other stuff saved in a template
00:52someplace and whenever you start a new document, you just start from that point
00:56and typing your title and your content and you're going, and so it's really not
01:00anymore trouble at all.
01:01So let's take a look at some of the different elements in this document.
01:05Before we do that, we need to talk a little bit about terminology.
01:08So we are on the same page as we talk about all the different parts of this document.
01:14So, this is a tag.
01:16It begins with a left angle bracket and it has the name of the tag inside and
01:21then it ends in a right angle bracket.
01:23This is an end tag.
01:26It's the same as the tag except it has this slash character between the opening
01:32angle bracket and the name of the tag.
01:35So together, these two tags are called a beginning tag and an end tag.
01:41Inside, they have the content of the element.
01:44So altogether, with the begin tag and the end tag and the content, it's called an element.
01:50An element includes all of those pieces, begin, content and end.
01:54The begin tag is this one and the end tag is that one, okay?
01:59So this is the title tag, here is the head tag and you'll notice that the head
02:03tag contains the title tag.
02:06So everything between the beginning of the head and the ending of the head is
02:10the whole element, the head element.
02:12The head element contains the title tag and it may contain even some other stuff.
02:17This is the body tag and the body element contains the body of the document,
02:22including this paragraph and whatever else you might want to put in there.
02:26Then there is the HTML element, which contains all of it.
02:30It goes all the way up here, actually, doesn't it? Yeah.
02:33So, that's tag and that's element.
02:35A container is a type of a tag that has content.
02:38The P element is a container. It has content.
02:42We might have another element that doesn't have content, like the horizontal rule,
02:47hr and there is an hr tag that does not have content.
02:52It stands alone by itself.
02:53Now in XHTML, a standalone tag that does not have content must have this little
02:59slash before the closing angle bracket.
03:03The reason for that is that in XHTML, all tags must be terminated.
03:08So when you have a container, it's easy; you have an end tag that terminates the element.
03:13If you don't have a container, if you have just a standalone tag, then it must
03:17have this little shorthand for closing.
03:20It would be just as legal to write it this way, but nobody does.
03:25That would be just as legal.
03:26Now you have a begin tag and an end tag.
03:28So instead, there is this shortcut, this shorthand, which says this is terminated.
03:34Now, this space between the name and the slash is not actually required. It is traditional.
03:41So I tend to do it, but it's not required.
03:44So that is a complete hr element.
03:46It has it's begin tag and really has its end tag built into the begin tag.
03:50So it begins and ends all in one tag.
03:53That is a valid element that doesn't have content.
03:56Now let's take a moment and just talk about all this stuff at the top.
03:59This stuff at the top is required and that's really all you need to know about it.
04:03What it is, how it works, is probably not relevant.
04:07It's just required.
04:08This is what makes it valid XHTML and this is what makes it possible for it to
04:13be read across a lot of different devices, well in to the future.
04:16So you just cut-and-paste it, you keep it in a template, we'll talk about how to
04:20do that a little bit later.
04:21We're going to talk a little bit about some of the components of this a little
04:24bit later, so that you'll understand the parts of it that you may want to
04:28occasionally change, but for the most part, you just need to know that it's
04:31required and you're going to cut-and- paste that and it's included in the
04:34Templates section of the exercise files with this course. So that's it.
04:38This is a valid XHTML file.
04:40If you do in this way, they're going to work across devices well and
04:44consistently and well in to the future.
Collapse this transcript
Understanding the structure of an XHTML document
00:00In our last lesson we talked about this information at the top of the document
00:03that needs to get cut and paste into each of your documents, in order for it
00:07to be a valid XHTML.
00:09Let's take a look at what this is and exactly what it all means.
00:12This first line is the XML declaration. You will notice it's XML; it is not XHTML.
00:19XHTML is an application of XML and this is the version being used.
00:22So this XML declaration has the version of XML and the character encoding that's
00:26used in the document.
00:28The version will always be 1.0 and the encoding will depend on what language the
00:32document is in.
00:33For most Western languages utf-8 will work fine and that's the default.
00:38If you're using a language that uses different types of characters then western
00:41languages, like for instance Japanese or Chinese or Russian, that uses a different
00:46set of characters, then you may want a different character encoding.
00:50The next line is the DOCTYPE.
00:51This tells the browser what type of document this is, which type of XHTML is being used.
00:58This one is XHTML 1.0 Transitional and that's what you'll for most of your
01:03standard HTML documents.
01:05The other two types are Strict and Frameset, and we'll look at those in a minute.
01:10In a Transitional document, you have available all of the HTML 4 tags.
01:15You have Center, you have Table, you have Font and all of the presentation markup,
01:19all the tags are available in HTML are available in XHTML 1.0 Transitional.
01:26So if we look at this document in the browser we see that there is a yellow box
01:30and it has some text in it.
01:32So here in the document, we see that yellow box is made by the table element and
01:36the text is inside of a paragraph element and it has the font tag for
01:41specifying the font and the size.
01:44And that looks like this in the browser.
01:48In our strict document, you will notice that the DOCTYPE says XHTML 1.0 Strict.
01:54The Strict documents do not have available any of the presentation.
01:57The center tag is not there, the table tag is not there, the font tag is not there.
02:03All of these things have to be done with style sheets.
02:06And so at the top of the document we have a style sheet and then down here is the content.
02:13So that document looks like this in the browser.
02:15There is the strict version.
02:17You see it's virtually the same as the Transitional version.
02:21There is the Transitional and there is the Strict.
02:25You can accomplish the same things with style sheets that you can with the
02:30tables and the fonts.
02:31Finally, the Frameset document is for documents that have frames.
02:34We'll cover frames in more detail in a later lesson.
02:37There in nutshell, you have three frames available, frame sources. It goes red,
02:42yellow and then blue HTML.
02:43That looks like this in the browser, having red, yellow and blue.
02:49So those are our document types.
02:51Again, you will be using the XHTML 1.0 Transitional document type for most
02:56of your documents.
Collapse this transcript
Understanding document containers
00:00 In our last lesson, we've covered this front matter at the top of the document.
00:05 Let's look at the document itself.
00:07 The HTML element, which has it's begin tag here and its end tag down here at the bottom,
00:14 this contains the entire document. It's a container.
00:16 You remember a container is any HTML tag that has content in between the begin tag
00:21 and the end tag.
00:22 So the HTML tag is a container, and it contains the entire document.
00:27 The document itself is in two parts.
00:29 There's the head, which has the title in it and other meta-information about the document.
00:36 It could have style sheets.
00:37 It could have JavaScript.
00:38 Then there is the body of the document, which contains the content of
00:42 the document itself.
00:43 In this case, it's got this paragraph with the formatting information wrapped around it.
00:49 And that's really it.
00:51 That's the structure of a XHTML document.
00:54
Collapse this transcript
Creating and using templates
00:00So now that we've covered this structure of the XHTML document, and you know what
00:04all this stuff is that's required in every document,
00:07I know you're not going to want to type it every time and neither am I. I'm a big fan of lazy.
00:12So what I do is I keep around templates.
00:15Now as a starting point, I have this transitional-xhtml-template, which I
00:19actually use every time I'm doing to build a new document from scratch, and I start with this.
00:23It's got all the stuff that's required.
00:25It's got a placeholder for my document title, has a placeholder for where I
00:29start typing in my content.
00:31Once I've designed a site, like for instance this one here.
00:34This is a site that we'll be using later on in the course to show how we do
00:38layout in a complete site.
00:40And this is the template for it.
00:42After I've designed the site and I've built the front page, I tear out the
00:45content and I create a template that's got just all the elements that are going
00:48to be consistent across the website.
00:51And down here I've got placeholders.
00:52Here's where my main content goes, here's where my sidebar content goes,
00:58here's where the title goes, and the rest of it is just constant.
01:03So here's what it looks like in the browser. This is my little
01:05transitional template.
01:06This is the template for the website that we'll be looking at in more detail
01:10later on in the course.
01:11And here's the place for the main content.
01:13Here's the place for the sidebar content.
01:15I don't have type any of this anymore.
01:18Like I said, I'm a big fan of lazy.
01:20This is something that you can do to make to make it possible to use well
01:23structured documents that are correct and that will work well in a variety of
01:27browsers, and in a variety of media, and without really anymore effort than you
01:32would put into just the designing the things once.
01:35No more effort really than it would be just to use plain old ugly HTML, to be
01:39able use well formed XHTML that will work across platforms and well into the
01:43future on all kinds of new devices.
01:45So use your templates. Become a fan of the lazy.
Collapse this transcript
2. Text Tags
Understanding how empty space is formatted in XHTML
00:00As we begin to talk about how XHTML deals with text, let's start with white space.
00:05White space is any kind of space, the space character, the tab character.
00:11It's a line feed. Any kind of white space, XHTML has a special way of dealing with it.
00:17So here we have a document and it has our front matter at the top.
00:21It has head section and a body section and it has a couple of paragraphs and
00:26these are paragraph tags.
00:28See the p at the beginning and the end tag at the end.
00:31Everything inside of the paragraph element is a paragraph.
00:34So this text here is in a paragraph by itself and you see in the browser down here,
00:39 we have our text editor at the top and our browser at the bottom so we
00:43can see what we are doing.
00:44The browser down there, that's in a paragraph by itself and this other line of
00:48text is in a paragraph by itself down here in the browser as well.
00:53So notice that the paragraph has words and it has spaces.
00:58Now if I go ahead and change this and just add a bunch of spaces and save the
01:04document and then go down here and reload in the browser, you will notice that
01:09the line of text does not change. All of these extra spaces are all folded into
01:14one space in the document in the browser.
01:18So this is what XHTML does with space, and HTML works exactly the same way.
01:23All of these spaces are folded into one space in the browser.
01:28Now if instead of inserting a bunch of spaces, what if I insert a bunch of new
01:33lines and then save it?
01:39So I save the document and I reload in the browser and you will notice that the
01:43line of text is exactly the same.
01:46All of these new line characters are also folded into one space in the browser.
01:53So this is how XHTML deals with white space.
01:56In fact, it doesn't matter what kind of white space it is or what kind of
02:00combination of white space it is.
02:02I could have a number of spaces up here. I could have a number of new lines down
02:07here. I could have more spaces over here and I could even break up another part
02:12of the line and all of this-- and I save the document and I load it up in the
02:21browser and it's still just the one line of text.
02:25So this is how HTML and XHTML deal with white space.
02:30All white space is in a row.
02:32It's adjacent to each other.
02:33It is between pieces of text.
02:35All white spaces folded into one space character in the browser when it
02:40renders the line of text.
Collapse this transcript
Using paragraph tags
00:00 Let's take a look at how XHTML and HTML handle paragraphs in a document.
00:05 Here we have a document in our text editor, the top window is the text editor,
00:09 the bottom window here is the browser and this document has a paragraph in it.
00:14 It has two paragraphs actually.
00:16 This paragraph here and let me scroll down so you can see the whole thing and
00:19 this paragraph over here.
00:20 Now you will notice that the paragraphs are enclosed in p tags. The p tag is for
00:26 paragraph and the p tag is a container. So it has content.
00:30 The content of the container is the paragraph itself and it has a begin tag and
00:35 it has an end tag and that's how a paragraph is formed in XHTML, head HTML.
00:41 So this paragraph here is displayed in the browser there and this paragraph here
00:46 is displayed in the browser here.
00:47 You will notice that the browser makes a nice space between them and formats
00:51 them as separate paragraphs.
00:53 So in a nutshell, that's how paragraphs work.
00:56 Another thing I would like to talk about is how we format the paragraphs in the text editor.
01:00 You will notice that this paragraph here runs on and it goes way off the screen
01:04 and sometimes you'll see documents where paragraphs will go on for many, many
01:09 screens wide, and they work just fine.
01:12 That really doesn't have any impact on how it's displayed in the browser.
01:16 But if you remember, when we add white space like for instance a line break
01:21 right here, this doesn't really affect how the text is displayed in the browser.
01:26 I will go ahead and I'll save this with the line break in it.
01:29 You'll see it breaks after the word words and the comma there, so that would be
01:32 right there and I'll reload it in the browser and you see that that does not
01:37 affect how it's displayed in the browser.
01:40 So what you can do is you can actually reformat this and I'll use a feature in
01:45 my text editor, most text editors have a feature like this, like we call it a
01:50 hard wrap or something like that.
01:52 In this one, it's called Split lines and it's in the Edit menu there.
01:55 So I'll go ahead and I'll click on Split lines.
01:58 It wraps the paragraph around, so that it all fits on the screen here in the Editor.
02:03 I will go ahead and I'll save that and I'll reload it in the browser.
02:06 So it has no effect on how it's displayed in the browser, but it makes it
02:09 readable on the screen here in my text editor.
02:13 This is something that's just nice to do.
02:15 It makes it readable in the text editor and makes it a little bit more workable
02:19 if you have to use it in another environment like in a console on a server or
02:23 something like that or you just need to make a quick edit when you are some
02:26 place else and it just makes it easier to work with and it doesn't have any
02:31 effect on how it's displayed.
02:32 So I consider a nice practice, I always wrap my paragraphs so that they fit on
02:37 the screen in my text editor and they go ahead and work just fine in the
02:40 browser when I do that.
02:42
Collapse this transcript
Aligning paragraphs
00:00So in our last lesson we talked about paragraphs and how they work and how they wrap.
00:04 Now let's take a look at how to change the alignment of a paragraph.
00:08Here we have a document, a fully formed XHTML document with all the front matter
00:12at the top and in the content of the document we have one paragraph element and
00:18it's there to there. We have the paragraph tag and the close tag and some text in
00:24between and down here at the bottom we have this document opened in a browser
00:28with the paragraph displaying there on the screen.
00:30Let me just drag this back a little bit so the paragraph wraps nicely.
00:34You will notice that the paragraph is justified on the left, it's aligned flush
00:39on the left and it's ragging on the right and this is the default alignment for
00:44a paragraph in XHTML and HTML.
00:47So let's take a look at how to change that, I'm going to add an attribute to the
00:51paragraph here, say align="right".
00:56So this is what an attribute looks like in XHTML.
00:59You have the attribute name, and an equal sign and the argument of the
01:03attribute is in quotes.
01:05I tend to use double quotes.
01:06Single quotes also work just fine.
01:08So this is how it's formed, you have the left angle bracket and then the name
01:12of the tag, which is a p tag in this case for paragraph, and then you have some space.
01:17It can be any amount of white space.
01:18You can have new lines here.
01:19You can have any amount of legal white space and then the name of the attribute.
01:24In this case is align which tells the paragraph how to do its alignment and an
01:29equal sign and the argument in quotes and in this case, the argument is the word
01:34"right" and a close angle bracket and then you have the close tag down here with
01:40the content in the middle.
01:41So I'm going to go ahead and save this.
01:43What we expect to have happen when we reload in the browser is that the right
01:47side will be flush, the left side will be ragged.
01:50So I'll go ahead and hit Reload and there we have it.
01:52The right side of the paragraph is now flush and the left side is ragged, and so
01:57that's the right alignment.
01:59There are two other alignments available, one is called justify and what this
02:05does is this makes both sides of the paragraph flush and then we have the left
02:11side as flush and the right side as flush.
02:14And the other alignment is center, which makes it ragged on both sides, all of
02:19the content centered in between and there we have center.
02:25The default option of course is left and so we saw that without any argument in the alignment.
02:30You can also do it this way if you want to explicitly assign it.
02:33You can say align= "left" and reload in the browser.
02:38We have that flush on the left and ragged on the right as we did with the
02:41default arrangement.
02:43And so that is the alignment attribute to the paragraph tag and its
02:47various options.
Collapse this transcript
Understanding block-level and inline tags
00:00There are two major types of tags in HTML and XHTML.
00:04There are block level tags and inline level tags.
00:07Block levels tags are elements that contain other elements.
00:10These include paragraphs, headings, tables, etcetera and the special
00:13generic block element div.
00:15Inline level tags represent objects that typically occur in the line of text
00:19including I, B, image, etcetera and the special generic inline elements span.
00:23Let's take a look at some block and inline level elements in our editor here at
00:28the top of the screen.
00:29We see the center tag contains paragraphs and the paragraphs contain in this case
00:37an emphasize element and in this case an image element.
00:41Paragraphs are special in this way and that the P tag is the only block level
00:46element that cannot contain other block level elements.
00:50Paragraphs can only contain text and inline level elements.
00:54Other block level elements can contain both block level and inline level
00:58elements as in the case of the center tag here.
01:02Also, take note that images are inline elements.
01:06This can be a point of confusion, so it's good to remember.
01:09Images are inline elements;
01:10they are not block level elements.
01:13This is just an overview of block and inline level tags.
01:16As we go over individual tags in the rest of the course. We'll talk about
01:20whether they are block level or inline level, so you can get that straight at the time.
Collapse this transcript
Controlling line breaks and spaces
00:00In our lesson on paragraphs, we talked about how the browser automatically
00:03formats a paragraph taking multiple occurrences of white space, spaces, new lines,
00:08etcetera and folds them into one space for the purpose of formatting the paragraph.
00:12In this lesson, we are going to talk about how to control the line breaks in the browser.
00:16Here in our Editor on the top of the screen, we have a couple of paragraphs and
00:20we are displaying those paragraphs in the browser on the bottom of the screen.
00:24Let me go ahead and shrink the browser down so that the paragraphs wrap a little bit.
00:30For the purposes these lessons we can show how to control those wraps.
00:34You will notice that the first paragraph up here extends past the Editor
00:38window with no wraps whatsoever and you will notice that down in the browser it wraps normally.
00:45You will notice that the second paragraph is wrapped normally on the screen and
00:49it wraps normally down here in the browser as well.
00:52So this first paragraph goes beyond the Editor window and if we break it at some place,
00:59let's break it over here, and save it, of course this does not affect how
01:03it's rendered in the browser whatsoever.
01:05So how do we actually get aligned to break where we intend it to?
01:09For this purpose we use the BR tag, br, and it's a standalone tag.
01:15It does not have any content.
01:16So we use the shortcut notation here to satisfy XHTML's need for beginning and an end tag.
01:22If we save this and reload it in the browser, you will notice that the paragraph
01:26breaks there and yet the paragraph is still formatted as a paragraph.
01:30In other words, it has got extra space between the two paragraphs and this is
01:33normal behavior for block elements in a browser window.
01:37Now we'll go ahead and take that out and the paragraph is back the way it was
01:44and save, reload it in the browser so we can see that intentional line break is done.
01:48Now how do we get a line break to not happen?
01:51You will notice that between the words Notice and How over here that there is
01:55line break that's happened, because the browser decided that it needs to wrap
01:59there in order to make it into a paragraph.
02:02What if we wanted to not wrap there?
02:03If I go ahead and put in a non-breaking space here, this is a special character
02:08entity called non-breaking space, then this will prevent a break between these
02:14two words and these two words will be on one line, so they will get wrapped
02:18down to the next line.
02:19Before we save this and look at how it works, let's talk about the
02:22character entity here.
02:23You notice it has an ampersand at the beginning and a semicolon at the end and
02:28in between the ampersand and the semicolon we have letters, nbsp.
02:32This is how you use a character entity in HTML and XHTML.
02:37The ampersand denotes the beginning of the character entity and the semicolon is
02:41the end of it and in between you have the designation of the character entity.
02:45In this case, it's a named entity and it's named nbsp, which stands
02:49for non-breaking space.
02:52So go ahead and save this and reload the browser and you will see that now the
02:57paragraph does not wrap between the words Notice and How.
03:00It doesn't break there.
03:02It only breaks before it or after it and so it takes the whole thing as a one
03:06for here and puts it on the next line, and that's how a non-breaking space works in HTML.
03:12In fact, if you wanted this paragraph to not wrap at all, you can select the
03:16entire line and I'm just going to select it from here to the end and not
03:21include that space before & and use the Editor's Search and Replace feature to replace the space.
03:29The Editor fills in whatever you have selected when you do that and replace all
03:34the spaces with non-breaking space entities.
03:38Replace All in selection, 26 occurrences, Close.
03:45I will go ahead and Save and reload in the browser and we see now that that
03:49paragraph doesn't break at all.
03:51It goes all the way across and you have to scroll sideways in order to see
03:55the entire paragraphs.
03:56It puts it all on one line and that's because there aren't any spaces that it
04:00can break and all the spaces in the paragraph are non-breaking spaces.
04:04I am going to undo this and go ahead replace this element here with a space and
04:12character entity non-breaking space entity, save and reload in the browser and
04:17we see that our paragraph is now back to normal.
04:19There is another way that we can force this paragraph to not break and this is a
04:23non-standard element.
04:25It is not in the standard and it tends to work in most of the browsers that I
04:29have seen including Internet Explorer and Firefox and all the popular browsers.
04:34But it's not in any of the standard.
04:35So it's an unsupported rogue non-standard element.
04:39It's called a no-break and it's spelled nobr.
04:41I'll go ahead and insert it there and at the end of the line.
04:48So everything between those beginning and end tag will not break.
04:52So I'm going to Save that and reload in the browser and you see we now have a
04:56non-breaking paragraph.
04:58So this is shortcut for making a non-breaking paragraph, should you
05:01actually want one and you don't feel like search and replace all the spaces in the paragraph.
05:05It is not supported.
05:07It's not part of the standard.
05:08It's just one of those elements that's cropped up out of a necessity, but was
05:13never made a part of the standard.
05:14So you can use that, if you want to and it will work in most browsers, but just
05:19know that it's not part of the standard.
05:20So this is how you control the line breaks in a paragraph.
05:24You can use the br element to insert a line break where you want it and you can
05:28use the nbsp character entity to prevent line breaks where you don't want them
05:35and you can use the unsupported non- standard no-break tag to prevent line breaks
05:40for a block of text.
Collapse this transcript
Formatting text with phrase element tags
00:00In this lesson we are going to talk about Phrase markup elements, which mark up
00:03your text with the intention of a phrase, like for example, here we have an
00:08emphasized phrase, which just means it should be emphasized with the em or this
00:12one means it should be read strongly.
00:15This makes it possible for non-visual browsers to know what to do with your text.
00:20To read it stronger or to read it with emphasis, as opposed to the font markup
00:24elements, which tells the browser, this one is italic and this one is bold, but
00:27it doesn't really tell a non- visual browser what to do with it.
00:30So it's important to understand the distinction, the Phrase markup elements
00:34are covered in this lesson and the Font markup elements are covered in our next lesson.
00:38The first Phrase markup element we are going to talk about is the Emphasize
00:42element and all of these Phrase markup elements, as well as, their Font markup
00:46counterparts are inline-level elements, which means that they go inline with the
00:50text rather than in blocks as the block-elements.
00:54So, this is an inline-element and it means to emphasize em and you will notice
00:59that in the browser it's rendered with italics.
01:04You can't count on that though.
01:06Different browsers may render it differently.
01:07If you really care, if it's italics or not, you are encouraged to use the Font
01:12markup elements instead.
01:14The Strong element means to read it strongly and in this case it is rendered in
01:18bold in the browser.
01:21The Q element is for quotes and you will notice in the browser it is rendered
01:27with special curly quotes.
01:29An important note about the Q element.
01:31It is not supported by all browsers.
01:33So, be sure that you check it in the browsers that matter to you, before
01:36committing it to the Internet.
01:39The Code element renders in monospace text and the next few elements
01:45 are interesting.
01:48The Abbreviation element allows you to use an abbreviation, and hover your mouse
01:53for the meaning of abbreviation.
01:54So, here we have an m and you will notice that in Firefox it puts this little
01:59dotted line under it to say you hover your mouse over here, and you hover your
02:02mouse and you get the definition of the abbreviation.
02:05These work differently in different browsers.
02:07So, be sure to test them in different browsers that matter to you.
02:11Likewise, the Acronym element, we have LOM here.
02:14And we'll notice that in the title attribute we have lots of meaning, which is
02:18the definition of the acronym.
02:21So, down here you hover your mouse over it and LOM stands for Lots of Meaning.
02:25The next element is DFN, which stands for defining instance.
02:29So, you would use this the first time you use a term that you want to define in a document.
02:34In this case, the Firefox browser renders it as italic and if you hover your
02:39mouse over it again, you get the title tag.
02:42So, meaning and purpose there.
02:44DFN with the title tag and it's meaning and purpose.
02:47Again, this is for using a term the first time in a document and being able to define it.
02:52The Keyboard element, kbd renders as monospace in Firefox.
02:58The Sample element likewise.
03:00samp also renders as monospace and then finally the Var element, var, which
03:07stands for variables, this is where you would use a variable in code or
03:10something like that and that renders as italics.
03:14So, these are the Phrase markup elements and how they are rendered in
03:18the Firefox browser.
03:20Of course, different browsers will render them in different way.
03:22So, be sure to test them in the browsers that matter to you before committing
03:26your page to the Internet.
Collapse this transcript
Formatting text with font markup elements
00:00In this lesson we are going to talk about Font markup elements.
00:03These are distinct from which Phrase markup elements.
00:06The Font markup elements define the visual style that the elements are going to
00:11be rendered on a visual browser on the screen.
00:15The Phrase markup elements are for giving meaning to the text, like emphasized
00:20or strong or something like that.
00:23The Font markup elements are actually depreciated in XHTML 1.0 and HTML 4.01.
00:30The HTML police, as I affectionately call them, would prefer that we not use
00:34Font markup elements.
00:36In reality, if you care about how your text is going to be rendered on the
00:40screen, you want to use the Font level markups and not the Phrase level markups.
00:45The Phrase level markups do not guarantee how the phrase is going to be
00:49rendered on the screen.
00:50If you care that it's italics, if you care that it's bold, then you use the
00:54tags that mean that.
00:55They are not going away, as long as people are using them, they are not going to
00:58take them out of HTML and XHTML.
01:01So they are perfectly safe to use.
01:03Browsers for visually impaired and other non-visual browsers will not
01:07necessarily know what to do with these.
01:09If you care about those browsers, then you want to use the Phrase level markups
01:14in addition to these or instead of these.
01:17Let's take a look at each of these tags.
01:19These are also inline-level just like the Phrase markup tags and so they go
01:23inline with the text and their containers and they contain the text that you are modifying.
01:27So, in this case, we have the B tag which stands for bold and you will see that
01:32it's rendered bold in the browser down there.
01:34Here is the Big tag, which means what it's says, big, and you will see that the
01:39text is bigger in the browser down there.
01:42Here is the I tag for italics and you will see that it's italic in the
01:47browser down there.
01:48So, these do exactly what it is that they say.
01:51S is for strike out.
01:53It's actually a shortcut for Strike.
01:55Strike and S are same thing.
01:58And you will see in the browser here there is the S tag and there is the Strike tag.
02:02They do exactly the same thing.
02:04They have the same meaning.
02:06In between we have the Small tag which makes the text smaller.
02:10There is the Strike tag.
02:12TT stands for teletype.
02:15It's like the pretag.
02:16It preformats the text.
02:17It renders it in all monospace font.
02:21The pretag, pre, we'll cover that later.
02:24That's a block-level tag and so you cannot use that in inline in text.
02:29This is an inline-level tag.
02:32So, use this when you want your text to be monospaced inside of a paragraph.
02:38Finally, the U tag for underline.
02:40It underlines the text, just like there.
02:43So, these are the Font-level tags and like I said, these are depreciated
02:46which means that the HTML police don't like them, but they are there and they
02:50are there for good.
02:51They're not going away.
02:53The next versions of HTML are already being designed and have them intact.
02:57So you don't have to worry about them going away.
02:58The browsers will continue to support them, as long as people use them and
03:02these have a purpose.
03:03They markup the text, how you want it to be rendered on the screen.
03:07If you care about how your text is rendered on the screen, if you want
03:10something specifically to be in italic and something else specifically to be
03:13bold, then you use these tags.
03:15If you care about the meaning and how they are rendered on a non-visual
03:18browser, then you use the Phrase markup tags and you can use them together, if
03:23you need to.
Collapse this transcript
Adding document structure with headings
00:00Headings in HTML and XHTML add structure to your document and this is valuable
00:05for search engines and other automated tools that might want to categorize your
00:09documents and to understand the structure of them a little bit, so they can give
00:12you more intelligent results.
00:14Headings are valuable for this purpose.
00:16Headings are rendered a certain way in browsers.
00:19By default, they tend to be a little bit ugly and so some people tend to not
00:24use the headings, instead formatting paragraphs for the purpose.
00:28I am suggesting that it's a good idea to go ahead and use the headings and
00:31format those using CSS.
00:34In this way, your documents can have the structure that they need so that the
00:36automated tools can report on them properly and at the same time, they then look
00:41the way that you want them to look.
00:43Let's take a look at how we can do this.
00:44Here's our heading 1 and you'll notice that it's big and ugly and here's our heading 2.
00:49The heading 2 means that the part of the document after the heading 2 is related
00:53to the part of the document after the most recent heading 1, and likewise,
00:58the heading level 3, h3, means that that part of the document is related to the most
01:02recent h2 level of the document.
01:06This is how they are rendered in the browser and as you can see, they may not be
01:09exactly what you want.
01:10So, you can change that by adding some style.
01:12We are going to go into the Style Sheets in a lot more detail in the chapter on CSS.
01:17But let's just take a look at how you can do this in this case, so you can see
01:20what the results look like.
01:21I'll add a style here.
01:23Let's say we want it in a Sans-Serif font and just a little bit larger than the
01:27paragraph, not a lot larger than the paragraph.
01:29So, we'll go ahead and say
01:30font-family: sans-serif and font-size: say 125%.
01:40So, it will be just a quarter of a percent larger than the normal paragraphs in the document.
01:44I'll go ahead and save that and reload in the browser and we can see that looks
01:50a lot more reasonable.
01:51Now, we'll go ahead and take this style and copy it because that's easier than
01:58typing a lot, and we'll go ahead and paste it over here and let's maybe add
02:03some color to this one.
02:04Let's say heading level 2 will be dark blue.
02:09So, I'll say color. I'm going to use a color like this.
02:15That's a blue and we'll talk more about what that means in the section on CSS.
02:19I'll go ahead and save that and reload over here and we see that that's a dark blue.
02:23It's a little bit bluish.
02:25It's not an overwhelming blue.
02:27We'll go ahead and we'll copy this and use it as a basis for the heading level 3
02:34and go ahead and say instead of changing the color of the text, we are going to
02:38change the background-color of the text.
02:40Background-color like that and we'll say it's going to be a light blue.
02:47So, I'll make it say #ccf, which is a light blue.
02:51Go ahead and save that and load it up in the browser and we have a light blue
02:57background now on this.
02:59So, you can see that you can do things to make it attractive or make it look how
03:04it is that you want it to look and yet still have the structure that's
03:09important for the automated tools that might be reading your web page.
03:13So, headings are valuable for that purpose, they are valuable for giving your
03:16documents structure and they can be made pretty by using CSS.
03:20We'll talk about CSS in a lot more detail in our chapter on CSS later in this course.
Collapse this transcript
Formatting quotations and quote marks
00:00In this lesson, we are going to talk about quotations and quote marks.
00:03There are two elements in play here.
00:06One is the Blockquote element, which is a block-level element that quotes an
00:10entire block of text, and the other is the Q element that puts quote marks
00:14around a bit of text inline.
00:17First, the Blockquote element, which you can see demonstrated here.
00:21In the browser, you'll see it's just indented text and if I go ahead and shrink
00:26down the browser so that it wraps, you'll see that it's indented on both sides
00:31but it's not centered or anything.
00:34That's actually how the Blockquote element is often used.
00:37It's often used just to indent text.
00:38It's not used necessarily to mean this is a block of quoted text.
00:42So, be aware of that and when you are using the Blockquote element, be sure to
00:46use it to mean what it's supposed to mean and if you need to just indent text,
00:50you can use Style Sheets for that with a regular paragraph.
00:53The new Q element and I say new, it's been around now for almost ten years but
00:57it's not actually supported by a lot of browsers.
00:59So, it's not used very much.
01:01Be sure to check with the browsers that matter to you before you try to use it.
01:05It puts quote marks around a piece of text inline.
01:09So, here we have a word with quote marks around it, here, and I'll just take
01:13those quote marks and I'll change it for the Q element and close the q here.
01:19So, that's the Q element.
01:21It's an inline element as you see and it's being used to quote that word.
01:25So, I'll go ahead and save that and reload in the browser.
01:28So, the nice thing is there are nice curly quotes in English.
01:31There are a couple of things about the Q tag that you need to be aware of.
01:34One is it's supposed to be internationalized and so, if I were to sit here and
01:38put language=French then you should get French quotes, which are one above and
01:44one below and I save that and reload it, and you see it doesn't change anything.
01:48So that's not fully supported in Firefox.
01:50In actuality, the tag isn't supported at all in some browsers, notably Internet Explorer.
01:56So, if you use it, you may just not get any quotes at all.
01:59So, be sure to test it in the browsers that are important to you before you use it.
02:03They'd be handy tag, if they were actually supported well, but
02:07unfortunately it's not.
02:08So, those are the quoting elements.
02:10They don't actually get used for what they mean and they don't always work for
02:14what they are supposed to work for.
02:16So, be aware of that when you try to use them.
Collapse this transcript
Preserving pre-formatted text
00:00Normally, white space is folded together and otherwise ignored.
00:04So, new lines and all that become one space and text is formatted like this in
00:09the browser like we see here, in a paragraph.
00:14Sometimes however, you might want the text to be formatted in a particular way,
00:18like in this example here, in my text editor.
00:22And the way you accomplish that is with the Pre tag.
00:23So, I'll just go ahead and change these p's into pre's.
00:28That's the Pre tag.
00:29It's a block-level tag and what it does is it displays in the browser exactly
00:34how it is in the text editor.
00:35So, it will be monospaced and it will be indented just like this and the blank
00:39lines and everything.
00:40It will be just as it is there in the text editor and there we have it.
00:44You will notice a couple of things.
00:46First of all, it is a block-level element and so it will behave like that.
00:50It will separate the blocks of text out of as if they were paragraphs.
00:54Also, you'll notice, of course, that the text is monospaced and that it's
00:57indented exactly how it is in the text editor.
00:59You'll notice that inline formatting does work.
01:03So, here we have a U tag for underline and here you have the word as
01:07underlined in the Browser.
01:09So, that's the Pre tag.
01:10It does just what it looks like it does.
01:12It pre-formats text exactly how it's formatted in the text editor.
01:16It's often used for programming language code or HTML code or something like
01:21that to display code in a browser, so that the indenting is preserved.
01:25It can also be used for wacky ASCII or poetry, like I have done here.
Collapse this transcript
Selecting a typeface
00:00This lesson is about using the font tag to change the font of text in a document.
00:06The font tag is an inline level tag.
00:09So it's important to know that you can use it inside a paragraph.
00:12It is not proper to use it outside a paragraph and have a paragraph contained in it.
00:17It's common and it works, but it's not correct XHTML.
00:22So let's take a look at how this works.
00:24Here we have a paragraph, and there is a paragraph in the browser down there.
00:29Let's say that I want to change the font of the text of the paragraph.
00:31So I'll use a font tag here, and I say font face = and I can say "arial",
00:37which is a sans-serif font that's available in Microsoft Windows and on other operating systems.
00:44Close the font tag here.
00:45Now you'll notice that the font tag is after the P and the close font tag is
00:51before the close P. So that makes the font tag inside of the paragraph.
00:56You will see other arrangements, which are not correct.
01:00Sometimes even you'll see the text straddling the paragraph like this, where
01:06you've got the beginning of the paragraph outside of the font and the end of the
01:09paragraph inside of the font.
01:11That is not correct and don't do that.
01:14So here we have the font tag done correctly and I'm going to save it and
01:19we'll reload in the browser, and we'll see that we now have this lovely
01:21sans-serif Arial font.
01:24So some other interesting things that you should know about the font face argument.
01:28One is that you can say sans-serif like this and then whatever is the default
01:34sans-serif font in the user's browser is the one that will be used.
01:38And this is very, very valuable.
01:40So I save it and go ahead and reload in the browser.
01:44You see that we still have the Arial font and that's because Arial is the
01:48default sans-serif font in the Microsoft Window's operating system.
01:52So that is the font that comes up.
01:54If the font is something different in the user's operating system, it will use that one.
01:59The value of this is that not everybody's computer has the Arial font or not
02:04everybody's computer has Helvetica or something else or maybe it's not called
02:09something or quite spelled the way that it's spelled on your computer.
02:12So if you want a sans-serif font in your document, if you use sans-serif instead
02:18of specifying Arial, it will come up sans -serif in all of the places where there
02:22is a sans-serif font available in that browser, even if it's named something
02:26different than it is in your computer.
02:27So this is very valuable shorthand.
02:30In addition to sans-serif you can say serif and you'll always get a serif font.
02:35Save that and reload, and the default serif font is probably Times Roman on
02:40this computer here.
02:41Or you can say monospace, like this and you'll get whatever the default
02:47monospace font is, which in this case I believe is Courier New in the Microsoft
02:52Windows operating system.
02:55Another thing that's useful to note is that you can specify several fonts.
03:00You can say verdana, helvetica, sans-serif, like that.
03:08It will go ahead and save that, and what this will do is it uses Verdana if it's
03:12available, and if it's not available, it will use Helvetica.
03:15If neither of those will available, it will use whatever sans-serif font is available.
03:19This way you can specify the one that you like and still have it default to
03:23something that is reasonable for your document.
03:25I'll go ahead and reload this and you'll see we have Verdana available on this computer.
03:30If I misspell Verdana, then we'll get the second one in the list here.
03:34I use this technique for testing my lists, just to make sure I get what I expect.
03:39So I'll go ahead and save this and reload and now we get Helvetica.
03:44If I misspell Helvetica there and save that, we'll get the default sans-serif,
03:49which probably looks very similar.
03:51It would be the Arial font.
03:52So I believe on Microsoft Windows Helvetica is alias for Arial.
03:57So we get exactly the same thing there.
03:59So this is how the font face tag works.
04:01You use it to specify the fonts that you want to use to display your document.
04:06You can give it a list of fonts and it's always a good idea to end the list with
04:10a default value for the type of a font that you want so that if none of the ones
04:15you've specified or available, you'll at least get a serif font or sans-serif
04:18font however it is that you want it to be in your document.
04:21Keep in mind that not everybody has their browser setup to default to a serif font.
04:26So if you really care about your document being displayed in serif font, go
04:29ahead and specify it in a font face tag.
Collapse this transcript
Selecting a type size
00:00In the last lesson we saw how to change the font face of text using the font
00:04markup tag and now we're going to look at how to change the size of the text
00:08using the font markup tag.
00:10So here we have the same paragraph and I'm going to go ahead and insert a font tag.
00:13We'll use the size attribute.
00:16I'm going to close the font tag here.
00:22We'll say size = "3", 3 is the default size.
00:26So when I save this and reload it in the browser, we won't see any change at all.
00:31If I go ahead and make it 4, so it gets little bigger.
00:35Save, reload, there it is.
00:40If I make it 2, I'll see that it gets little smaller.
00:43Go ahead and save that and reload.
00:47And we have now smaller text.
00:50So 3 is the default and numbers between 1 and 6 are valid.
00:54So 1 is very, very small. We'll look at 1.
00:57Save, reload.
01:00That's very, very small.
01:01And we'll look at 6, which is very, very big.
01:06Save here and go ahead and reload and 6 is very big.
01:10Besides using the absolute numbers, you can also use relative numbers.
01:14If I say +1, it will make it one size larger than what it's current, which is the default.
01:19So it's just that bigger font, it's just like 4.
01:22If I say -1, it will make it one smaller than what's in effect at this place of
01:28the document, which is the default in this case.
01:30So it makes it smaller.
01:31So you can use relative sizes and you can use absolute sizes.
01:35I tend to like the relative sizes more.
01:38So I'm going to ahead and set this to + 1, and then I'm just going to show you
01:42one more thing we can do here.
01:43We can combine the face and size attribute.
01:46So if I say face="sans-serif" and save that, you will see that we'll get a
01:54sans-serif font that's a little bit larger than the default.
01:57So that's the font size tag, and you see you can use it also in combination
02:01with the font face tag.
02:03Remember that the font tag is an inline tag, so it belongs inside of the
02:08paragraph not on the outside of the paragraph.
Collapse this transcript
Using ordered and unordered lists
00:00 There are three types of lists in XHTML and HTML.
00:04 There is the Unordered List, the Ordered List and the Definition List.
00:10 So we'll start our discussion with the Unordered List and here an example in the
00:14 text editor on the top and we have browser on the bottom.
00:17 The Unordered List is specified with the ul tag, which is container.
00:21 It's a block level element and it contains Line Items using the li container,
00:27 which is also a block level container.
00:29 li for the Line Item.
00:31 So you can see it's rendered down here using bullets.
00:34 So you can change the types of bullets by specifying different type up here.
00:38 You say type = "disc".
00:41 Disc is the default, so we'll just show that one real quick.
00:44 I'll save and reload and you will see that it doesn't change at all.
00:49 "circle" is like the disc only. It's open.
00:53 There is circle and "square" is the other type and you will see it's rendered
01:01 here in the Firefox browser with a solid square.
01:04 These may be rendered differently in different browsers, so you might want
01:07 to check the different browsers that matter to you and see how they are rendered there.
01:11 You can also nest list, and I'll show this here with a nested list.
01:18
01:37 Save that and reload and you'll notice that the nested list has these circles as a default.
01:44 The outer one will have the disc as the default and save and reload, you will
01:51 see the outer one has discs.
01:53 The next level in has circles and if we nest yet another level, which we can do
01:58 here easily with a little cut and paste.
02:01 Copy and I'll go ahead and paste it here and we'll indent that a little bit so
02:08 it makes sense and save and you will see we have two levels of nested items and
02:14 the inner level has squares.
02:16 The choices may be different, but they will try to use a different type of
02:20 bullet for each level, and of course it will cycle them after three levels.
02:24 So that's the Unordered List.
02:25 Let's take a look at the Ordered List now.
02:28 The Ordered List uses the ol tag which is a block level tag and the items are
02:34 the li tag for Line Item.
02:36 Here is what it looks like in the browser.
02:39 You will notice it's counting 1, 2, 3, 4 and it's using standard numbers for the list.
02:46 You can change the type using the type attribute and you can say "A" for using
02:54 the alphabet to number them.
02:56 You can use a lowercase "a" to get lowercase alpha, save and reload.
03:02 You can use hit "I" for Roman numerals.
03:06 That's an uppercase "I" for uppercase Roman numerals and you can use a lowercase
03:11 "i" for lowercase Roman numerals.
03:15 You can also spell it out.
03:17 You can say upper-roman for uppercase Roman numerals, reloading there.
03:24 You can say lower-roman for lowercase Roman numerals, save that and reload.
03:31 You can say upper-alpha for uppercase alpha and save that and reload or you can
03:41 say lower-alpha for lowercase alpha.
03:42 And of course, you can say a number to get the default, which is the numbers.
03:54 Save and reload.
03:56 You can also nest the Ordered List just like you can with the Unordered List.
04:02
04:13 I'll go ahead and use copy/ paste to get my list here.
04:18
04:25 And save that and reload.
04:29 See, I closed it with the wrong tag there.
04:31 You want to close it with the same tag that you are using and then it will
04:34 work as you expect. There we go.
04:37 So the outer one is numbered 1, 2, 3, 4 and the inner one is 1, 2, 3.
04:42 I can change the type of the inner one if I like so that I have some sort of
04:50 a structure to my outline and of course you can do this in whatever way makes sense for you.
04:55 The Definition List is our final type of list and this is very different than
05:02 the Ordered List and the Unordered List.
05:04 The Definition List is used for defining terms and it looks like this in the browser.
05:09 So the outer container is dl and that's a block level element and inside you
05:14 have dt for the Definition Term and dd for defining the definition itself.
05:20 You see these are rendered in this way. The Definition Term is 1 and the
05:25 definition is the first non-zero number 2, which is here and the Definition Term
05:30 and the dd is the number after 1 and so on.
05:34 There aren't any options for the rendering of the Definition List, but of course
05:38 you can format it using CSS.
05:41 So these are the different types of lists.
05:43 You have three types of list.
05:44 You have the Unordered List, the Ordered List, and the Definition List and
05:49 they look like this in the browser, Unordered List, Ordered List, and
05:52 Definition List.
05:54
Collapse this transcript
3. Image Tags
Using inline images
00:00The image tag is an inline tag in XHTML and HTML and this is essentially how it works in a paragraph.
00:10Here we have a paragraph with some text in it and an image in the middle of the text.
00:14So here is the image and you have text before it and text after it, and this is
00:18what it looks like in the paragraph.
00:20This paragraph has an image inline with it.
00:23So that is how an image is used in a paragraph like that.
00:27Let's take a look at the image tag and some of its attributes.
00:30Here we have the source attribute, which says lynda-24.png that's the file name of the image.
00:38It could also have an entire URL in it with the HTTP and the host name and you
00:43can even load an image off of a different host than the one where the HTML file is.
00:48We'll see examples of that later on.
00:51This is the alt attribute and this is actually required in the specification.
00:56This provides text that will be displayed in the event that the browser cannot
01:00display the image and it's also useful for circumstances where the browser is
01:04not a visual browser where it might be reading text to a blind person or
01:07something like that and so the alt tag is actually required.
01:11There are circumstances where it may not make sense even all those things
01:14considered to have whole text in which case you can just leave it empty, you can
01:18take the text out of it and leave it empty like that or some people will omit
01:22the alt tag and even though it's technically required by the spec, it doesn't
01:26break anything to leave it out and then we have the title attribute and the
01:30title attribute is what's displayed when you hover the mouse over the image in
01:34the browser, there it says "hey!
01:35you with the mouse!" and that's what the title attribute is for.
01:38So that can be useful and I often include that and the width and the height
01:43attribute are actually not required by the spec and I wish they were.
01:46What the width and the height attribute do is they specify the width and the
01:49height of the image for the browser.
01:52So the browser can layout the page before it loads the image.
01:55If we are going to a webpage and as the page is loading as the images are slowly
01:59coming in, the whole page is kind of moving around and making way for the images
02:03as they load up, this is what happens when you don't have the width and the
02:07height and the browser tries to layout the page and then it finds out as it goes
02:10out to load that image, oh the image is going to take this much space here and
02:13it's got to recalculate and re-layout the whole page.
02:17So I like to always load up the width and the height attribute in the image
02:21tag and this allows the browser to know before it goes out to the server to
02:25get the actual image file.
02:26It allows it to know what the dimensions of the image are, so that it can layout
02:30the page in advance and so you get a smoother user experience because the page
02:34doesn't have to jump around.
02:35It all looks very graceful as the images load in their proper places, all laid
02:39out in the page there.
02:39So I'd like to include the width and the height attributes when I can with the image.
02:45Of course, the image tag is a standalone tag.
02:48It's not a container.
02:49It doesn't have any content and so you will see this /> at the end just like all
02:54the standalone tags that don't have any content.
02:57This tells the XHTML that this is the end of the tag and not to expect
03:01a separate end tag.
03:02So this is sort of the pseudo end tag syntax that we see a lot with the tags
03:06that don't have the content.
03:08So this is the image tag and this is the basics of its attributes.
03:11So there are few more attributes that we'll see in later lessons as we learn to
03:14do other things with the image tag.
Collapse this transcript
Flowing text around an image
00:00So as we know, the image tag is an inline tag, which means it flows with the
00:05text in a paragraph, and so here we have a paragraph with an image tag in it and
00:10the image tag is the beginning of the paragraph and then we have some text and
00:14the close of the paragraph.
00:16So we see it displayed in the browser down here. We have something different
00:19that we are not used to.
00:20The text is actually flowing around the image.
00:23So if I bring this in and watch the text wraps here, it wraps next to the image
00:27and then when it gets past the end of the image, it wraps around the image.
00:32That's not what we have seen in the past.
00:35The way this is accomplished is with this align=left attribute and that makes
00:39the image float to the left side of the text.
00:42You can change it to align=right and it will float to the right side of the text.
00:48Save that and reload and there now the image is floating to the right.
00:53Go ahead and change it back to left for our demonstration purposes and reload it.
01:00Another attribute here that you may not have seen before is the hspace
01:04attribute and what this does is it provides this horizontal space on either
01:08side of the image, you see there is 10 pixels on the right and there is 10
01:11pixels on the left.
01:12If I make this a 0, I get in there and make that a 0, go ahead and save and
01:20reload, you will see that the text now wraps very closely to the image.
01:23It's right up against the image, there is no space there anymore, because I made the space 0.
01:27So I'm going to go ahead and make the space back to 10 for 10 and this makes 10
01:33pixels on ether side.
01:34You will see that the text will move away from the image 10 pixels but also the
01:38image will move over 10 pixels from the left margin as well.
01:42Reload, we'll see that.
01:44That's because this hspace=10, it makes 10 pixels on either side of the
01:48image, left and right.
01:50And you can use vspace for vertical space as well.
01:53That is the image tag we used in a floating mode.
01:56This align=left or align=right makes the image float to one side or the other of
02:01the text and makes the text wrap around it.
Collapse this transcript
Breaking lines around an image
00:00So in our last lesson we looked at how to float an image, so that the text wraps
00:05around the image and you can float an image to either side.
00:07Here we have our example from that lesson where the text is flowing around the
00:12image. We are just going to tweak this down here and bring this up a little bit
00:18so that we can show you how to break the text around the image if you need to do that.
00:23So here is our paragraph and we see our image here with the align=left that
00:26makes the image float to the left and the text is flowing around it.
00:31Let's say that you wanted to break this text say after this period here and
00:34you wanted that Jez is a Gibson L6-S to start on the line after the image and
00:39not just right here.
00:41We know that the br tag will break the text.
00:45Go ahead and insert a br tag right here, br, and you will notice that we have
00:50the little shorthand notation there for the fact that br is not a container and
00:54it doesn't have a separate end tag.
00:56So we have this little shorthand notation that allows that to work in XHTML.
01:02I'll go ahead and save this and reload the browser and there we have it, the
01:06Jez, moved from here after the sentence on the same line and moved down to the
01:10next line which is exactly what we expected to have happen, but it's not what we want.
01:14We want this to start down here under the image.
01:18So what we need is we need an attribute in the br tag, so that attribute is called clear.
01:23So we'll go ahead and put in here clear=left.
01:27This will break around any floating object on the left-hand side and make the
01:31line start after the floating objects.
01:33We'll go ahead there and we'll save and we'll reload and there we have it.
01:37Now the paragraph continues under the image after the end of the floating object
01:42there, in that case the image.
01:43So if I change this to right of course, we won't expect this to work, because
01:47that's going to make it clear any object floating on the right-hand side and so
01:52there we have just like it was before.
01:54It breaks but it doesn't clear because we are asking it to clear on the right
01:58and the image is floating on the left.
02:00Or I can say all here and it will clear any floating object, no matter which
02:04side it is floating on.
02:06So I'll save and reload and we see that that works.
02:10So that's how the clear attribute works in the br tag.
02:13You can say clear=left to clear floating objects on the left-hand side.
02:18You can say clear=right to clear floating objects on the right-hand side or
02:22you can say clear=all to clear all floating objects no matter which side they
02:26are on.
Collapse this transcript
4. Link Tags
Working with hyperlinks
00:00 In this chapter we are talking about hyperlinks but I'm going to start out by
00:03 talking about the anchor tag which is a, and you will see it right here. This is
00:10 how we create a hyperlink in HTML.
00:13 Something else is different about this chapter and I want to talk about this
00:16 really briefly here while I've got your attention.
00:18 And that is that the files in the Exercise Files folder or for this chapter,
00:23 I have got them loaded up on my web server and because we are going to be talking
00:28 about URLs, I would like to show you how the URLs work in the browser.
00:31 That way we get live URLs, real URLs, and you can actually run the examples off
00:36 of the files in my server. They have been up there for years and they will
00:39 continue to be up there, since the last time that I did a course of this title
00:42 and this is a refresh of that course.
00:44 So, I have refreshed that files and they are all still up there and they will
00:47 continue to be up there.
00:48 And the files are also included in the Exercise Files folders that came with this course.
00:54 So, you have got it both ways and you can follow along in your text editor.
00:58 And so we'll start talking about the anchor tag at this point.
01:02 So, the Anchor tag, which is spelled a, is a inline tag and you will see that
01:08 it's here inline in a paragraph, we've got a paragraph tag wrapped around it,
01:12 and it ends over here.
01:13 So, we have got a begin tag and an end tag and we have got two attributes in this one.
01:17 The first attribute is the href attribute, spelled href, and that contains the
01:24 URL that you are linking to.
01:27 And then I have got title attribute here also, which works just like other title
01:31 attributes when you hover your mouse over the link, it will give you a little of
01:34 a text tip which will say More about Bill here.
01:37 And then the content of the a tag is the text that will be used as the link
01:43 and normally on a web browser it's underlined, of course, you can change that
01:47 with CSS, but we'll be using it in a normal mode here so that we can see how this works so.
01:52 This file is loaded up on my web server and it's at this URL here, so you can
01:55 type that into your browser to follow along.
01:58 Now I'm going to switch over to the browser right now, so we can see what
02:00 this link looks like.
02:03 So here is that page in the browser and there is the link that we are looking at
02:06 and you will notice when I hover the mouse over it, it says More about Bill and
02:09 if you look down at the bottom of the screen, you will see there is the URL that
02:13 was loaded up in the link in the a tag.
02:15 So I'm going to go ahead and click on this link and you will see that the
02:19 browser loads up my homepage and there's the URL that we clicked on.
02:24 That's the URL that was in the a tag and so it loaded up this webpage which is
02:28 my homepage what it looks like today.
02:30 It will probably be different by the time you look at it because I change it a
02:33 lot and I'll go ahead and I'll click on the Back link there in the browser and
02:38 you will see that we are back at the page.
02:40 Now you will notice something else here, the link has changed color, this means
02:44 that I have already looked at this pages.
02:46 It's the same URL with a different attribute we'll look at that a little bit later.
02:51 But you will see that the link has changed color because I have already visited
02:55 that particular URL.
02:57 These other links are still the other color because we haven't visited those yet
03:01 and so the link changes color.
03:03 That's called the visited color and when you look at the attributes in CSS, when
03:08 we cover CSS you will see that the anchor tag has options for changing the
03:12 attributes of visited and unvisited links and things like that.
03:16 So, this is the visited color and it's the unvisited color.
03:20 So switching back to the text editor, you will see that this here is
03:24 what's called a URL.
03:25 URL stands Uniform Resource Locator and it's a mouthful and it doesn't really
03:31 mean what it says but in any event, that's what it stands for.
03:34 It's one of those old traditional Internet things that's just what it is.
03:38 And so, let's take a look at the parts of a URL, so we can understand how a URL works.
03:45 The first part of the URL is called the scheme and it's the part to the left of
03:49 the colon and in the case of webpage URLs, that will always be http.
03:56 You will see also, sometimes if you are looking at files on your local
03:58 computer, you will say file:
04:01 but usually the ones that we are interested in for the purposes of XHTML and web
04:05 pages we are going to say http.
04:08 The next part of the URL after the two slashes is the host name and so this
04:13 would be something like bw.org for my webpage or lynda.com for hers.
04:17 It will often have www before it or something else, but that's the host name and
04:23 that follows the rules of Internet address.
04:25 It can be an IP address, it can be a DNS name, but that follows those rules and
04:30 that's what goes in the host part.
04:32 And then sometimes you will see a colon and a number and that's a port number,
04:36 you don't see that very often anymore.
04:38 And then after all of that, you will see a slash and that's where the path
04:43 goes and so if we look at this webpage here, you will see up here in the URL
04:48 we have the scheme which is http and the :// and then we have the host name which bw.org.
04:54 On my website I don't put the www before it.
04:57 It was just a choice I made a long time ago and it's always worked for me.
05:01 I don't have a port number because that's just rare to see anymore, but I do
05:05 have the slash and then the path.
05:06 And so this path, misc/xhtml-links/ hyperlinks.html, that's the path to the file
05:15 that has the XHTML code in it, and so that is called the file path.
05:21 After the path, there can be a colon followed by parameters, you don't see that very often.
05:25 There can be a question mark followed by a query that you do see often
05:29 for interactive sites.
05:31 That has to do with the CGI spec and how CGI parameters are passed on a URL.
05:36 And often times you will see the # sign and a fragment, which takes you to a
05:40 portion of the page, we'll look at those in a little bit of detail in a later
05:44 lesson in this chapter.
05:45 So those are parts of the URL and that's what a URL is made of.
05:49 There are actually a few other little parts that you never even see anymore and
05:53 so we didn't bother to cover those, but it's a pretty complicated spec.
05:56 But mostly what you see is the scheme, the host, and the path and sometimes you
06:01 will see query and sometimes you will see a fragment.
06:04 But for the most part that's all that you will see.
06:05 So we look at this URL, we now know what these parts are, we have the scheme and
06:09 we have the host name and we have the path to the file and those are the parts
06:13 that we'll be concerned about for this lesson.
06:16 One other thing that I would like to show you about the anchor tag, before we
06:19 move on to the next lesson, you will see we have the bw.org link twice and the
06:23 other one has the target=_blank attribute and so here it is with the
06:28 target=_blank attribute.
06:30 What this does is it targets a blank page.
06:33 When we cover frames we'll see some other uses for the target attribute, but
06:37 this special word _blank, that creates a blank page for the link.
06:43 So let's look at how that is used.
06:45 This is the regular link that we clicked on before and that just takes us to the
06:48 webpage and it loads it in exactly the same browser window, but when I click on
06:52 this one and I'm in Firefox, so it will make the new window in tab.
06:56 But sometimes in some browsers, it will launch an entirely separate browser
07:00 window and you will see that it's loaded up the page here in a blank Window.
07:04 You see we still have the hyperlinks page loaded in the other Window and so in
07:09 Firefox it does them in tabs and in other browsers, it may just open an
07:13 entirely separate window.
07:14 So, that's an option that you will often see.
07:16 A lot of links on my page I tend to do that with because I want people to come
07:20 back to this page without having to use their Back button.
07:23 So, I can just close this tab and that other page is still there.
07:26 It's never gone away.
07:27 So that's the target=_blank attribute and you will see that a lot in anchor tags.
07:34 So that's how the anchor element works, the a element that's the parts of the
07:38 URL and you have seen how the link changes on the page when it's been visited
07:42 and you have seen the target=_blank attribute.
07:46
Collapse this transcript
Using relative URLs
00:00In this lesson, we're going to talk about relative URLs and these are URLs that
00:04don't have all of the different parts and are just relative to the current
00:07location of the file that has the link in it.
00:11In other words, you have a link like this, which does says here.html.
00:15The browser will assume that file exists in the same location as this page here does.
00:21And so this page exists on the web at this location.
00:25And so we'll just take this last part of it, including the host name and the
00:29path all the way up to the file name and I'll just assume that all that part is
00:33the same and the only thing that changes is the file name there.
00:36So, let's take a look at this page in browser and you'll see this is loaded up
00:40on my website at pw.org and at that path and this is hyperlinks.html.
00:46And this link here is the link we're looking at it and it just has this
00:49here.html in the link and so when I hover my mouse over the link, you'll see
00:54the title bar at the bottom, shows the location of the page that it's going to
00:58call up when I click on it and you'll see that location is the same as the
01:03location in the title bar, with the exception, then instead of hyperlinks.html,
01:07it's got here.html.
01:09So, if I click on that, you'll see that the only part that will change is
01:13this last part there.
01:14So, I'll go ahead and I'll click on the link and sure enough all the change was
01:17that and you've got here.html, instead of hyperlinks.html.
01:21So, I'll go ahead and go back to the previous page and you'll see that the
01:24visited link color has changed.
01:27Likewise, with Over there, this is another link and it has a subdirectory before
01:32there part but since there is no slash at the beginning of subdirectory, it's
01:37going to go ahead and just use this part here again and it will replace that
01:41with the subdirectory/there.html.
01:41So to be in another directory, but it will not replace all of this all the way
01:48back to the beginning, because I didn't begin with those slash.
01:50If I begin with the slash there, it would replace all of this.
01:53But in this case, it's just going to replace that last part, with
01:56subdirectory, and there.html.
01:57So, I'll go ahead, I'll click on it and you'll see that now we're a directory
02:02deeper, and we've there.html and it did exactly what we expected it to do.
02:07And this one here has a special notation with these two dots.
02:11That means go up a directory.
02:12So in this case, instead of just replacing this part here, it will go up a
02:16directory and replace all of this.
02:18So, we'll get this, else.html.
02:21And actually the link has a dash X at the end of it, so it will be else-x.html
02:26and it will start at that directory up one level.
02:28So, there we go, else-x. html and it's up a directory.
02:33So, I'll go back and now we are in our xhtml links directory again.
02:37And finally, this one, this is a link to an image and it will just display the
02:40image and likewise it will add this directory after the xhtml links directory
02:46here and show that image.
02:47And that image is the parts of the URL, from our last lesson.
02:53So, that's how relative links work.
02:56Relative links work relative to the current location, the location of the file
03:00that has the links in them and they are pretty simple once you understand them.
Collapse this transcript
Specifying a base URL
00:00So, in our last lesson, we learned about relative URLs and in this lesson we're
00:05going to talk about how you can change the base of the relative URL.
00:11In other words, we learned that relative URLs are relative to the location of
00:15the document that has a link in it.
00:16But you can actually change that by using the base tag.
00:20The base tag goes in the head section and here is the base tag here and all this
00:25does is it specifies a location that all the URLs in this document are going to
00:31be relative to and again this file is available on my web server.
00:35I'm actually using a local copy of it, because it can illustrate the same point.
00:39You'll notice in the browser here that this file is on my local machine at a file URL.
00:45Yet when I hover my mouse over this link, you'll see at that bottom.
00:49It's a link on the server and yet if you look at it in the text editor that
00:54this link, it doesn't have that whole http part of it.
00:58That's in the base and so it takes this and it uses this as the base for
01:03the relative URL and so this relative URL will start with the
01:07xhtml-links/another directory.
01:10Let's look at that again in the browser, and we see in the bottom in the Status
01:15bar down there that it shows that URL relative to the base URL at the top of the document.
01:21I'll go ahead, and I'll click on it and you'll see that the location bar in the
01:24browser will change and it will have that location on my web server.
01:28So, I went ahead and loaded this off of the web server,
01:30http://bw.org/misc/xhtml-links/another /yet.another.html and when I click on
01:38this link, it will actually take me back to the version of it that's on my server there.
01:41But it's the same file with that base URL.
01:44So that's how the base URL works.
01:46It changes the base from which the browser will construct URLs based on
01:52 a relative URL.
01:54So this relative URL is no longer relative to the location of this file,
01:58instead it's relative to this base URL that we've specified in the base tag, in
02:03the head element.
Collapse this transcript
Linking within a page using fragments
00:01Remember when we talked about the parts of the URL?
00:03This part of the end called the fragment, this starts with the pound sign or the hash sign.
00:07That's what this lesson is about.
00:09This is about fragments and how to address them and how to create them in the page.
00:15So, a fragment is a part of a page.
00:18It's a link to a location within the page not necessarily at the top.
00:23Normally, when you have a link to a web page, it brings up the page all the way
00:27scrolled to the top of the page.
00:29Sometimes you might want to link to a page so, we scroll down a ways to a
00:33particular part of the page and that's called a fragment.
00:36So, let's look at how this works in a browser.
00:38This is a list of Retail Stores and this is from a book that I wrote with my
00:42sister Lynda a long time ago called Creative HTML Design, this was one of the
00:46examples from that book for this particular technique.
00:49And you'll notice that there is a list of states at the top.
00:51These are two letter State Abbreviations except for the one in Canada.
00:57Then there is a long, long list on the same page, all of these stores, and all
01:00of these different states.
01:01So, if I go on here and I click on say Illinois, it takes me to the part of the
01:07page, you see I've scroll down that is Illinois and these are the places we can
01:10buy those rubber stamps that we are talking about in the examples for that book.
01:15Now I click on the top link and this takes me wholly back to the top of the
01:19page, so that I can look for maybe another state.
01:22So these are fragments, you will notice that the URL now because I clicked on
01:26the top link has the pound sign and the word top and when I hover over one of
01:31these top links, you'll see down at the bottom there that the URL is the whole
01:37URL to the page with the pound sign top at the end of it and when I hover over
01:41one of these other links, for the states, you'll see that down at the bottom
01:45in the status line, it shows the path to the page with the pound IL at the end of it.
01:50So, those are the fragment links and we are at links to, if I click on this, is
01:55called the Named Anchor.
01:58This is anchor into the page and its' done with an anchor tag.
02:01Let's take a look at how this is done in the HTML.
02:05This is the XHTML for the same page and you'll notice it has the list of states
02:09here with these normal looking links a href= and then its got the pound sign and
02:16the two letter code within the href attribute.
02:19And this is how you link to a part of a page, this is called a fragment link
02:23and it's a relative URL, so it fills in the rest of the URL from where the page
02:28is located that has a link in it and it just sticks this at the end of it in the fragment part.
02:32If there is already fragment part, it replaces it with this and so you get a
02:36link just down to that part of the page.
02:39If we scroll down here pass this links, you'll see the named anchors.
02:43This is a named anchor write here.
02:45See it says a name="AK" then the end of the begin tag and then it has the
02:51end tag for the anchor.
02:53You will notice that I made a separate end tag even though this anchor element
02:57is empty, I could have written it using the shortcut notation that we use in
03:02other places where we have a tag with no end tag and in modern browsers that
03:06would probably work.
03:07At the time, I wrote this page which was a number of years ago, I try that and
03:11it didn't work in a lot of the browsers and so today, they probably work better
03:15but for this particular usage, I still write it the old way because I know that
03:19there may be some browsers out there with a short-hand notation doesn't work.
03:23So just to review, this is the named anchor and this is the target of a fragment
03:29link and it's an anchor tag with just the name attribute.
03:33So it doesn't have the href.
03:34It just has the name attribute and that makes it not a link.
03:37It makes it a target for all links.
03:39It's a named target.
03:42And over here are the fragment links, there are also an anchor tag and a tag but
03:47this have an href attribute which makes it into a link and so the content of it,
03:51here the AK that will get underlined that will become the part that you click on
03:56with your mouse to go to that link.
03:58Then here you have the fragment URL, this is a relative URL.
04:03It gets tagged on to the end of the URL of the page where the link exist and
04:08it has just the fragment part so that it will link you down into that part of the page.
04:13So looking out in the browser again, I can just click on that part, I'll click
04:17on AZ over here and that will take us to that part of the page.
04:20You see we'll it scrolled down, the scroll bar over there and I click on top and
04:23it takes us back to the top of the page.
04:25So that's how fragments and named anchors work.
Collapse this transcript
Creating image links
00:00Remember that an image is an inline element and that means that it flows as part
00:04of the text and that also means that we get to use images for links.
00:08You'll see this a lot, you see an image in a web page and you click on that
00:12image and it takes you some place else and everybody is happy.
00:15They can use their images as links as it should be.
00:18And so, here's an example of how that's done.
00:20This is an XHTML file and here's a paragraph, and in that paragraph we have
00:25"This paragraph has an image that is also a link."
00:28And in fact, you see it down here in the browser.
00:31This paragraph has an image that is also a link.
00:33And there is the image and you can see it's got this pretty blue box around it,
00:36which ought to tell you that that's a link.
00:38You see the browser changes when I move it over that and when I click on it,
00:41it will take us to lynda.com because here's the anchor tag,
00:45a href=http://www.lynda.com/.
00:50So, I click on that and there is the lynda. com web page and I'll press the Back button.
00:58It will take us back here.
00:59We'll see that the pretty blue box is now purple because that's our visited link color.
01:03And so that's how an image works as link.
01:06Well, there are couple things about this that I would like to change.
01:08One is the pretty blue box.
01:10I'm not actually very fond of it.
01:12So, I'd like to get rid of that.
01:14How you do that is with the border attribute in the XHTML.
01:18So, in the image tag, I'm going to type an attribute here, border=0 and that
01:25gets rid of the box.
01:27Go ahead and save it and reload in the browser and the box is gone.
01:31That's actually much more attractive, I like that a lot better and so you see
01:35when I hover my mouse over it, it's obvious that it's a link and I click on
01:39it and it takes me to lynda.com and I click the Back button and I'm back here
01:43and everything is good.
01:45Except, you'll notice a little dotted line around it and frankly, there is not a
01:50way to get rid of that in the Firefox browser.
01:53But you'll notice that it extends beyond the image.
01:56The image actually ends about there and the dotted line is actually beyond it
02:00and enclosing the space after the image.
02:02In fact, if I click outside of the image, we'll get rid of the dotted box but
02:06you see that my cursor actually starts changing during that space.
02:10That space after the image is part of a link and that's not really what I want.
02:14On the other side, it doesn't do that.
02:16So this is just a quirk of the Firefox browser.
02:19Actually all the browsers have some kind of a quirk in this same area and I can
02:23get rid of all of those quirks with the same technique.
02:26The reason that space is part of the link is I actually told it that I wanted
02:30that space to be part of the link because after my image tag I've a new line and
02:36a couple of spaces here and then the end of the anchor tag.
02:40You see and we remember that the browser will take all of that white space
02:43including the new line and the spaces and folded into one space which is exactly
02:47what it's done here, so it looks all nice and spaced out in the sentence.
02:51But that's part of the link because I've included that in the A container.
02:58So the way to get rid of it is to take the space out of the container to abut
03:02the image tag right up against the A tag.
03:04So I'll do that at the beginning, because even though isn't creating that as
03:09part of the link, in other browsers do and then over here at the end, I'll go
03:14ahead and I'll close up that space as well.
03:17And so now our image tag is right up against the anchor tag.
03:22So the end of the begin tag, the anchor tag, there is no space between that at
03:27the beginning of the image tag and then at the end of the image tag here, there
03:30is no space between that and the end tag for the anchor element.
03:34So, when I save this and reload in the browser you'll see that you no
03:38longer have this problem.
03:40The space is not part of the link anymore and if I click on the link, you'll see
03:44that dotted box is now tight around the image and it's not enclosing the space
03:51after it anymore or the space before it.
03:53Now the only problem with this is that this makes it necessarily longer and you know how I am.
03:59I like for things to look good in my editor as well as on the page.
04:03So I'm going to show you how this can be pretty in the editor and on the page.
04:06You notice if I break the line here, and I'll indent it a little bit, that space
04:12is inside of the anchor begin tag.
04:15So that does not actually get rendered by the browser.
04:17That's part of the rules.
04:18Browser is not allowed to render anything inside of those angle brackets.
04:23And so I can do the same thing over here and I'll actually indent that like
04:30that and so the end of the A tag is over here right up against the image and
04:34the end of the image tag is over here right up against the end tag for the A.
04:39And so those spaces and those new lines while they are up on the screen in the
04:43editor and they help to make that pretty, they are not going to be rendered by the browser.
04:47So I'll go ahead and I'll save this and I'll reload over here and we'll see that
04:51our problem is still not a problem anymore.
04:53Those spaces are still not part of the link anymore.
04:57I can click on this and that full square is tight around the image.
05:01So in summary, this is how you create links out of images and this is how you
05:07make them work well in the editor and also on the page.
Collapse this transcript
5. Tables
Introducing tables
00:00Tables in XHTML and HTML are useful for showing tabular data for associating
00:07data and for aligning visual elements on a page.
00:11And so we're going to look at some examples of some tables here and look at how tables work.
00:15In this first lesson in this chapter, we've this example table and you'll see
00:19that it starts there on the page, the table tag, and way down here in the lower
00:26part of the page, you'll see that it has the closed table tag.
00:29So the table tag is a container and it's a block-level element and it creates a table.
00:35And so within the table you've different pieces of information.
00:38Here is the caption that says My Favorite Albums and so that associates with
00:42this here on the screen, and so your caption is useful for labeling the table as a whole.
00:47And then we've a table row and you see it says Artist, Title and Comment.
00:52So that's this row here.
00:53So tr is for table row and it's a container and it only exists within a table.
00:59It's not legal outside of the table.
01:02And th is a table heading element and that's for these cells within the table, right here.
01:10Now a table is organized into rows and columns, so you see the rows going across
01:14and the columns going vertical and each of the individual places within each of
01:18these little cubbyholes within the table is called a table cell.
01:22And so a table cell is one item within a table.
01:26And so here we have a table cell and here we have a table cell and here we have a
01:29table cell and these were heading cells as they have the th tag and these are
01:34data cells here as they have the td tags.
01:36So th and td are container elements. You see the begin tag and the end tag.
01:42And they are also block-level elements; they are only legal within a table row
01:46and they can have text content inside of them.
01:49So you can put text inside a td, you can put text inside a th, you cannot put
01:54text inside of tr and you cannot put text inside a table tag.
02:00Table tags can only have captions and rows and a table row can only have headers
02:05and td data elements.
02:07Notice here also on the tr that I've the valign=top attribute.
02:14And what that does if I drag the browser here so that this text wraps.
02:19You see how the text wraps but the data remains at the top of the cell.
02:24And I like it this way. It helps me to see where the cells are, especially if I
02:27don't have the borders and we'll talk about borders in a moment.
02:29But if I take this out, you'll see that the default is for a middle alignment.
02:35So I can save that and reload here.
02:38You see that these cells, they are aligned to the middle and not to the top.
02:41I like them better at the top.
02:43It's you know personal kind of a choice.
02:45The other options are middle, which is the default.
02:48I'll save that and reload and you see that Middle is what it does there, or
02:55you can say Bottom.
02:57And save that and reload.
02:59You can see that these are aligned to the bottom when they have room to align.
03:03And so I tend to make it top because I like the way that looks.
03:07I think that makes more sense to me.
03:09If it were up to me, and it's not,
03:11that would be the default.
03:13Go ahead and reload this page so that it's aligned at the top and there we go.
03:17Now I've turned on the border in this so that you could see the table rows and
03:22columns and so this all makes a little bit more sense.
03:24Normally, the default's to off.
03:26So if I delete that then save it and reload, you'll see that there is no border by default.
03:32You can also say border="0". Put that in quotes because it's XHTML and save and reload
03:42and so you can see that's with border="0".
03:45You can also put in a different number and you get a bigger border.
03:48So if I say border=3 and reload, you'll see we get big fat borders and with the
03:55drop shadows on them.
03:56You can see it will more evident if I say something like border=7.
04:00That should be pretty obvious.
04:03Go ahead and reload.
04:05So that's seeing the number of pixels and the size of the border and that's what
04:08it looks like there on the page.
04:11So border=1 is nice for being able to see the table organization there and so
04:16that's why I've done that.
04:17Normally, I would leave border=0.
04:19Of course, this table is not very attractive the way that it is and if you want
04:24to make it attractive, you can use CSS to format it and in the next lesson,
04:28we'll talk about that.
04:29But this is the basics of how a table works and how you can use a table to
04:34present tabular information.
Collapse this transcript
Formatting tables with CSS
00:00In our last lesson, we looked at how tables work in XHTML and HTML.
00:05In this lesson we're going to look at how you can format your tables using CSS.
00:09CSS stands for Cascading Style Sheets and that's the technology that's used on
00:14the web for formatting web pages and making them to look prettier than the
00:17default might be if you didn't have any styling at all.
00:20Of course, a lot of which you do with CSS, you can do with attributes in XHTML and HTML.
00:26Most people recommend that you use CSS.
00:28I'm going to tell you why CSS is better.
00:31In a nutshell, using CSS, you can name your styles and you can then apply those
00:35styles to a number of different places within your document.
00:38Then if you need to change them, you can simply change it in one place and that
00:41changes all across the document.
00:43It's a lot easier to manage your styles and it's a lot easier to apply them in
00:47an organized fashion.
00:48We'll see some examples of that in this lesson.
00:52So let's get into it.
00:53Here is the table, here in this table- css.html document and this is our editor
00:59here on the top and this is the browser here on the bottom.
01:02So you can see it's the same table from our last lesson, which looked like this
01:05except that it's got some style applied to it.
01:07So it's a bit more attractive and in my opinion it's a bit easier to read as well.
01:13So here is the XHTML file and this is the CSS file over here in this tab and
01:19we'll be looking at this in a little bit of detail as we get into the lesson.
01:23For now, let's look at the XHTML. You see there is the table and the table ends
01:27down here at the bottom.
01:28It looks very much like the table we did in our last lesson with a few
01:32significant differences.
01:34We have these class attributes here for applying the styles and we'll see how
01:39that works in just a moment.
01:41So, here's the table and over here in the CSS, you'll notice that we have some
01:46style applied to the body and we have some style applied to the table, we have
01:50some style applied to the caption.
01:52This is an example of Cascading Style Sheets, CSS.
01:56What the cascading means in CSS is the styles apply on top of styles.
02:01So, for example, we have some style applied to the body, the background is
02:05white, you see the FFF means white, the font is set to Tahoma or Sans-serif if
02:11Tahoma is not available on your system.
02:13So we see that the font throughout the document is this Tahoma font and
02:17the font size is set too, because Tahoma tends to be a little bit big, so I made it
02:21a little bit smaller.
02:23These are just my choices, of course, you can make your own choices and your own
02:26style sheet, but I like them like that.
02:28So that's applied to entire document.
02:31Even to these elements within the document, it's still applied.
02:34So the table itself has a border.
02:37It has a border style.
02:38It has a border color.
02:39The background of the table is this white, because that's the style that was
02:43applied to the background of the entire document.
02:45If I change this from white and make it-- well, I don't know.
02:49Say FCC, which is sort of a reddish color, save that and reload.
02:56We see that applies to the entire document and it applies to the background
03:00of the table there.
03:01Now there are certain table cells where I've set the color to be grey and to be white.
03:05Of course, those get their own styles, but this is an example of the cascading,
03:09because the entire document has this color.
03:13That's also applied to the elements within the document, like for instance in this table.
03:19I'll change that back.
03:20We'll see some more examples of this as we go on.
03:22It should be really clear by the time we're done. Save that and reload.
03:26Now, if we look over here at the caption, we see it says My Favorite Albums, and
03:31it has the caption tag.
03:33If we look in CSS, we'll see that we have a caption selector here on this style
03:39and that applies to all the caption tags that it will find in the document,
03:43which happens to be 1.
03:45It applies this bold style.
03:46The font is the Tahoma font because that was set up in the body.
03:52If I were to change that to something else like, oh, I don't know, Comic Sans MS,
03:58save and reload.
03:59Then we see the entire document changes to Comic Sans MS including even the
04:06caption where we have caption set to bold.
04:10It's picking up that font from the body.
04:12This is the cascading in Cascading Style Sheets.
04:15Put this back to Tahoma and save and reload and that changes it everywhere
04:22 in the document.
04:23Now, let's take a look at the table row and the table heading.
04:32Now, we'll notice in the Cascading Style Sheets, table row does not have a style
04:38attached to it. Table heading has this align equals left, font-weight, bold and
04:45color equals 666, which is a medium grey, and we'll see here that the table
04:51heading in this row here, it's got the bold.
04:54It's got the left-align.
04:55You will remember in our last document, we'll take a look at that, that the
04:59table headings were centered.
05:01I like them a lot better on the left. I think they read better on the left,
05:04they align better with the data on the left, so they look more like the
05:07headings on these tables.
05:09So it has these styles applied, of course, on top of the styles are applied to
05:13the body of the document.
05:15We have this row here which has the table row class equals grey and then it's
05:19got the data cells with their own classes: artist, title and comment.
05:23This is another example of cascading.
05:25You'll see over here we have tr.grey, tr.white and td.artist and td.title.
05:32These are selectors with classes, so tr. grey means a TR tag with a grey class.
05:40We'll look over here.
05:41We have a TR tag with a grey class.
05:44So wherever the document sees tr class = grey and there is another instance of
05:49it here two rows down, then that class will be applied from here.
05:57tr.grey has a background color set to this light grey.
06:02So all the cells within that row, we have TD, TD, TD, will all get that grey background.
06:08You'll see here they are grey, grey, grey.
06:10So that gets applied to these cells.
06:12Even though these cells have their own class, this one is artist, this one is
06:17title, this one is comment, these data classes get applied on top of the row
06:23class because these elements are within the TR container.
06:30So the TR is wrapped around these data cells and so this class gets applied
06:36first because it's in the outer box and these classes get applied on top of
06:41that because they're inner boxes.
06:43So it looks like this on the page. You have the grey all the way across and then
06:47you have this Artist class, which has got this maroon color, this Title class,
06:51which is italic, and this Comment class.
06:55You see here the Comment class has a blue color to it.
06:59So these classes here, td.artist, td. title, td.comment, they get applied
07:03after the row classes.
07:06It doesn't matter where they are in the document here.
07:08I could move these, let's drag them up here and now they're above, save that and reload here.
07:15It doesn't change.
07:16They are still applied in the same order; you've got the grey and you've got the other.
07:21That's because it's not what order they are in, in the file.
07:25It's how they appear in the document.
07:27It's what container contains something else.
07:30So I'm going to put this back just because I like it that way.
07:33Let's save it and reload and we'll see that this is still how we expect it to be.
07:39So the Artist class, the Title class, the Comment class, these apply to the fonts.
07:43We have a color, we have italic, we have another color and these get applied on
07:48top of the row classes.
07:50So in a nutshell, that's how it works.
07:52It's really easy to do by using the classes in this way, like for instance if I
07:57wanted to change this grey and make it maybe a lighter grey, I'll just type an
08:01EEE instead and save it.
08:04It applies in all of these different places throughout the document. You see now
08:08we have this very light grey.
08:09Hopefully, you can see it on your screen.
08:11I can barely see it on mine.
08:13That it applies all throughout the document.
08:14I only need to change it in one place, or make it maybe a little bit bluish,
08:19save that and reload.
08:21We have a slightly bluish grey.
08:22So change this in one place and it applies throughout the document and that
08:26really is the power of Cascading Style Sheets right there.
08:30So this is how you can format a table to make it attractive using CSS.
08:34You see here's what our table looks like before, very plain.
08:37That's the defaults for the HTML.
08:39That's how it was originally envisioned, so that they could put tabular data in a document.
08:45This is what you can do using CSS to make it more readable and more attractive.
Collapse this transcript
Aligning images with tables
00:00So, we've looked at how you present tabular data using tables, and now we're
00:05going to look at how you align visual elements using a table, how you assemble
00:11pieces of an image so it all looks like one image.
00:14This is a very common technique.
00:15I still prefer to do it with tables.
00:17I think it's easier, and I think it falls well within what tables were designed to do.
00:23So, this is how you align visual elements using tables.
00:26If you're interested in how to do this using CSS, I'm working on another
00:29course on CSS positioning, which you will also find on lynda.com, which will
00:33show how to do it that way.
00:35In this case, we are doing this with tables, and this is how it's done.
00:39Here we have an XHTML document with a table, and this is the table.
00:43You'll notice it says border=0, cellspacing=0, cellpadding=0.
00:47Again, you can do this part with CSS, if you prefer, but the idea is that you
00:51want to turn off all of that spacing stuff that tables normally do, so that the
00:55images butt right up against each other and create one big image.
00:59So, here is the nine parts of the image. There is three rows, and each
01:03row has three cells, and there are all the images.
01:07If we look at it on the browser, these are the nine images.
01:10If I just right-click on one of them and say View Image, you'll see that part of
01:13the image, and you'll see that that's part two of the image, and go back, and
01:18there we have the whole image.
01:20I'm going to go ahead and turn on the borders in the table, so that you can see that.
01:24I'll save here in the editor and go back to the browser and reload.
01:29Now we have the borders turned on,
01:30so you can see how the image is divided.
01:32You have nine parts of the image.
01:34This part here is entirely white, so is that.
01:37But there are the nine parts of the image, and you'll see this was broken apart
01:40because it has parts that are animated GIFs.
01:43That makes it easier, so you don't have to animate the entire thing; you can
01:48animate just the parts of it.
01:49Anyway, that's how that's done.
01:51Now, you'll notice that this has bad version, and there is a reason for that.
01:54Let me go ahead and turn off the border.
01:55Again in the editor, it will save, and now I'll reload this in the browser.
02:02Actually, this browser no longer shows this problem.
02:04This is Firefox, and Firefox thinks it's smart enough to know what I mean
02:09instead of what I say.
02:10So it's putting the image all close to each other, even though in the document,
02:14I've done it wrong and it's not supposed to show up that way.
02:18You'll see that the cutapart and the cutapart (bad version) both look the same.
02:22For some purposes, one could appreciate that.
02:25The problem is that it hides a problem which happens to show up in other browsers.
02:28So I have another browser here. This is the Internet Explorer browser.
02:33You'll notice in Internet Explorer that it actually shows gaps between the images.
02:38It used to show gaps vertically as well, and in this case it's only showing gaps horizontally.
02:42Older versions of all the browsers used to show gaps in between the images as well.
02:47This is because there actually are gaps in between the images in the HTML.
02:51Let's take a look at the XHTML document again.
02:54You'll notice each of my table cells, TR for the rows, you have TDs for the
02:58individual data cells.
03:00Each of my cells has the TD above, the TD below, and the image in-between.
03:04So, what's wrong with this picture?
03:05Well, you'll see that there is space before the image, and there is another
03:10space because, remember that the browser considers a new line another space.
03:14So we have, four, six, seven spaces or so here
03:18that are all getting folded into one space, because that's what the browser does.
03:21And here after the image as well, we have more spaces.
03:25If we want the images to be butted right up against each other, if we want the
03:28images to not have any space between them, then we need to not put any space in
03:33the source document in the XHTML.
03:35So, here is cutapart_good, and these are in your exercise files.
03:40You'll see how this is done.
03:41We have the TR, we have the rows.
03:43You'll see this all fits on one page really nicely, too.
03:45It still looks very nice.
03:47We have the TD for the data cell, and there is no space at all around the image.
03:51There is the image, and it's right up against the TD and right up against the TD.
03:56Now, the way that tables work, this space here should be okay, because the
04:00browser isn't supposed to display that.
04:02That doesn't appear anywhere on the screen.
04:04The only content in a table that's actually supposed to appear on the screen is
04:08the content inside the data cells and inside the heading cells as well.
04:12So, the data cell--this is what you want--has got the image in it and nothing
04:17else whatsoever, no spaces.
04:19So we have TD, TD, TD, all with those spaces, no spaces in this table at all.
04:25So if we look at the cutapart_good, in Internet Explorer, we'll see that it
04:30has no spaces at all.
04:31So, that's how that's done.
04:33So, this is how you take an image that's in pieces and you assemble it using tables.
04:38This is the correct way to do it. You have your table, border off, cellspacing
04:43off, cellpadding off and you simply put the images in your table data rows, and
04:48in your table data columns.
04:49It all comes together really nicely.
04:51It looks nice in Internet Explorer, and it looks nice in Firefox as well.
04:56So that's how you assemble an image using tables.
Collapse this transcript
Reviewing an alternative solution using CSS
00:00In this movie, I'll show you an alternate approach to assembling our image using
00:05CSS instead of tables.
00:07Many people try to avoid using tables for layout, preferring instead to use CSS.
00:12Without getting into which approach is better, they both work just fine.
00:16I'll show you here how you can do this same layout using CSS.
00:21So here you see the same exercise we had that we did tables.
00:25This is a CSS version.
00:26You can see that it looks exactly the same as the version that's done with tables.
00:32So let's take a look at the code that makes this happen.
00:34So this is our CSS version, and here is the tables version.
00:38The tables version you're already familiar with if you did the exercise
00:41with the tables version in this chapter. And you'll notice that here's the
00:45table borders, cell spacing, cell padding, all set to 0, and your table cells--
00:51all very easy to understand.
00:53And then here is the CSS version, and here is the style sheet. This is the CSS
00:59inside of this block here, and it's very simple; it doesn't take a lot of CSS.
01:04And here, the structure of this actually looks very, very similar.
01:08So there are a few things that we should notice about this.
01:11Now the biggest challenge in assembling images, and this is true for both the
01:15CSS version and tables version, is to ensure that the image doesn't get
01:19disassembled when the browser window is too small for the assembled image.
01:23Images are in-line elements in HTML so the browser will try to wrap them if it can.
01:29Now for the CSS version, there are different ways that you can do it.
01:33My solution here was to put the images in vertical columns with one div for each
01:39column, and align those columns using float:
01:41left in the CSS, and then wrap it all up in an outer div with explicit
01:47dimensions, the exact size of the assembled image, and this works really great.
01:51This makes it so that no matter how you size the browser--and here's the CSS version here--
02:01that image does not get broken apart;
02:03it doesn't get wrapped. And that of course is also true for the tables version.
02:10So here we have something that's working exactly the same.
02:13The difference is that it's organized just a little bit differently.
02:16In the tables version, we have them organized across because that's the way that
02:22table rows work, so 1, 2, 3, 4, 5, 6, 7, 8, 9. That's actually the way that I
02:27numbered the images.
02:29For the CSS version, I have got 1, 4, 7, 2, 5, 8 and 3, 6, 9.
02:35These are vertical; these are all the ones in the left column; these are all the
02:38ones in the middle column; and these are all the ones in the right column.
02:41CSS works really well for column layout, and so here instead of laying it out by
02:47rows, I laid it out by columns, and that made it work well.
02:51In the CSS, for each column--and this is the column layout here--we have a float: left and a margin:
02:580 and a padding: 0.
02:59So each column will float right up against each other, and they'll actually stack
03:03the first one on the left, the second one to the right of that, and the third one
03:07to the right of that, and that's how float: left works in CSS.
03:11And then there is this outer div, and that one here is cutapartOuter. And that
03:17outer div has the exact width and height, and that helps it to know not to break apart.
03:23So you'll notice that I used an ID selector for the outer one because I know
03:27that there is going to be just one of those in the entire document, so I used an
03:32ID selector for that. And for the classes for the individual columns, I used a
03:37class selector called cut apart column (cutapartCol), and I used the same class
03:41selector for each one of these.
03:44And that allows me to really minimize the amount of CSS that I have here.
03:49So it's really not a lot of CSS to make this happen, and it works really well.
03:54Now you'll also notice that I put the CSS inside the document.
03:57I did that because it makes it easier to describe here in the movie.
04:01You can easily put this in an external CSS style sheet.
04:04It could be incorporated into something else.
04:06It could be incorporated into the rest of your site and it could be organized
04:10just as you would with any CSS.
04:12So that's how we get exactly these same results using a CSS style sheet for
04:16layout instead of using tables for layout as we did in the previous version.
Collapse this transcript
6. Frames
Introducing frames
00:00Frames in XHTML and HTML are a way of displaying multiple pages within one page.
00:07In other words, this is a frames document and it has different areas and each of
00:12these areas has a separate XHTML page being displayed in it.
00:17When I click on the links here in the menu side, on Info, it shows me the
00:22information page here in the big open part of the frames and then Contact,
00:27it goes in this frame here, in the big frame.
00:30Each of these that I click on is going to show up there in that frame.
00:36If I open one of them by itself, in other words, here is the Info here, company
00:41information goes here.
00:42If I right-click on this link and say Open Link in New Tab, then it will show
00:47that Info page in a tab all by itself and that's what it is here.
00:52That's a normal HTML file.
00:54So, if we look at this in the Editor, here's our frames document and I brought
00:58up the nav document here too.
01:00This is the navigation document on the left-hand side.
01:02You can see it's a normal HTML file and it's just got that unordered list with
01:07all of the links in it, just like you saw there in the browser.
01:11So that's this document here.
01:13It's just a normal HTML file or rather an XHTML file in this case that is simply
01:18displayed in this frame.
01:19So, let's look at how this works in the frames document.
01:22This is frames document and you'll notice that it uses a different DOCTYPE,
01:26a different DTD, a Document Type Definition.
01:28It uses the frameset one.
01:30So the frameset DOCTYPE has these frameset tags available.
01:35So framesets have frameset tag and it has the frame tag.
01:39Now the frameset tag is a container, just like any other container, you see it's
01:45got the begin tag here and it's got end tag there.
01:48The frame tag is not a container, so it has the shorthand here for not being a
01:53container and not having a separate end tag.
01:55The frameset contains frames and it can also contain other framesets.
01:59So this frameset here is contained within this frameset here.
02:03The frameset can also contain a no frames part, so here is noframes and there is
02:08the end tag for noframes.
02:10It has a body and a normal XHTML document within it.
02:15That gets displayed if it's displayed on a device or on a browser that does
02:19not support frames.
02:21So that noframes part if what would display if the browser looking at the page
02:25does not support frames.
02:29So here is the frameset tag and you'll notice that it has columns attribute, cols.
02:33It's short for columns.
02:37So that's for vertical divisions, as you can see the comment here.
02:40This is an XHTML comment.
02:42I'm just going to cover this real quickly here.
02:44XHTML comments, just like HTML comments, they have an opening angle bracket and
02:50an exclamation point and two dashes and a space.
02:53That all delimits the beginning of the comment. The space is required;
02:57you have to have the space.
02:59And then at the end of the comment, it has a space and two dashes and
03:03a closing angle bracket.
03:05That makes a comment.
03:06This does not get interpreted by the browser.
03:08It doesn't get displayed on the page.
03:10It's just a comment so that we can help to understand the code.
03:13So this comment says cols for vertical divisions.
03:16I put these things in to help myself remember, as much as anybody else,
03:20because I don't use frames very often, so I want to remember how they work.
03:24So here's the frameset for the columns and it has a number here, 130,*.
03:30We'll get back to that in a moment.
03:31Within this frameset, there is a frame that has that navigation on the left-hand side
03:37that we saw in the browser.
03:39Then there is another frameset.
03:40This one says rows, this is for horizontal division.
03:43It's got a number here and an asterisk.
03:45So, this frameset is for rows.
03:47So looking at it on the browser, the first frameset is the column, so it has
03:51this one and it has this one, which is another frameset.
03:54So, it has this frame and it has this frameset that's divided horizontally.
03:58The second frameset has the row, so it has this horizontal one here and
04:03that horizontal one there.
04:05Going back to the document, let's look at those numbers and see what those mean.
04:08I bet you can figure out by this time.
04:09130 is the number of pixels for the first division and the frameset and then
04:16the asterisk means use up the rest of the space, divide it equally amongst
04:19whatever frames are left.
04:21So in this case we just have two, we have the one, which is the nav.html, and so
04:26that has that menu in it and that is 130 pixels wide and it's vertical.
04:31Then the next one is this frameset, which takes up the rest of the space.
04:36So, if we look at it again in the browser, you see here is the 130 pixels and
04:40there is the nav.html.
04:43If I right-click on that and say Show Only This Frame or Open Frame in New Tab, there it is.
04:49There is the Navigation menu and that's what's there in this column all by
04:53itself, 130 pixels wide.
04:56Then the rest of the space is divided up by this other frameset.
04:59Now going back to the XHTML, here is the frameset on the right and it says rows,
05:0575 pixels and then an asterisk.
05:09So, the first document is going to be 75 pixels high at the top and then the
05:14next one is going to take up the rest of the space.
05:17So we'll see here in the browser.
05:19This one here is the 75 pixels at the top and this one is taking up the rest of the space.
05:24So that's how the frames work.
05:26The frameset document sets up the space and then it specifies where all of these
05:32documents come from.
05:33So, looking again at the HTML, we have a frame here with source=content/nav.html
05:40and name=nav and then a source here for this one, it says titlebar.
05:47This was the one at the top of the rows and source here for default content at
05:52the bottom of the rows.
05:53Now, let's take a quick look at this nav.html and this is one other feature that
05:57you need to know about frames.
06:00And notice each of these links in here, these are normal anchor tags,
06:03a href=info.html target=content.
06:08This is an attribute we haven't seen before. target=content.
06:12What this means is that this link when it's clicked on will be displayed in the
06:17frame that's named content.
06:19We look back over here at the example.
06:21We see that we have a frame that's named content.
06:25It has name=content.
06:27This one is name=title bar.
06:29This one is name=nav.
06:30This one is name=content.
06:32So when those links are clicked on, we can get nav.html again, they will show up
06:37in the content frame.
06:40If we look at this again, the content frame is the bottom frame.
06:43I have a comment there.
06:44Remember, frameset rows = 75, *.
06:49So the first one is 75 pixels and the next one takes up the rest of the space.
06:53So if we look at the browser, we see that this is the 75-pixel one and this is
06:58the rest-of-the-space one.
06:59So when we click on these links, they're going to show up in this frame here
07:03that's named content and that's where they show up, so that's how that works. All right?
07:10So reviewing once more, it's really very simple.
07:13We have an outer frameset and that frameset has two spaces in it.
07:18It has a frame and I have another frameset.
07:22The inner frameset has two spaces and these are horizontal; the outer ones are vertical.
07:26The outer one is vertical because it says columns and the inner one is
07:29horizontal because it says rows.
07:32Then each of these, we have-- this one is named title bar and that takes up 75 pixels.
07:37This one is named content and that takes up the rest of the space.
07:41Then the navigation file, which is in the left frame, that targets the content
07:47frame for each of the links using the target attribute.
07:50So see, that's how it works.
07:53That is, in a nutshell, how frames work.
Collapse this transcript
Hiding frame borders
00:00In the last lesson we created this page here, which is the frames page, and
00:05it has these different documents in the different frames, and we explained how all of that works.
00:09And you'll notice that it has these lovely borders here, when I hover the mouse
00:12over them, the pointer changes to something that I can drag.
00:15So I can actually resize these borders, and that's not necessarily what you want
00:21when you're creating a frames document.
00:23Most people would rather have their frames document look like this with no
00:26borders whatsoever, and all their pages are nicely butted up against each other.
00:30So they blend together and you can even do nice things with your graphics to
00:33make them merge, so that it looks very coherent and then when I click on
00:37these links, you'll see that they all show up in the content area just all
00:44nicely merged together.
00:46So most people would like to have that rather than this.
00:48Now the problem with this is you'll notice that it says your Frames Example (not valid),
00:53and that's because that's the title that I gave the document, because
00:57there is XHTML in there
00:59that's actually not valid XHTML and that is necessary to get this effect.
01:04The problem is that the XHTML standard does not include the facility to make
01:08these borders go away.
01:09So here is the valid example, and this is as close as you can get to with valid
01:14XHTML, and you'll notice it still has this border, and I can still grab it, and
01:18I can still move things around which is not at all what you want when you're
01:24trying to get this effect here.
01:26So just as long as you understand that this is breaking the rules, and that it
01:30works in every browser I've tried it in, and the browser companies of course are
01:34more interested in having it work than in having it satisfy the standards
01:37committee, and so am I, and so are you.
01:41So we'll go ahead and I'll show you how this works, and just understand, you
01:44should try it in all the browsers that matter to you and make sure that it
01:47actually works in all those browsers.
01:48As of this recording, it works in all the browsers that I've tried it in.
01:52So here is the XHTML that I'm talking about, and this is a frameset document,
01:57and you'll notice that the only difference here between this one and the one
02:00that we looked out before is that it has this border="0" attribute, and it's
02:05just in this one place in this frameset.
02:08It doesn't really need to be in any of the other framesets or any of the other
02:12frames, or anywhere else in the document, and really that is the entire trick.
02:16The problem of course is that that attribute is not defined with this tag.
02:21And so, if you try to run it through one of those automated validated things
02:25that the standard committees would like you to be using, that I haven't even
02:28shown you where they are, you'll find that it doesn't validate, and that's
02:32really the only problem which is not a problem, because it works in the
02:34browsers, and that's what matters.
02:36So this is how you do that.
02:37I'm going to show you the valid version here, which has this frameborder="0", on
02:43each of the frames and that actually makes it stop displaying that gray border
02:48that we saw in this original one.
02:50And instead, it gives you this white border, which doesn't really help much, and
02:55so that's what the standard version of it does.
02:58The not valid version of it is the one that works, and this has the Border="0"
03:03attribute, and it looks like this in the browser.
03:06So that's how you make the border go away, and as I said, it works in all the
03:10browsers that I know of, and it is not a part of the XHTML standard.
Collapse this transcript
Creating inline frames using iFrame
00:00In this lesson we're going to talk about iFrames, which is the kind of frames
00:03that people actually use these days.
00:05The other kind of frames that we've been talking about for the rest of this
00:08chapter, those frames that divide up the screen into different areas,
00:12very few people are ctually using those anymore.
00:14You don't see them a lot on the Internet anymore.
00:17They tend to mess up the search engines and so people don't get a lot of
00:20traffic, and they also tend to mess up the users. They're hard to navigate.
00:23The back button doesn't always do what is expected to do, and so people don't
00:27like them, and they don't use them very much.
00:30The iFrame on the other hand is actually very useful, and people use them quite often.
00:35They're usually used to display some bunch of stuff that you don't want taking
00:39up a lot of space on the screen.
00:40You see here we have this Standard Disclaimer, so you'll see a privacy policy
00:44there, or terms and conditions, or something like that.
00:47They have to have on the screen for legal reasons usually, and that they don't
00:51necessarily need to take up a lot of real estate within, so that's what they're in.
00:55And just for a little bit of extra fun here in the exercise files, you'll find
00:58my Standard Disclaimer.
01:00One year I just sort of collected all the disclaimers I found on box tops things
01:04and stuck it in there.
01:04It's kind of fun to look at if you enjoy such things.
01:07In any event, here is the iFrame document.
01:11It's very simple.
01:12You see it uses the normal XHTML Transitional DTD.
01:15The Doctype is the normal one that we've been using.
01:18We don't have to have a special Doctype for that.
01:20It has all the normal XHTML that you might find.
01:23It's got this H1 tag, and the P tag, and all of that, and here it's got an
01:29iFrame tag, and this iFrame tag has a begin tag and an end tag, it's a block
01:33element, and it has its content wherever you want to have display for browsers
01:38that don't support the iFrame.
01:39Then it's got a source attribute, where you specify the file, and has width and
01:45height, little bit of style information here to create that nice little border
01:48around it, and that's it.
01:50And then it pulls up this other XHTML file, iFrame-content, and this is
01:55what goes inside the box, and you see that we have that sourced with the source attribute.
02:01It tells us where to find that, and that's this file here, which is just
02:06a normal XHTML file.
02:08You'll notice it's got the normal transitional Doctype at the top, and it has a
02:11little bit of style information there , and then it has the heading iFrame
02:16Content, oh, that's the title, iFrame Content, and that doesn't actually display
02:21anywhere here, but that is required by the standard.
02:24So we go ahead and put that in.
02:25Then it's got a body, and it's got this heading, the Standard Disclaimer is the
02:30heading, and then it has this paragraph.
02:32This product is meant for educational purposes only, blah, blah, blah, and
02:36that goes down in here.
02:37You'll notice that this is an actual frame, in an actual file.
02:41I can select with my right mouse button.
02:43I can say let's Show Only This Frame, or open it in a tab.
02:46It opens in the tab, there is the title , and there is the whole document there.
02:53So that's how you make an iFrame, you'll need to that if you need to display
02:58some disclaimer, or some legalese that you have to have in your webpage.
03:02So you don't want to have it take up a lot of screen real estate, use the
03:06iFrame tag, and you use the source attribute , and whatever other attributes you need,
03:11and there it is.
03:13It displays in that nice little handy box with a nice little handy scroll bar,
03:17so that people will look at if they are inclined to do so.
Collapse this transcript
7. Forms
Introducing forms: part 1
00:00Forms in XHTML and HTML are how you provide interactions between a user and a web server.
00:07So they look like this. You have places where you can type things.
00:10You have buttons that you can press, and you have more places you can type
00:13things and more buttons you can press.
00:15There are different types of elements in a form and these are called widgets.
00:20So you can type text into a text widget, you can press radio buttons, and radio
00:28buttons are the kinds of buttons that are mutually exclusive.
00:31In other words, I can only press one radio button at a time in a group of
00:35radio buttons, and they are groups together, so that you can have one choice out of several.
00:39Checkboxes are widgets that you can check and uncheck at will and they do
00:45not group together.
00:46So you can always check as many or as few as you like.
00:50Then this is a submit button.
00:51So when I'll click on this button, it will actually submit this data to the
00:55server, and then a program on the server takes over, and does whatever it's
00:59supposed to do with the data from the form.
01:01So there are a couple of things to understand here.
01:03The most important is this is a two-part process.
01:05There is a front end and there is a back end.
01:08The front end is the XHTML or HTML that creates the form, and we have that here
01:14in this text editor here, so that you can see how to create these widgets.
01:18This course is about the front end.
01:20The back end is what the server does with the data once you submit it to the server.
01:25The back end is usually written in a program like Perl or PHP or something else.
01:31It accepts the data from the web browser, from the form that the user has
01:35filled out on the web browser using a protocol called CGI stands for Common
01:41Gateway Interface, and it's simply the very small, very simple specifications
01:46of how the browser talks to the server and passes back and forth this
01:50information that's in the form.
01:52So this is about the front end.
01:53Now obviously the form is no good without some kind of a back end, and you need
01:59to understand that the process of installing a script on the back end is
02:03something that varies from server to server.
02:05I can give you the script, but I can't necessarily tell you how it installs on your server.
02:10The scripts that I have provided in the Exercise Files are written in Perl,
02:14and I have a separate course on Lynda.com about how to install Perl scripts on a server.
02:18Again, because all servers are different, it doesn't cover all possible
02:21situations, but it covers a lot of them.
02:23And if you are interested in how to do that, you can take a look at that
02:26course using Perl with CGI, I believe it's called, and that will teach you how to do that.
02:32In the meantime for the purpose of testing your form, I have installed a small
02:37script on my server, and all it does is it gives you back exactly what you put
02:42into the form, so that you can experiment with your form fields, and you can at
02:45least design a form and follow along in this lesson.
02:49So I'm just going to go ahead here and click on Send, and you will see what that
02:52does is it just echoes back what you have you typed in the form fields and gives
02:56you some other information that probably doesn't mean a whole lot, but in the
02:59context of the server, it does.
03:02So that is the there, so that you can follow along in this lesson.
03:06I've included that script in the Exercise Files, and I have also included a mail
03:10form script in the Exercise Files, which if you have somebody who knows how to
03:13install such things, you can install that on your server and use this form to
03:16actually send feedback to a given email address that you provide in the form.
03:20I'll talk a little bit about the CGI programs in the next lesson in this
03:24chapter, but this chapter is really about the front end.
03:27It's about how to do the forms in XHTML and HTML.
03:31So let's take a quick look at the form here, and what it does, and how it works.
03:36This is form in XHTML, and it starts here with a form tag, and form tag has a
03:41couple of attributes.
03:42It has a method attribute, and it has an action attribute, these are required. Method = "post".
03:47There are two choices here.
03:49There is get and post, and we'll talk about those in a minute.
03:52The action attribute gives the location of the CGI script on your server in a URL.
03:58In this case it's my server, bw.org is my server, and it's this test.cgi,
04:04and again, you are welcome to use that just for the purpose of following
04:07along in this lesson.
04:09Then we have the form elements.
04:12The forms elements are typically like this in an input tag.
04:16There are a few exceptions and we'll see that.
04:18The input tag here, in this case, it's type = "text" and that makes a text field.
04:24So we have here this little text box, one line of text, and that is done with
04:29this input type = "text" and name = "Name".
04:33We will talk in a moment about what this name attribute does.
04:37So here is another text box.
04:39I'll scroll down here a little bit, and here is our radio buttons.
04:44So we have input type = "radio", name = " Retail", value = "Consumer" and checked
04:51= "checked" and then here is another radio button.
04:53Input type = "radio", name = "Retail", value = "Store".
04:57So you will notice that this one here says checked = "checked" and all
05:01that means is that.
05:02That's the button that is selected by default, and this name = "Retail", you
05:07will see, we used the same name in both of the radio buttons.
05:10That's how they are grouped together.
05:11So you can only have one radio button selected at a time in a given group, and
05:17the group is defined by having the same name.
05:20So if they have the same name, only one of them at a time is going to be
05:23allowed to be selected.
05:24So we'll look at this in the browser, and here we have these two.
05:29Now I'm going to reset this form.
05:31If I just press Reload, it doesn't actually reset the form.
05:34It will reload the HTML, and it will show any changes here, but the data remains the same.
05:40So if I want to actually reload the form, and reset it to its default position,
05:45I actually have to go up into the location bar and select it, and press the
05:49Enter key on my keyboard, which I'm going to do right here.
05:52That actually resets the form to its default state.
05:55Different browsers work a little bit differently, but most of them require
05:58something like that in order to reset a form.
06:00So now it's in its reset state, and you will see that the Consumer button is
06:04pressed, because I have this checked attribute here.
06:08If I take that out and save it, and then I'll reset the form again by going up
06:15to the title bar and pressing Enter.
06:17Now you'll see that neither of the buttons are pressed.
06:19I need to press one. I don't have to.
06:22I can press neither of them.
06:23This is the only way to get neither of them to be selected.
06:26If I now select one, or select the other one, there is now no other way I can
06:30click outside of it.
06:31It doesn't unselect it.
06:32There is no other way to get none of them to be selected, but there is always
06:35going to be one at this point, and no more than one.
06:38So I'm going to go ahead and put that checked back in here, and save, and we'll
06:45go back and reset, and there we are.
06:51Moving on, here are the checkboxes, and again, if I want to make one of these
06:55checked by default, I can use that checked = "checked" syntax.
06:59Here each of them has a separate name you will notice.
07:01The name attribute is different in each one of them, and you will see that the
07:04type = "checkbox" and that's what makes them checkboxes like here.
07:08You will see also that the text that's related to both the radio buttons and the
07:12checkboxes is separate.
07:14It's outside of the form element.
07:15It's done in the HTML.
07:17So I have word consumer here before the radio button for Consumer.
07:21I have the word retail stored here before the retail store, and all of these
07:25input elements are inline level elements.
07:28So you go right in there with the text, and they just flow just like the text.
07:32So that's how that works.
07:34I just I want to show you, if I put in here checked = "checked", you will see
07:41that now this Hobbyist checkbox will be selected by default.
07:45I'll go back here to the browser, and I'm going to reset the form by
07:48selecting the location bar, and pressing the Enter key, and you see now that
07:52Hobbyist is checked by default.
07:55I can uncheck it if I want to, and I can check something else if I want to, but
07:59it's checked by default, because I had that checked = "checked" default in
08:05there, in the XHTML.
08:06So I'll go ahead and take that out, and Save, and we'll move along here.
08:12We have another text box here.
08:14Input type = "text" and then we have one called textarea, and that's right here.
08:19Textarea is a container, and it creates this text area here, which you can type
08:25a lot of stuff into.
08:26You can type a lot of stuff in here.
08:31And if I just copy and paste that, you will see that eventually it gets a
08:36scrollbar after it fills up for a while.
08:38So you can actually put up a lot of stuff in a text area.
08:42The dimensions of the textarea are specified here with cols = "30" and rows = "5".
08:49You can do different things within in CSS if you like.
08:52The contents of the container here, you'll notice it has a begin tag and an end
08:56tag is the default value.
08:58So if I put in here, This is the default for the textarea, and I click Save, and
09:06then I go in here and reset the form by selecting the location bar, and pressing
09:10Enter, you will see that now I get the default value in the textarea.
09:15So that can be useful, if you want it to default or something.
09:18We'll go ahead and take that out for now, and Save.
09:23Finally, on this page you will see we have this button, which submits the form.
09:27It's the Send button down there at the bottom.
09:29This is type = "image".
09:31So a type = "image" acts like a submit button.
09:34Instead, you can say type = " submit" and I'll click Save here.
09:41Instead of this image here, we'll get a submit button, a normal submit button as
09:46we would see in our operating system.
09:48So I'm just going to press Reload, and we'll see that the image now changes to
09:52this submit button that says Submit Query.
09:54That's the default text for that.
09:56You can change that with a value attribute.
09:58You can have it say value = "Label goes here", and if I save that, then the
10:06button will say label goes here when I reload.
10:09See, label goes here.
10:11So I'm going to go ahead and put this back the way that it was, and that's you
10:15create a normal submit button.
10:16Most people prefer the image buttons instead, so they can create their own image.
10:22They can create their own button.
10:24Most people prefer to do it that way.
10:26You can even do things like creating rollovers using CSS and a lot of
10:29people like to do that.
10:30Those are the major elements available in a form.
10:34Those are the major Form widgets available.
Collapse this transcript
Introducing forms: part 2
00:00Before we finish up with this subject, I just want to talk a little bit about
00:03what happens when you press Send.
00:06Now, in this case you'll see that it's set to Action equals and this URL here.
00:11This URL here is a test script on my server, bw.org is my server, and this is a
00:17test script that's available on my server.
00:20Go ahead and feel free to use this for testing your forms.
00:24It doesn't really use up a lot of resources on my server.
00:27So as long as I'm able to provide that, I will.
00:29When we press Send here, let's go ahead and fill some stuff and you can see what happens.
00:39I am that, and I am that, and I am that.
00:43And let's see here, Other, something else here,
00:46and "I don't really have any comments to write,
00:53so I won't write anything." There.
00:59When I press Send, it's going to send all of this data in the special CGI format
01:04to that text script on my server and the text script on my server, all it does
01:09is it takes the data that it receives and it displays it on the screen.
01:12So go ahead and press Send and there we have it.
01:15It displays that on the screen, and here it is under CGI Values and here is all
01:20the stuff that it got in the CGI.
01:22We can see that all the data is there from the different widgets that I pressed,
01:27and didn't press, and all the text that I wrote in the various text boxes and
01:32it's displayed in alphabetical order, because that's just what this particular
01:35program does and how it works.
01:37So the Name field has my name, Email field has my email.
01:42These labels here on the left, these are taken from the Name attributes.
01:47So in the Name field, the Name attribute says Name, and in the Email field,
01:51the Email attributes say Email.
01:53Next, we have the Radio buttons.
01:56Let's take a look at the Radio buttons in the XHTML and those are named Retail,
02:00and remember only one of those can be selected at a time.
02:04So one of these says Retail and it says Consumer.
02:07So the value from the Consumer one gets sent in the Retail variable and the value
02:13from the Store one would have got sent if I selected the Store Radio button.
02:17But only one of these will show up with the name Retail. So that's there.
02:22Then we have these other variable check boxes, Enthusiast, ProArtist, Hobbyist,
02:26HendrixFan, and I think I have selected three of those.
02:29I did not select Enthusiast.
02:31So we didn't get one for Enthusiast, but we've got HendrixFan on, Hobbyist on,
02:36and ProArtist on.
02:40Then the Other field which is named Other.
02:44So we'll see that here under Other.
02:45Something else here.
02:46That's what I typed.
02:47Finally, the message field.
02:49That's our text area.
02:50You'll see it says the Name = Message, and that's what I typed in there.
02:55I said I really don't have any comments to write, so I won't write anything.
02:58Finally, we clicked on the graphic and you'll notice that the graphic here gave
03:03us the Submit variable, but it gave us two of them. One of them says .x and one
03:06of them says .y and this is the standard way that Graphic Submit buttons work.
03:12It's actually giving us the coordinates on the graphic where I clicked the mouse.
03:17So this can be useful in some situations.
03:20It's very rarely actually used.
03:22Very few people actually use it or have an application for that.
03:25But you can see that it's possible to have one and there are interesting things
03:28that can be done, like for instance you could have a map and want to know where
03:32somebody clicks on a map and that would be a really easy way to do that.
03:36So those are the different variables and how they work.
03:39Now, up here in the Form tag, you'll notice that we have this Attribute Method = Post.
03:45I said I'd get back to that and tell you what that means.
03:47I'm going to change this to the other possibility, which is Method = Get,
03:52and this will give you an example of what it does and it will show you how
03:56this actually works.
03:57So I'm going to go down here and show you what it means.
04:01Now, I'm going to press the back arrow on the browser and I'm back in the form
04:06and I have all this data in it.
04:07If I just select Reload, it will reload the HTML.
04:12Oh! I didn't save it though.
04:13So I need to save that up here, there we go. That's saved now.
04:16And I'll select Reload and leave all my data in there, but it will reload the
04:20form and so when I click on Send, it will use the Get method instead the Post
04:23method and that's the Get method.
04:26So what the Get method does is it passes all of this CGI information,
04:31it passes it in the URL.
04:33So the results of my form are all up here in the URL.
04:38See that? Name = Bill Weinman, Email = ww@internet.com, etcetera.
04:45All that is in the URL.
04:46What this does is it allows the user to actually bookmark these results.
04:51So you can hit your Bookmark button and get back to this page with those results
04:56already submitted to the CGI program.
05:00So that can be useful if you're using CGI for navigation on a site and you want
05:04to be able to bookmark certain pages that you've got into by pressing a button.
05:08Most of the time though, you're going to want to use the Post method, and
05:12the Post method works like this.
05:15Type post up here, and click Save, and I'll go back to my form and I'll click Reload.
05:22That leaves the data in here.
05:23I'm not actually resetting the form.
05:24I would have to put my mouse up here and press Enter to reset the form.
05:27So we'll just hit Reload and click Send and now it's using the Post method.
05:34You'll see that there is no data up in the URL.
05:37The way the Post method works, it's kind of like an email message.
05:40It's not exactly an email message.
05:42It sent directly from the browser to the server, but it gives all that data in
05:46the body, rather than in the address.
05:48The Get method gives it actually in the URL, actually in the address.
05:52So all that data is provided.
05:53That program works exactly the same and all this data is still available as CGI,
05:58but it's just not there in the URL, and so you can't bookmark the data. You can
06:03only bookmark the location of the CGI.
06:06So most of the time, you are going to prefer to use the Post method. Now, the Action.
06:09This is where you put the URL of the CGI program on the server.
06:14CGI script, they are sometimes called.
06:16It's actually a program and it's usually written in a scripting language like
06:19Perl or PHP or something like that.
06:21And that's the server side of it, and so on the front end as opposed to the
06:26back end, you need to just specify where that is so that you know where you're sending your data.
06:31So that is forms in a nutshell.
06:33That is the different elements of the form.
06:35You have the text elements, you have the graphic box, and the radio buttons and buttons.
06:41This is what the Method means and the Action means.
06:45So this is a good overview of how forms work and ought to be enough for you to
06:49be able to design some forms and again while you're designing your forms, if
06:53you would like to go ahead and put this in the Action, you're welcome to do
06:56that to test your forms using this very little script on my server that doesn't
07:00take up much resources.
07:02Then when you're actually ready to put your form into action and to use your
07:06form for a specific purpose, you'll need a script on the back end that does the
07:10CGI, that either sends an email or does whatever it is that you want to be done
07:14with your form and so you need to have somebody with some programming skills who
07:18is capable of doing that.
07:20I do have another course on lynda.com that explains the process of installing a
07:24script that's already written on a server and like I said, this process is very
07:28different for different servers and so I can't cover all of the different
07:31possibilities in the course.
07:33But it gives you some good guidance for how to do that if you want to check it out.
07:36It's using Perl with CGI and it talks about how to do that with Perl scripts,
07:41and so that is forms and that's how they work.
Collapse this transcript
Using CGI with forms
00:00 CGI stands for Common Gateway Interface and it's the back end of how forms work.
00:07 Strictly speaking, it's the protocol that the web browser uses to talk to the
00:11 server and to send it the data that you filled in, in the form.
00:14 On the back end, CGI programs can be written in a number of languages.
00:19 They are commonly written in Perl or PHP or ASP or something like that.
00:25 These are languages that are commonly used with CGI.
00:28 I have provided in the exercise files a couple of CGI scripts.
00:33 One is the test script that we saw demonstrated in the last lesson.
00:37 It's very simple and this is provided so that you can install it on your server.
00:43 Now, how to install it on your server is going to depend a lot on your server
00:47 and there is some guidance available in another course that I have on
00:50 lynda.com called Using Perl with CGI but I have provided here for your use if
00:55 you would like to use it.
00:57 Likewise, there is another CGI script here called mailform.cgi and this I have
01:03 also provided for your use if you have a way to use it and if you have the
01:08 skills or have somebody with the skills to install it on your server.
01:11 It's a very simple mail-form script, you can put in your email address up
01:16 here and the mail too and it will very safely and securely go ahead and send you an email.
01:23 I just want to make a note that there are other scripts out there called
01:26 mailform.cgi that do have security issues.
01:30 So if you go to install this on your server, your ISP may complain that Oh!
01:35 That's an insecure script.
01:37 You can tell them this is not the one that's insecure and they are welcome to
01:40 take a look at it or even to communicate with me, and we can set their worries at ease.
01:45 Also, on my website at cgi.bw.org, there are a number of other CGI scripts
01:51 including a much more sophisticated mail- form script which you can use as an alternative.
01:56 Again, that's more complicated to install, and you might need some other skills
02:00 to install that, and you can certainly refer to my Using Perl with CGI course
02:04 for some guidance on how to do it.
02:06 So again, this is about the back end.
02:08 These are scripts that you can use on the back end.
02:12 The purpose of the test script is simply to test your forms and also to test the
02:16 process of installing scripts on your server and the mail-form script is
02:20 available, or should you want to use it for sending yourself email with the form
02:24 data whenever somebody submits a form on your website.
02:28
Collapse this transcript
8. CSS
Introducing CSS
00:00CSS stands for Cascading Style Sheets and this is the technology that's used for
00:05formatting web pages.
00:07This chapter is about CSS.
00:09It's not intended to be a complete reference on CSS.
00:12It's intended simply to expose you to it and show you what it looks like
00:15and roughly how to use it so that you can apply it to some extent in your own documents.
00:21For a complete reference, there is another CSS course here on lynda.com in addition to
00:27some other more task-oriented courses that cover CSS and many references
00:31available at other places as well.
00:33So this is not intended to be a complete reference.
00:35It's simply intended to be an overview and to give you enough information so
00:39that you can start to use CSS in your own documents.
00:42This is an example of a document which is rendered without CSS, and this is the
00:47same document with CSS.
00:49You can see we have accomplished the same formatting in both of them, so we can
00:52look at how that's done.
00:54Here is the no CSS version. You will see it has got the background color and
00:58the text color specified here in the body tag, and here in the CSS version,
01:04it has the same thing specified, but they are using a Style attribute instead and
01:08this is CSS inside the quotes, inside the Style tag that's written in the format of CSS.
01:14So let's just take a look at how this works.
01:16We'll go ahead and we'll change something here.
01:18We'll change the font of the document.
01:20We'll choose the Font Family attribute, Font-Family, and we'll say that
01:26that's going to be Tahoma.
01:28Choose that Sans-Serif one.
01:28It will look very different from what we have here now.
01:31I will Save that, and go ahead and Reload in the browser, in the CSS Body Style
01:37version, and go ahead and hit Reload and there we have the same document and
01:41it's simply changed.
01:42It's using the Tahoma font family now. So that's it.
01:47That will change everything in this body container.
01:50So the body container, it comprises the entire document beginning to end, the
01:55content portion of the document.
01:57So all of that is changed to the Tahoma font.
01:59Now, let's say we just wanted to change the h1 tags.
02:02Well, we can create a little style sheet inside this document and we can use
02:09the Style tag for that.
02:13This is different than the Style attribute.
02:15The Style attribute applies to one element in one place in a document, the Style
02:19tag applies to the entire document.
02:22So up here, we can say h1, and that will select all of the h1 elements in
02:27the entire document.
02:29We can put a style inside these brackets here and just say color:
02:33#006 and that will make a blue color.
02:39So I'll save that and now all of the h1 elements, which are these headings here,
02:44will change to blue.
02:45Go ahead and Reload, and there you see that they are now these dark blue that
02:49I specified as 006.
02:51So that's how you can change just one element.
02:53That's just little bit of a sneak peak of the power of CSS that allows you to
02:58change one tag throughout the document.
03:00So every place that tag shows up in the document, it will be changed.
03:04This is what CSS does, this is how it works, and so through the rest of this
03:08chapter, we'll be looking at how this all works.
Collapse this transcript
Understanding levels of inheritance
00:00CSS stands for Cascading Style Sheets and the word CSS refers to inheritance,
00:06and this is about how styles inherit their properties from one another in CSS.
00:11So let's take a look at an example here and see how that works and what that means.
00:15So here we have a document that's formatted with CSS and here we have the same
00:20document in the text editor and you will notice that there aren't any styles in here.
00:25All of the styles in this document are defined in this external style sheet
00:29right here, which is brought in with this link tag, and so that's in the head
00:34element and link tag has a rel attribute which stands for relationship and that
00:41is set to stylesheet.
00:45And it has a type attribute, which is set to text/css, and it has an h attribute,
00:51which is the location of the file, which is here in this external CSS file.
00:56And the style sheet is in this external file right here, which is also loaded up
01:00in our text editor, and there it is.
01:02You will see that it doesn't have a lot in it.
01:04It's not a very complicated style sheet and that's the style sheet that's used
01:08to format this document here.
01:10So we'll notice that the body style has a background-color and a color for the
01:15text and a font-family and the h1 style has a different font-family and so that
01:21sets the Verdana font for these headings and the paragraph style has yet a
01:25different font-family, which is Tahoma or a backup of sans-serif.
01:30Tahoma is loaded on the system and that's this font here, which is used for the paragraphs.
01:35We have a couple of other styles here. We have our first style and a highlight
01:40style and these use class selectors.
01:42You will notice these selectors have a little period before them and that makes
01:47them class selectors and those are selected in a different way.
01:51In other words, these tag selectors, these mean that this style will apply to
01:55all the p tags in this context and the h1 likewise for the h1 heading tags and
02:01the body of course for the whole body of the document.
02:04So these are tag selectors and these are class selectors.
02:08class selectors are applied using the class attribute.
02:12Let's go ahead and apply this first class to the first paragraph of the document
02:15and when we do that, we'll see this first paragraph will not be indented
02:19anymore, because this sets the text-indent to 0.
02:22So what we are demonstrating here is part of the inheritance, the cascading of
02:27the Cascading Style Sheets.
02:28What will happen is that this paragraph will first be formatted by the body
02:32because the paragraph is inside the body and then it will be formatted by the
02:38paragraph style right here with this font-family and line height and text
02:43height, and we'll see that's already applied here and then after all of those
02:47have been applied, it will apply this first style.
02:50So it will take the text-indent away so that document won't have any indent for
02:54this particular paragraph.
02:56So let's go ahead and apply that style to that paragraph, which is right there,
03:00and we'll say class="first" and that class attribute is available for most tags
03:08in XHTML and HTML and that applies a class based on the class selector.
03:13So we don't put the period here, but we just use the name of it, so it's first.
03:18If I go ahead and save this and reload the document, you will see that this
03:23paragraph is no longer indented.
03:26So the p style is still applied.
03:28We have that line height.
03:30We have the font and all of that.
03:32The body style is still applied, because the body is first in the hierarchy.
03:36Let's take a look at the hierarchy here.
03:38You can see the body is first, because that encompasses the entire document and
03:42then the h1 is applied on top of that, so it has that color from the body but
03:48it has the font from the h1 and the p style is applied on top of the body,
03:53not on top of the h1 because they are next to each other in the hierarchy but
03:57it's applied on top of the body because the body is first in the hierarchy and then the p.
04:02And then this class style is applied on top of it.
04:06This first style is applied on top of what's already defined for the p because
04:09that's later in the hierarchy.
04:11We are applying it just to this one paragraph, but not to this other one, and so
04:15that's the way that it's working here.
04:16We have the body style and then the paragraph style and then the first class is applied.
04:24Let's look at another example, we'll use this highlight style, we'll see that
04:27the highlight sets the font-weight to bold and it sets the background-color
04:31to this other color.
04:32So it will look like a highlight in the document.
04:34We will go ahead and highlight just a couple of words here.
04:46So the span tag is used for applying class to an inline element.
04:50It's an inline tag and it's a container.
04:53So you put content inside of it.
04:55It has a begin tag and an end tag and it's just there for applying class.
05:00That's really all that the span tag is for.
05:02It doesn't have any properties of its own and so this allows us to apply a class
05:07to an inline object and this text here is inline with this paragraph.
05:11And so when I save this, it will apply that highlight class on top of the class
05:17already applied to the paragraph.
05:19And so it will use the same font and it will use the color from the body.
05:24Remember that the color of the text is set in the body and so this is definitely
05:28after that in the hierarchy and then it will apply a background-color on top of
05:33that and a font-weight, so it won't change the font but it will just use a bold
05:37version of this existing font.
05:38So let's go ahead and reload this in the document.
05:41You will see, there we go.
05:42It's bold and it's highlighted and everything else is the same because it has
05:48inherited all of those other styles because that's where it is in the hierarchy.
05:52And so this is how inheritance works in CSS. The C in CSS is for cascading,
05:58Cascading Style Sheets and cascading refers to inheritance.
06:02It refers to how the styles are inherited from one another and applied on top of
06:07one another within the hierarchy of the document.
Collapse this transcript
Learning CSS syntax
00:00In this chapter, we are going to look at the syntax of CSS so you'll know how to
00:03read the CSS that you see and you'll be able to write your own CSS.
00:08So here we have a document that is formatted with CSS and here we have that same
00:12document in the editor and here we have the CSS style sheet.
00:16You'll see we are using an external style sheet that's called in right here and
00:21there's the style sheet there.
00:23This is the same style sheet that we are using throughout this chapter and
00:27so you see it is possible and common to use an external style sheet for
00:31multiple documents.
00:33It makes it very easy to keep track of the styles and the formatting across
00:37different documents.
00:39Before we get into the syntax of the CSS itself, there's one subject that I'd
00:43like to cover in the XHTML on how the styles are applied.
00:47There are two special tags in XHTML and HTML called span and div.
00:52Div is a block level element and span is an inline element.
00:58So they are used like this.
00:59They don't have any properties of their own.
01:03They are used for applying styles.
01:05So if I say div over here and I say style equals color blue and then I close
01:14that down here with the end tag for div.
01:23I'll go ahead and I'll save that.
01:25Now this section of the document will come up with blue text whereas the rest of
01:29the document will have the text that's defined in the body element in the CSS.
01:34So I'll go ahead and I'll reload this. There you have it.
01:37This section is now blue and the rest of the document still has the color that's
01:40defined in the body element of the CSS.
01:43So that's how div works.
01:44Div is for applying style to a section of a document at the block level.
01:49In other words, these are block level elements.
01:51The <h1> and the paragraph are block level elements.
01:54So I need a block element to wrap around them so that I can have blocks
01:59inside of that tag.
02:01Likewise, if I wanted to do the same thing but on the inline level, I would use <span>.
02:15So <span> is an inline level element that has no properties of its own but is
02:20used for applying style.
02:22So here we have span and a style of color red.
02:24So the text of this word, originally, will be red, whereas the rest of this
02:30paragraph will still have the color that it's inherited from this <div> element
02:33that we just inserted.
02:34So I'll go ahead and I'll save that and we'll see that the word, originally,
02:38will now turn up red and there we have it.
02:41You'll notice that they inherit just as you would expect them to because the
02:47<div> element is outside and the <span> element is inside.
02:51So <span> inherits its properties first from the paragraph, which is just
02:55outside of it and then from the <div>, which is outside of that.
02:58So it still follows the same hierarchy as rest of the rules for applying CSS.
03:04So let's take a look at the style sheet itself and we'll understand some of
03:08the elements of how the style sheet works and how the syntax of the style sheet works.
03:14Here we have the words body and h1 and p, and these are selectors.
03:17So the selector is the first thing that you'll see in a style in the style sheet.
03:23There are three different kinds of selectors.
03:25This is a tag selector and this is a tag selector and this is a tag selector.
03:29So these are names of tags and you don't see any special punctuation around them.
03:34When you see a period before the name, as in the case of .first, and in the case
03:38of .highlight, those are called class selectors and those are applied using the
03:44class attribute in XHTML.
03:47So here, instead of using style, if I simply said class equals highlight,
03:56that selects the class style using the class selector.
04:00So I'll go ahead and save that and we'll look at in CSS.
04:03So we have this highlight selector with the dot before it.
04:06That makes it a class selector.
04:08So we use the class attribute to select that.
04:11So class equals highlight and the class attribute selects that.
04:17Notice that there's no period here.
04:18We don't use the period in the name on the XHTML side.
04:22We just say the word highlight.
04:24The period is used in the CSS just to say that it's a class selector.
04:28I've saved that and I'll go ahead and reload in the browser and we see that now
04:32it has that bold font and the highlighting behind it.
04:37In fact, if we wanted to, we could apply the class selector to
04:43any element in the HTML.
04:46We could apply it to this <a>. We can say class equals highlight and now the
04:54anchor link will be highlighted in the HTML, see there, or we could apply it
05:02even to the entire paragraph if we wanted to.
05:10And then the entire paragraph would be highlighted like that and that's a block level, so it highlights
05:17all the way from margin to margin which is how block levels work.
05:22So that's the class selector.
05:23Like I said, there are three different types of selectors so we've seen two of them.
05:26We've seen the tag selector and we've seen the class selector.
05:29Let's take a look at the third type, which is called the id selector.
05:39So here I've created a style and it's called whois and it uses an id selector.
05:44The id selector uses a pound sign where the class selector used the period.
05:50So that's the pound sign or the hash mark, the tic-tac-toe looking thing that's
05:53in the Shift+3 on my keyboard.
05:56So that's the id selector.
05:58So I'll go ahead and I'll save this and we'll go into the XHTML.
06:02Take this highlight out there.
06:04It doesn't get too confusing.
06:07So you see here we have style color equals blue in div.
06:10I'm going to go ahead and I'm going to say id equals whois and this is how
06:15this is typically used. I'll save this.
06:17So now, this entire section here with the div is going to use this whois
06:23selector and that is an id selector.
06:25Now the major difference between an id selector and a class selector is that a
06:30class selector can be used over and over whereas an id selector can only be used once.
06:35So I'm really only allowed to use this at one place in a document.
06:39If I wanted another div around this other section here, I would have to name
06:44that something else.
06:46So this is used for marking up an entire section of a document.
06:49It might have like a main article, it might have a sidebar, it might have
06:53something else and you can separate those sections of the document with id
06:58selectors and that allows you to apply a style to that whole section of the document.
07:03We'll see a number of examples of this when we look at building a website in the next chapter.
07:07But let's just take a look at how this works for now.
07:10We've set up this id selector with the class name of whois and here it is,
07:14id whois with the id selector in the CSS.
07:18I'll go ahead and reload the document and you see that this is all blue,
07:22just like we expected because we have set it to be blue.
07:25We can make it something else just so you can see it and say 606 and it will be
07:31a sort of a purple color.
07:33We'll save that and go ahead and reload in here.
07:37So that's sort of a burgundy color there.
07:39That's how the id selectors work.
07:41So those are the selectors and there are three different kinds.
07:45Then there's a pair of curly braces and the curly braces actually delimit the style itself.
07:51So all of this is within the style and it's within these curly braces.
07:55So that's part of the body style.
07:57Then inside of the curly braces, we have the style itself.
08:00Now the style has two parts.
08:03It has the property part, which is to the left of the colon, and to the right of
08:07the colon, it has the value.
08:09So each of these styles, there is a background-color property, a color property,
08:13font-family property and the value there is helvetica, the value here is #630,
08:19the value here is #ffc.
08:21So we have the property and the value, property-value, property-value, and then
08:27each property-value combination is separated by a semicolon.
08:31So you have a semicolon there and a semicolon there and a semicolon there.
08:35Now, technically, the semicolon is not required on the last property-value
08:39combination, but I usually include it when I'm writing style sheets like this
08:44and the reason is that it's just hard to keep track of which is the last thing.
08:49If I omit it here and I decide I want to add a property after it and I say color
08:54equals green then it's just not going to work.
08:58You are not going to see the color equals green.
09:00You also won't see the indent.
09:01I'll go ahead and I'll save that and I'll show that to you. This is an error.
09:05So the reason for that is that I eliminated this semicolon.
09:09I didn't use it as the last one and then I added something and I forgot to put it in there.
09:14So if I put this back in, then we'll see the color will become green and we'll
09:19have the indent again.
09:22So that's why I go ahead and I use them anyway, even though they are not
09:24required on the last element. They are technically supposed to be separators.
09:30Most people will use them as terminators instead. In other words, they'll put
09:33them on every line and that's the reason for that because otherwise, you have to
09:37keep track of it and it's just too hard to do.
09:40So there you have it.
09:41That is the syntax of the CSS.
09:45You have the selector, you have the curly braces, you have the properties and
09:49values, you have your semicolons.
09:51I just want to cover one other thing that's easy to get wrong and I'm going to do this here.
09:57I'm going to say in this div, instead of saying id equal whois, and I'm going to
10:01go ahead and put in a style using the style attribute and I'm going to say color
10:06equals green and we are going to try and set the color here and it's not going
10:11to work because I've made a mistake.
10:12I made a very, very common mistake.
10:15I am going to ahead and I'm going to save that and we'll load it up over here
10:18and we'll see that the color is not green.
10:21Can you see the mistake? Aha!
10:22I used an equal sign instead of a colon.
10:25The colon and the space isn't required but I like putting a space after a
10:29colon and most people do.
10:31Not everybody though.
10:32You won't always see the space.
10:33And I made this mistake because I'm so used to in HTML and in XHTML typing an equal sign.
10:38So often times, I'll set up a style in my XHTML like that and I'll use an
10:44equal sign and I won't notice and I'll save it and I'll load it up and it won't be working.
10:48I'll say why isn't that working and sometimes it will take me a while before
10:51I notice that I use an equal sign instead of a colon.
10:53So I'm just warning you.
10:55Then you'll see that this works now.
10:56I'll go ahead and load that up and now it's green.
10:58It works with the colon;
11:00it does not work with the equal sign.
11:02So that's just something that you can be on the watch out for and it's a little
11:05gotcha that happens a lot when you are writing the CSS in the XHTML file using
11:10the style attribute like that.
11:12So there you have it.
11:13That's the syntax of CSS.
11:15That's how CSS works.
11:16We also talked about the <div> and the <span> tags, which are really useful for
11:20applying style in a document.
Collapse this transcript
Using units of measure in CSS
00:00 In this lesson we're going to talk about units of measurement in CSS.
00:04 CSS uses units of measurement to say how big things are going to be, how far
00:08 apart things are going to be.
00:09 There are actually a lot of units of measurement available, and we're going to
00:12 talk about just a few of the major ones.
00:14 For a complete reference check with any CSS reference or with the CSS
00:18 course here on Lynda.com.
00:20 So here we have a document that's formatted with CSS and this is the Style Sheet
00:23 that's being used for this document.
00:25 We see that we have a few things in here that are measured already, especially
00:28 in the P style, for the paragraph.
00:31 We have line-height, which is set to percent.
00:33 So that's the percent of the size of the font in the paragraph.
00:38 So it's set for 140%.
00:40 If we change that to say 200%, you'll see that it changes down here in the
00:44 document for all the paragraphs.
00:46 We'll Save that and Reload, and now we have a larger separation between the
00:51 lines, and you'll see that the bottom of this line is about twice the height of
00:55 the line from the bottom of this line.
00:58 Likewise, we have the text-indent, which is set in ems, two ems.
01:01 Em refers to the width of the M in the font.
01:06 So here we have an M, right there.
01:09 So this indent is supposed to be twice that width.
01:11 It looks like it's a little bit more.
01:13 One of the things that happen with typography-based measurements on a screen is
01:17 that the screen itself is made up of pixels.
01:20 So any typography-based measurement is going to have to be translated into
01:24 pixels, and this would go also for inches and centimeters and things like that.
01:29 It has to get translated into pixels.
01:31 So it's going to depend on the dimensions of the pixels in your
01:34 particular monitor.
01:35 So it's always going to be a little bit off.
01:38 So that's just the fact of life in using raster-based media with
01:43 something that's measured in absolute measurements like inches or ems or
01:46 points or anything like that.
01:48 So that's the em measurement.
01:50 There's also an ex measurement, which refers to the height of a lowercase x. So
01:56 I can say my line-height here is going to be say 3 exes, 3ex, like that. I'll Save.
02:04 So that's to height-based measurement and it's based on the height of the
02:07 lowercase letters in the document.
02:09 I Reload, and there we have, the space is set to one, two, three times the
02:14 height of a lowercase x.
02:16 So let's go ahead and set the size of the font in points.
02:20 Fonts are typically measured in points, and we'll go ahead in here and we'll
02:24 say font-size, and 12 points is the default typically, so I'm going to go ahead
02:30 and make it 14 points.
02:32 So I'll make it a little bit larger.
02:33 pt stands for points.
02:36 I'll save and I'll reload over here in the browser, and we see that the text is now larger.
02:42 All of the font-based measurements have been updated as well.
02:47 Finally, let's talk about doing things in size of pixels.
02:50 I just want to say that because a computer screen is a raster-based medium, when
02:55 you're measuring things for a computer screen, pixels are what matters.
03:00 Now, there's two ways to look at this.
03:01 One is if you want a page to look exactly how you want it to look, measure
03:06 things in pixels and it will come out pretty close.
03:08 It's not always going to be exactly the same on everybody's monitor, and there
03:11 is reasons for that, but it will be really, really close.
03:15 When you're measuring things that are fix number of pixels and size, things like
03:18 the dimensions of an image, they will always be exact.
03:21 But things like font-size tend not to be exactly the same from device to device
03:25 when they're measured in pixels.
03:27 There are reasons for that, and it has to do with how fonts are measured and
03:30 how they're rendered.
03:31 But the point is that if you care about how things are going to be relative
03:36 to fixed pixel sized objects on the screen, you want to use pixels in your measurements.
03:41 Now, the other side of this coin is that for people who like to change the size
03:45 of the fonts on their computer screen, like older people who might have trouble
03:49 seeing, they tend to increase the size of the fonts on their computer screen.
03:54 If you measure your fonts and your Style Sheet in exact pixels, they're not
03:57 going to be able to do that anymore.
04:00 So that's just another consideration to think about when you use the
04:03 pixel measurements.
04:04 Now that said, a lot of people like the pixel measurements because it allows
04:08 them to exert a lot of control over how their page is rendered on the
04:12 browsers that are viewing their page, and there's something to be said for that viewpoint.
04:15 So we're going to look at that.
04:16 I'm going to go ahead and I'm going to change this to 14 pixels instead of 14 points.
04:21 You'll see how that looks different on the screen here.
04:24 I'm going to Save and go ahead and Reload, and there's the 14 pixels version
04:28 rather than the 14 points version.
04:31 Likewise, my indent here, I can measure that in pixels, I can go ahead and say
04:35 200 pixels for that and save that and Reload.
04:40 We'll see that we get this nice big 200-pixel indent there for the first
04:44 lines of our paragraphs. There you have it.
04:46 Those are the units of measurement in CSS.
04:49 Those are the most common ones.
04:50 There are a few others available.
04:52 For a complete reference you can check with any CSS reference or the CSS
04:55 course here on Lynda.com.
04:58
Collapse this transcript
9. Creating a Simple Web Page from Scratch
Comparing table layout and CSS layout
00:00In this chapter, I present a complete web site for the purpose of demonstrating
00:04the techniques covered in this course in the context of a real-world project.
00:09The web site uses tables for layout.
00:12Because this course is about XHTML and HTML and because it is not about CSS,
00:17I chose to avoid CSS for the layout in order to show how to use XHTML for this purpose.
00:24Keep in mind that this is not considered best practice in today's world.
00:28Using CSS for layout is commonly considered a better choice, and I strongly urge
00:33you to learn how to lay out your sites using CSS.
00:37On the other hand, understanding legacy technologies is generally a valuable
00:41and practical pursuit,
00:42if for no other reason than there is a lot of legacy technology out there and
00:47you will likely encounter it in your work.
00:49How often you encounter a legacy technology will depend on how popular that
00:53technology was, or is, and how recently it became obsolete.
00:58In the case of HTML table layouts, this has been a very popular technology, and
01:03its obsolescence is relatively recent, and it's still in wide use today.
01:08At the end of this chapter, I present an alternate version of this same site
01:13using CSS for layout instead of tables.
01:16This is discussed in detail in my course CSS Positioning Best Practices here in
01:21the lynda.com Online Training Library.
Collapse this transcript
Exploring the finished web site
00:00So now we've learned some XHTML and some CSS, and let's put it to use.
00:06What we have here is a website that has been provided for us.
00:11It's been designed, all the assets have been created, all the images have been
00:15built, and they are all sitting in folders in our Exercise Files.
00:19Our task is to build a website that looks exactly like this using the techniques
00:25that we have learned.
00:26So this website is small. It has four pages.
00:30They all have this basic layout, with main content on the left and sidebar
00:34content on the right.
00:36This page here has got some products on it, and this page here is about
00:40the surfing lifestyle.
00:41This page here has an embedded YouTube video on it.
00:45So our task is to duplicate this website with what we've been given.
00:49So we've been given all of these images.
00:51We've been given all of this text, and we've been given an example of what it looks like.
00:55So this is not unlike how oftentimes I'll get a job where the designers
01:00have done their bit and now they want me to put all of this together and make it work.
01:04So let's take a look at the Exercise Files folder and see how this is organized.
01:09Here we have in Chapter 09 of our Exercise Files, we have a number of different folders.
01:15The complete-site is in folder number 01, and so that is with Chapter 09, Lesson
01:1901, which is this one here.
01:21So that has the complete-site, which we're looking at right here, with all of
01:25these pages and links and such in it.
01:28Then each of the other lessons has its own Exercise Files, so there is Lesson
01:3202, which is where we'll begin building the header, Lesson 03, we'll build the
01:36Contact menu, lesson 04, we'll build the main menu.
01:39So each of these has its own purpose.
01:42Each of these has a beginning place and an ending place, like here we have
01:45this beginning-html.
01:47So what you'll do is you'll save this as heading.html, and then by the time
01:52you're done with the lesson, it should match the ending.html.
01:55Likewise, in the CSS folder you'll have a beginning and an ending.
01:59You'll save the beginning as main.css.
02:02In the lesson, I'll tell you all of this so you don't have to memorize it or
02:05write it down right now.
02:06I'll guide you along.
02:07I'll say okay, now we're going to save as main.css.
02:11So the idea is for you to follow along with me, and by the time this is all
02:16done, at the end of the chapter, you will have built this website in your
02:20machine, with your own text editor and your own tools.
02:24I want to thank James Williamson who designed the original version of this
02:28website and wrote the clever copy you see here.
02:32So we can put that into practical use and see how it all goes together to
02:35build a complete website.
Collapse this transcript
Building a document header
00:00Now, we are going to begin building the website and all of the graphics and all
00:05of the design has already been provided for us. Our task is to take the assets
00:09that we've been given and create a website that looks like this.
00:12As a beginning place, we have our exercise files and in the chapter 02-header folder,
00:20we have a beginning and an ending. Ending is what the file is supposed
00:24to look like when we are all done and we also have a beginning and an ending
00:27CSS and these are loaded up in our editor.
00:31So, the first thing that we're going to do is we're going to save both of these
00:35files as a different name.
00:37The point of this is so that we can do our edits and work on the file and not
00:42write over the original files that came with the exercise files, so that we have
00:46our beginning place still if we need to go back to it.
00:49So, the first thing we are going to do is save this file as, I'm going to call
00:52this one header.html because over the next couple of lessons we are going to be
00:56building the header portion of the website and for the CSS file, we'll do a Save As.
01:03CSS file is going to be called main. css because that's how it's referenced
01:08in all the HTML files.
01:10So, all the HTML files can share this main.css and in that way we are not
01:15overwriting our original files and we can go back, if we need to, we can do the
01:18exercises over again, if we need to and we still have our starting place. All right.
01:23So let's get started.
01:24The first thing we are going to do here in the header.html file is change
01:28the title and it will be Welcome to Groundswell and we are going
01:35to link in the external CSS.
01:52So, this is the Link tab.
01:54We've seen this before, because in the head section of the XHTML, attributes are
01:59href, which gives the location of the CSS file, and the rel, which is the
02:04relationship and that's called style sheet and the type, which is text/css.
02:09We have this little shorthand for closing off a tag that does not have an end tag
02:13and we'll go ahead and save this and load it up in the browser.
02:19We'll go here and we'll drag it from the Explorer window and there we have it,
02:29Welcome to Groundswell, and the content here.
02:31Now, let's go ahead and add some style using the style sheet.
02:35First thing we are going to do in the style sheet is we are going to put in our
02:38global default styles.
02:40So, we are going to start with a comment. I always like to have comments
02:43separating the sections of the CSS, call this global styles.
02:50Comments in CSS are separated by these /* and */.
02:57This syntax is taken from the C programming language where comments are done like that.
03:01Go ahead and start with the body.
03:02I'll like to put a few things in the body.
03:07I'll like to give it a default font family, even though it will probably never be used.
03:13It's just a good practice.
03:21In this case, we'll give it a sans- serif font family and we'll set up the backgrounf.
03:39And the background here has two parts to it.
03:42So, we're using the shortcut in CSS. We are doing both the background color and
03:47the background image at the same time and so we have bbb, which is a light gray
03:53color that kind of matches the image itself.
03:56If for some reason the image can't load or somebody has got images turned off on
03:59the browser, it'll still look reasonable.
04:01And the url for the page background graphic, you will notice that it starts
04:06with these two dots.
04:07That means go up a directory.
04:08The reason for this is that in the external style sheet, the image location is
04:14relative to the style sheet itself.
04:16It's not relative to the document and so if we look at our site organization,
04:21here we have the document itself, this header.html, and there is a CSS directory
04:26which is where the CSS file is and then there is an images directory which is
04:32next to the CSS directory in the tree.
04:34So, from the CSS directory, you need to first go up a level and then go back
04:40into that images in order to find the banner.jpg.
04:43So, that syntax looks like this with the dot, dot and then the path from there.
04:49So, first it goes up a directory and then it goes into the images directory and
04:52then the page background.
04:54We'll set Margin and Padding to zero, and this is the syntax that says it's a
05:03shortcut for all the margins, top, right, bottom, left setting that to zero and
05:07likewise for the padding.
05:08What this does is it allows us to have everything butt up against the borders
05:12of the browser itself.
05:14If you look at the website, the top of the website is all the way up at the top
05:17and then the actual content is centered on the page.
05:21This allows us to have the border and the margin set to zero, so there is no
05:25space there at the top.
05:26Then we'll save this and we'll move on like that, save as I go along.
05:32We're going to do some default margins for all of the text block elements like p and h1 etcetera.
05:49And this is another CSS shortcut, when you just have two values in here.
05:53Remember normally you put in four values, which would be top, right, bottom and left,
05:58which goes clockwise around the circle.
06:00But if you just put in 2, then the first one is the top and the bottom and the
06:04second one is the right and the left.
06:06So, we have 1ex top and bottom, and 1em right and left and that gives us just a
06:10nice little default and you will see that looks like this.
06:16Again, we are not going to use these defaults but it's nice to have them just in case.
06:20So, it gives us just a nice little spacing at the top and spacing at the left
06:24and there is our page background, that lovely little flowered pattern. Go ahead
06:28and enter some more defaults.
06:48So, this is the default for all the tables and again, this is going to be
06:51a table-based layout.
06:53You'll notice the border-collapse, this is the one that we haven't seen
06:55before, border-collapse.
06:56It changes the table layout model.
06:58There are two layout models.
07:00There are border-collapse to collapse and border-collapse to separate.
07:03Separate is the default and interestingly that will work in all browsers
07:08except Internet Explorer.
07:10If we leave that to its default value or set it to separate, Internet
07:13Explorer will break up some of our tables, not all of them, the layout will
07:17look disjointed and so we just set it to collapse, which worked in all the
07:21browsers that I have tested.
07:22Again, like all of this, you want to test this in any browsers that matter to you.
07:25I'll go ahead and save and go on.
07:30I'm going to continue to format the tables.
07:33I'm going to set our defaults for the rows and columns.
07:42And again, because we are doing layout with tables, we want to have some
07:45reasonable defaults for all this. margin 0, padding 0.
07:48That allows us to have content that goes up against the edges of the table cells,
07:51like we need to do for things like these images, which if you remember,
07:56this is one image and this is a separate image here and it's in a separate table cell
08:00and then our content is down here, and we want all of this to butt up to
08:03each other without separation.
08:05And so that margin zero and padding zero in the table cells.
08:09That allows us to do that.
08:11So that's our defaults and in the next lesson, we are going to start putting
08:15in the header content.
Collapse this transcript
Placing a banner and a contact button
00:00Continuing with the development of our example website, in this lesson we are
00:05going to insert the header and the contact button.
00:08So looking at the browser here, basically what we are going to do is the top
00:13half of this table cell here with the Contact button in it.
00:15That's what's called a Mail To link.
00:18So when you click on this, it would open your mail client and allow you to
00:21send an email message.
00:23It's a simplest form of a contact button.
00:25So let's get started.
00:27We have here beginning.html and our beginning.css and this is in the 03-Contact
00:33folder of the Chapter 09 Exercise Files.
00:37The first thing we are going to do is we are going to Save As.
00:42We'll save as heading.html.
00:45This way we don't overwrite our Exercise Files and do the same thing with the CSS.
00:54Save that as main.css, because that's the name that gets used here in the XHTML.
01:02Now we'll go ahead and enter some content in here.
01:05We are going to create the outer table and we are going to create the table cell
01:08for the Contact button.
01:17So this table tag has an id attribute and that creates a CSS id selector.
01:26I'd like to close my containers when I start them.
01:39So this row has one cell in it.
01:41So I've opened it and closed it and you'll notice that for my selectors,
01:45I'm using what's called camelCase.
01:47And this is actually a very good choice for CSS, because CSS doesn't allow
01:51dashes and I happen to be one of those people that dislikes typing underscores.
01:55I do it when I have to and I have too often, because other people use them.
01:58So I like camelCase for CSS and it allows me to have several words as very
02:03nice descriptive selectors and so camelCase usually uses a lowercase to begin
02:09and it uses uppercase letters at the beginnings of second and subsequent words.
02:13So I have outerTable, I have contactButton and this is what's called camelCase.
02:17Go ahead and create a div.
02:20We'll talk about all this organization in a moment here and the anchor tag.
02:35Ending my anchor tag on the second line and that allows me to put it right up
02:40against the image and we talked about that in our chapter on images.
03:01You'll notice I inserted width and height attributes for the image and I have
03:06those numbers already, because all these assets were given to me.
03:09So I have those in my notes.
03:11It's a really good idea to always include the width and height, if you can.
03:15That allows the browser to layout the page before it downloads the assets
03:19from the server so that the page loads without blinking and moving things
03:23around as it goes along.
03:24It's just a nicety and I closed the image on the next line and closed the anchor
03:29right after, so there is no space between the image tag and the anchor either at
03:32the beginning or the end.
03:34Now as we create our CSS, you'll see that I'm able to select this div
03:39specifically without it having a name, and I'll show you how we do that in the CSS.
03:43Let's go ahead and enter some more CSS here.
03:54So again it's a section for the Contact button and I have got another section
03:58before that for the outerTable.
04:05So first the outerTable. It sets the selector for the outerTable and it has
04:11 a margin 0, auto.
04:16Again, we have two values.
04:18The first value is top and bottom and the second value is the right and left.
04:21Selecting auto for right and left that centers the table on the page and so
04:26this is what creates this effect here with it being right up against the top,
04:30but centered horizontally on the page and that's from having margins 0 and auto like that.
04:40770 pixels wide, which is the width of all those images that are used to create the look.
04:57And this creates the image at the top of the page, so let's save this and take a
05:02look at the page over here.
05:04This image up here is actually the background image for that header table cell
05:09and this fff is the background color for the whole rest of that outerTable.
05:14So you see that all of this white here is as a result of that.
05:18Now let's go ahead and enter the contactButton.
05:26There is our contact button selector, which we typed in the XHTML so that height
05:35is actually half the height of the image.
05:38That image with the head of the table there is 110 pixels high and so 55 is half
05:44of that, because the top half of it is what we are using for that contactButton.
05:48The bottom half we'll do in our next lesson for the menu there.
05:57This is how we select that div.
06:00Remember we put a div in the HTML here that's inside of the contactButton,
06:05the selector of having the contactButton id selector followed by the div tag selector.
06:11That means that this is any div inside of that id selector.
06:16So any divs inside of this, which is here and here, which is this and this, will
06:24be selected by that combination selector.
06:27It's a hierarchical selector where we have the contactButton and then div.
06:31So that's any div inside of the context of that contactButton selector.
06:3730 pixels is the height of that image.
06:44This is a margin that basically says no margin, top, right, bottom, and 650
06:50pixels to left so that will move it in.
06:52650 pixels and it will be against the top of the table cell, because we have our
06:57default set to vertical align top over here. padding=0 and then finally,
07:04the contactButton image itself.
07:10So again this is a hierarchical selector that selects any image inside of that
07:14contactButton context, which is just the one image.
07:22We'll set its margins to 0 and its border to none, so it won't get highlighted
07:26by the anchor tag around it.
07:28So that is our CSS, we'll go ahead and load it in the browser and see what it looks like.
07:32So we'll drag heading.html into the browser and you'll see that top half of the
07:39image is visible because that's the only table cell that we have defined and
07:44there is our contactButton.
07:46So by having our table cell just be 55 pixels high, we are only seeing the top
07:51half of the image there in the browser.
07:53If we were to just make this 110 pixels, we'd see the whole header image. See there it is.
07:58But we need to make it just half as high so we can make the next table cell for
08:02the other half for the menu.
08:05Save that, and there we are done.
08:07That is our Contact button.
08:10In the next lesson, we'll do the main menu.
Collapse this transcript
Laying out a main menu
00:00In this lesson we are going to create this main menu here at the top of the page.
00:06These are the menu links for navigating the site.
00:09You will notice that when I click on one, it changes and it becomes this
00:12other image that's grayed out, and the mouse changes, and it's no longer has
00:16the pointer that will indicate that it's a link, and so for each of these we have two images.
00:21We have the tall gray one and the short ocean colored one with the white
00:26lettering on it and so that's what we'll be creating in this lesson.
00:31So here's our beginning XHTML file and our beginning CSS and we are going to
00:36go ahead and as we have been in all these lessons, we are going to save this
00:40as with a different name, so that we don't overwrite files in the exercise files.
00:47Save this one as heading.html and this one here, save it as main.css,
00:57because that's how it's referenced in the XHTML file.
01:01And now we'll go ahead here in the XHTML and we'll create the main menu table row.
01:17And again, we'll have a div inside of that so that we can position it easily,
01:23and we'll go ahead and type in the menu images.
01:33The images that end in -current, that's the tall gray ones.
01:48Again, I'll end my image tag on the next line.
01:51Embed it up against the following one.
01:53The following one has an anchor tag around it because it's actually a link.
01:56This first one because it's the current page does not have a link.
02:00I'll end the anchor tag on the next line at the beginning of the image tag and
02:07I'm going to do some copy and paste here, so that we can do this more quickly.
02:14So what I'm doing here is I'm selecting the image, and
02:17this is the way I work in my projects.
02:19I'm a big fan of efficiency or one could say I'm big fan of lazy, and so I'll do
02:24copy and paste, rather than typing everything out every time, and so I'm
02:30pressing Ctrl+C on the keyboard because I'm on a PC.
02:33If you are on a Mac, you would use Command+C for copy.
02:37So I'll go ahead and Ctrl+V to paste, and so I have copied and pasted that image
02:44and I just have to change the name of the image here, which is now gear.png.
02:48It doesn't have the -current because it's not the current page.
02:52It has a link on it and the width will be different, it will be 73, and
02:59the height is 25 for the ones that aren't current.
03:03The height is 30 for the ones that are, and there we have that, and I'll close
03:08the anchor tag at the end of that and begin the next one and I'll change the
03:14Alt tag as well, to say gear.
03:15Now I'm going to copy and paste just all of this and so my text editor is trying
03:24to help me by selecting more than I want it to, so I had to do it again there,
03:27and so I'll just copy and paste, and paste, because there's three of those and
03:33so let's see here the next one is lifestyle and its width is 100,
03:45height is the same, and the alt is lifestyle, and link for that is also
03:52lifestyle, and then the following one is for videos.
04:03I am going to make sure you get all the occurrences.
04:06That's the down side of the copy and paste.
04:10It's easier for getting parts of it and end up with something that's say gear
04:14on the videos page, and there we have it.
04:16So that is our link and if we look at this in the browser
04:25and there is heading.html and we'll go over here and you will see that it looks like that
04:34and of course, that will get better as we style it.
04:37So let's go ahead and style it now.
04:42Move down here to the bottom of our Style Sheet.
04:45I'm going to enter a section called main menu
04:56and we used an id tag called main menu so td#mainMenu.
05:04And again, the height is 55 pixels and this one, we are going to change the
05:11vertical align to bottom.
05:13This is the only place where we use that in the entire document and that's why
05:20we have our default is for top.
05:23For this one we are going to have it be bottom and this will select our div.
05:30Height is 30 pixels, which is the tallest of our images.
05:40Margin left of 300 pixels and padding of zero
05:46and then finally the images themselves.
05:52Now this will select all of the images in the main menu context, which there are four,
05:57and this will give them a zero top and bottom margin, while giving them
06:05five pixels to the right and the left, and that's what spaces them apart and
06:10you will see there's ten pixels in between them because there's five pixels of
06:14each side, and border none.
06:18That will get rid of this border around the ones that are anchors.
06:23I'll go ahead and save that and then load it up in the browser, and there we have it.
06:31That's our menu.
06:32So how this works, it's really very simple.
06:36We have images with links around them, which we know all about from the lessons
06:40on images and links, and we have styled it using the CSS to give it the spacing
06:46that we wanted to have, take off the border, and to line it up with the table cell,
06:51and so that gives us this lovely menu.
Collapse this transcript
Creating a layout template: main body area
00:00Continuing with the development of our website, in this lesson we are going to
00:03start building the content portion of the webpage.
00:07We are going to start with this middle image. I call it the ID image, because it
00:11changes with each of the pages, so it sort of helps to ID the page, and then
00:15we are going to start building the styles for the page itself.
00:19We are going to start with the left- hand side, the main content in this lesson,
00:23and in the following lesson we'll do the right-hand side, the sidebar content, and
00:27then we'll have a template that we can use to begin building the pages for the
00:30rest of the website.
00:32So let's get started.
00:33So I have loaded up in my text editor here. I have the beginning.html and I
00:38have the beginning.css from the 05- layout-left folder in the Exercise Files,
00:45and so we'll start by saving as, because that's what we always do.
00:49That gives us a working space where we're not writing over the exercise files themselves.
00:56This one we'll call template.html, because that's what we are going to end up
01:00at the end of these lessons here, with the template for working with the rest
01:04of the website and we'll Save As the main.css for CSS file and so now we have
01:14our working space setup.
01:15So I'm going to go ahead and insert another table row and so this is starting
01:24to get more confusing here, all these table row beginning and ends next to
01:28each other like that and so what I'm going to do is I'm going to put in a
01:31comment, so we'll know that this is the end of this here.
01:36So I'm going to just say mainMenu. I like to do this.
01:40It helps to keep track of where you are in the page, so I can see easily that
01:44that's the end of that, even though they line up and my editor is very nice.
01:48It gives me a little line here to help line things up, but it's nice to have that.
01:52And then we are going to have a table inside of this table cell
02:05and that will end here, and again, this is going to be a big enough table.
02:12It's going to be a lot of stuff in between here, so I'm just going to go ahead
02:14and put in the comment now.
02:18And then I'll always know where I am, and so this table will have one row and
02:24it will have two columns and so there will be a column for the contentLeft.
02:35And it will end here.
02:36And again, I'll just put in a comment, as there will be stuff in between there,
02:44and it will have another row for the content right.
02:47I'll just go ahead and copy this, Ctrl+C or Command+C if you're on a Mac and
02:58instead of contentLeft that will be contentRight.
02:59I'll change the comment for that one
03:05and there we have it.
03:07We now have space for our right and left content tables and I'm going to save
03:14and we'll go ahead and put in a div for our mainContent
03:31and we'll do the sidebar in the next lesson.
03:34And then we'll just go ahead and put in a little bit of content here, just so we
03:38can look at it on the screen.
03:50All right, so we'll save this.
03:52I'll just look it over, make sure it all looks reasonable. There is our begin div,
03:56and end div, or begin td and end td, and our table.
04:02We can see here in table row, table row ends, table ends, this all looks like it
04:07should work, and if we go ahead and load this up in the browser,
04:16drag the template.html into the browser and there we have it.
04:21We have a space with our main content. This is the default font, remember that,
04:26and so it's not lined up exactly how we would like it to be lined up, but we are
04:30going to take care of that in our CSS right now.
04:32So just go ahead and do the CSS part of this.
04:38Scroll down to the bottom.
04:43Enter comment here.
04:56We'll start with viewing table cell, contentLeft,
05:04and we want to give that the white background color,
05:12and a width of 505 pixels.
05:17Now I have already measured all of this out with the content that was given
05:21to me by the client.
05:28The mainContent, this is our div for the main content, and it has padding 0 and
05:3715 pixels. I'll explain that in a moment. Margin of zero.
05:44Now it's important at this point to understand the difference between margin and padding.
05:49So what I'm going to do, I'm going to save this and I'm going to go ahead and
05:52I'm going to put a border on this, so that you can see what it is
06:01And this is just temporary, this is just for illustration purposes, so you can see what
06:05the margin and the padding is all about.
06:07Let's look at this in the browser.
06:08I reload here. You see this box. This is the border that we just put in for the div,
06:14and you see it goes all the way up to the edge of the image above it into
06:18the edge on the left and edge on the bottom, and of course, the edge on the right,
06:21but this is the width of 505 pixels there.
06:25Now if I put a margin on that, let's say we put a margin of 10 pixels.
06:31So this will put 10 pixels all the way around, top, right, bottom, and left,
06:35and so we'll save that and you will see what a margin looks like, because we
06:38have this border here.
06:40You can see that the margin goes on the outside and it actually increases
06:45the size of the div.
06:47It pushes everything out.
06:48So it adds those 10 pixels all the way around and the div itself is inside of
06:54the margin, so the margin goes outside of the content box.
06:58Padding on the other hand goes on the inside of the content box and so if we
07:03make that margin zero, and let's just make this padding something large so that
07:09we can see it, say 50 pixels, and so that I'll put 50 pixels on the top,
07:15on the right, on the bottom, and on the left.
07:17I'm just making it really big, so you can see what it does.
07:22It actually increases the size of the content box and it adds that padding on
07:29the inside of the content box, so that's the difference between padding and margin.
07:35Padding and margin are: margins on the outside, padding is on the inside, and
07:39they both actually increase the size of the box, so that the content on the
07:44inside is still the dimensions that you asked for.
07:50So we can go ahead and make this what we wanted it to be, which is zero and 15 pixels,
07:56and so that's zero on the top and the bottom and 15 pixels on the
07:59left and the right.
08:01Save that and we'll take off this border, because that was just for
08:04illustration purposes and we'll go ahead and enter the next part of it.
08:09So the reason I did it the way that I did it and that will become clear in a moment.
08:36Save that.
08:37So this is the p tags, so all the p tags within the mainContent context will
08:42have this formatting and this is laid on top of, remember that this cascades,
08:46this is laid on top of our defaults up here, which have these margins.
08:50And so, the margin for the left is getting overridden to be zero and what that
08:56does is it puts it up against this 15 pixel padding on the div, and I make the
09:01margin left for all of our different elements.
09:04The reason I do that is because the relative margin sizes for the different
09:08sizes of text, like the heading size and the paragraph size, they tend to be a
09:12little bit different.
09:13So I make them all zero and I just use the padding in the div instead to
09:18create that margin.
09:19It's just a little trick.
09:21This is the way I like to do it.
09:22It makes my life easier.
09:23And so I set a padding to be a certain size on the right and left in the
09:28mainContent and I set that margin-left to be zero in the paragraphs and also
09:34in the headings, and that way everything lines up nicely, just the way that I want it.
09:38So I'm going to go ahead and enter some default styles for the headings.
09:43Let me use the copy and paste, because I don't like to type all of these.
09:52I'll go ahead and change this one to a 2, this one to a 3, and there we have that.
10:12Now I made the font-family for the paragraph for the body text, this nice serif
10:17Georgia font, and I say serif as a fallback, and this is the Trebuchet MS for
10:24the sans-serif for the headings.
10:27Again, a lot of these style choices were made for me by the client.
10:34And then the mainContent h1.
10:40So what I'm able to do is I'm able to set defaults for all of them like that and
10:44then I can make adjustments from that starting point in a separate style just
10:48from mainContent h1 and this is again is taking advantage of the cascading
10:52property in the CSS cascading style sheets.
11:14Again, I'm setting all the margins to zero except that bottom margin and that
11:18bottom margin is just going to give us a little space between the heading and
11:22the body paragraph, but that left margin is set to zero just like it is here for
11:26the paragraphs and so that will take advantage of this 15 pixel padding on the
11:31left-hand side and the div.
11:33So there we have it.
11:35This is our style for the main content on the left-hand column and we'll go
11:41ahead and reload here and we see that that's exactly how we want it to look.
11:45The only piece missing now is that middle ID element.
11:49Let's go ahead and add that in the HTML.
11:55And so that gets another row right in here.
12:04and this is our page ID image
12:10and it gets this image source=images/home_ banner.jpg, and there will be a different
12:22banner for each of the pages.
12:24So there will be a gear banner for the gear page, etcetera, and the width is our
12:29standard 770 pixels, height is 90 pixels, alt says Welcome to Surfing Paradise.
12:41We'll save that and go and load up the page.
12:49So we see I missed the equal sign here between width and my syntax
12:52highlighting editor makes it in red, which makes it nice and obvious there.
12:56So just put in that equal sign and I'll save there, go ahead and load it up in
13:01the browser, and there we have it.
13:05So there is our ID image in the middle, here is our main content.
13:09You notice that the ID image also gives us a little bit of a nice little extra
13:13white space here. It has this sort of organic look to it.
13:15That is the part of the ID image right there.
13:18If I right-click on this and say View Image, you can see that that white part is
13:22part of the image there.
13:23So there we have it.
13:24This is our main content on the left- hand side and we have space over here for
13:28the sidebar content on the right.
Collapse this transcript
Creating a layout template: sidebar area
00:00 Continuing with the building of our example website, we are going to fill in the
00:05 default content and styles for the right- hand side of the content portion of the
00:09 page in this lesson.
00:10 So we have the beginning HTML and CSS files, from the Layout-right folder in
00:16 the Exercise Files.
00:18 So we'll go ahead and do the Save As and save these as template.html and
00:26 beginning.css we'll save that as main.css.
00:31
00:34 So you are all set up there and we are going to go ahead and set up the
00:39 contentRight portion of the page.
00:43 This is actually pretty straightforward here and I put in a div id="sideBar".
00:50
00:53 Like that and go ahead and put in a comment here.
00:59
01:02 And then inside of the div we are going to put, just like we did in the other
01:08 program, I'm going to put in h3 because we use h3's in the sidebar,
01:12 Sidebar Here, and sidebar content will go here.
01:21 Go ahead and save that.
01:25 As we load this up in the browser, drag our template file into the browser there,
01:30 we see our sidebar content on the right-hand side of the page and that's
01:36 because it's in this table cell here.
01:39 So we have table row and we have two columns.
01:42 We have this one and we have that one.
01:43 So let's go ahead and format it now in the CSS.
01:51 So this will go after the mainContent section.
01:53 Go ahead and put in a comment here.
01:55 This is the sidebar.
01:56
02:05 We'll start with the contentRight td and again this has a background-color.
02:14
02:17 fff, which is white.
02:20 This one here has a width of 265 pixels.
02:23 Then we'll enter the sideBar div.
02:28
02:31 This has same padding trick, this one set to 10 pixels.
02:37 And then also has a border on the left-hand side.
02:44
02:47 Go ahead and save this.
02:48 I'll show you in the browser what this border is all about.
02:52 You look at our site here, you see this line there and you will notice that it
02:57 doesn't go to the bottom of the page.
02:58 It just goes to the bottom of the sidebar and so that's accomplished by having
03:02 it via border left on the sidebar div.
03:05 If we reload here, we see there's our border.
03:10
03:11 So continue entering our styles here.
03:14 There's our style for the paragraphs inside the contentRight context.
03:23
03:32 So font. font-size is a little bit smaller than it is in the mainContent.
03:39
03:46 A little bit of spacing between the lines.
03:48
03:52 The color is going to be a little bit off white.
03:57
04:01 So I have a little bit of margin in between the paragraphs or after the
04:04 paragraphs, but the paragraphs themselves will be flush up against this 10 pixel padding.
04:09
04:17 Remember, we use h3 headings for the sidebar.
04:20 Go ahead and copy the font-family from up here.
04:26
04:36 Headings are going to be this teal color that was selected by the designers.
04:41
04:49 And we'll go ahead and enter those margins there and there we have it.
04:53 We'll save and go take a look at it in the browser and there we go.
05:03 That's our sidebar and that's what our sidebar looks like.
05:05 It's little bit smaller, it's got the slightly gray color text and this teal
05:10 color heading and there we have it.
05:13 That's our formatting and our layout for the sidebar.
05:17
Collapse this transcript
Creating a layout template: footer content
00:00Continuing with building the template for our website, we're going to now enter
00:04this stuff at the bottom of the screen here, the legal stuff, the copyright
00:09notice, Privacy Policy, and Terms and Conditions links.
00:12And then we'll be done with our template, and we'll have a template that we can
00:15use to start building our site.
00:17In the Editor, we have the beginning. html and css from the 07-layout-footer
00:25folder, and we're going to go ahead and do our traditional Save As ritual.
00:31We are going to be calling it template. html and we'll actually have our work in
00:35template at the end of this lesson.
00:37The css will be main.css. There we go.
00:46Now, down at the bottom of the template, we're going to put in the text for the
00:52footer and it's like this.
00:55It actually goes outside of that table.
00:58The paragraph itself has an id="footer".
01:06Inside the paragraph we're going to have our copyright notice.
01:09That's an XHTML entity for the copyright symbol.
01:13Now I'm putting in a couple of non-breaking spaces here.
01:22The purpose of that is to give a little bit of space between the Groundswell Surf
01:26and the links for the Privacy and Terms and Conditions links.
01:31You'll notice in our page here, there's a little bit of space there and then we
01:35have this bar separating these two.
01:38But this space, normally the browser will fold all the spaces into one space,
01:42and I want to actually have some spaces there.
01:44So those non-breaking spaces serve to just take up enough white space there,
01:49on the actual screen.
01:51Then I'm going to put in my links on separate lines because the browser will
01:54actually ignore that new line and put it on the same line there.
02:11Just type a vertical bar character there at the end, and do the same thing for
02:16the Terms and Conditions link.
02:26There we have it.
02:28So that is the XHTML portion of the footer.
02:33If we look at that in the browser--
02:36Let's go ahead and load this up.
02:41This will be the template.html.
02:47Drag that in, and we see we have the text and the links, and now we just need to format them.
02:53You see that lovely space there?
02:55That's the non-breaking space characters.
02:57Let's go ahead and enter the style sheets for this.
03:04Down at the bottom of the file, go ahead and create a comment.
03:17p#footer, and we have the Trebuchet font-family, which I'm just going to copy
03:27and paste from up here.
03:28font-size: .75em.
03:35Make it smaller, color: white.
03:39So the text will be white here. text-align: center.
03:46And then the links are going to be this other color that's already been selected again.
03:53So that selects all the anchor tags inside of the footer# context.
04:07text-decoration: none.
04:12That makes it so that the links don't have an underline on them.
04:15So we have some of these extra spaces.
04:20And go ahead and save this.
04:22Load this up in the browser. There we have it.
04:28It's just how we wanted, white text here, the little teal text there.
04:33It's exactly how we wanted.
04:35So now we have a template, which we can use for building the rest of the
04:39pages for our site.
04:41So we use this as a starting point, as we build the pages for the rest of this site.
Collapse this transcript
Building a main home page: main body content
00:00 Now that we have our template built, we can start putting content in the website.
00:04 So, here in the home-pt1 folder in the Exercise Files, you will see there is the
00:11 template.html and that's the template that we built in the last lesson and
00:16 you will also see a text folder here that has home.txt.
00:19 That's the text that goes in the page and then we have the CSS folder, of
00:25 course, which has our beginning place for the CSS and this is all loaded-up in
00:30 my text editor and so here is the template.html.
00:33 Here is our beginning.css and here is the text file with all the text that will
00:37 go in the home page.
00:39 So, let's get started.
00:41 First thing we do, of course, is to do the Save As.
00:43 In this case, we are going to save it as home.html.
00:47 So, we'll be building the left-hand side in this lesson and the right-hand side in the next lesson.
00:51 We are still going to call this home.html, save that and then the beginning and
00:58 the CSS will be saved as main.css and the text file we are not going to be
01:03 writing over, so we can leave that alone at this point.
01:06 All right, so now, let's go down here to the place where the main content goes
01:13 and I'll just select these two lines and I'm going to copy everything from this point,
01:18 all the way down to here.
01:23 This is the end of the content for the first half of the page, the left-hand side
01:28 and then down here, where it says sidebar, that's the content for the sidebar.
01:31 We'll be dealing with that in our next lesson.
01:34 And so I'm going to go ahead and press Ctrl+C to copy on the PC, we'd use
01:39 Command+C on a Mac, come over here to home, where I have selected this and
01:43 I'm going to press Ctrl+V to paste.
01:46 And so, there we are done. Ha! Not really.
01:50 Now, we need to put in our heading levels.
01:53 I'm going to wrap the HTML around this, so this will be a <h1> and close the
02:03 </h1> at the end and then here we are going to have the beginning of our
02:08 paragraph and here goes the end of the paragraph and then the beginning of a
02:13 paragraph here and I'm going to be sneaky and do copy and paste and have an end
02:19 a paragraph and a begin a paragraph in my copy buffer, so I press Ctrl+C to copy
02:24 and then I paste here and I have the ended that paragraph.
02:27 Of course, this doesn't begin a paragraph here, so I'll just take that and
02:31 I'll move it down here, a little one more, and then I can paste an end a paragraph here
02:41 and now we have another heading.
02:45 Now, this heading level here is going to be <h2> and the </h2> there and
02:54 an <h4> for this, because we are using <h3> on the right-hand side, so this will be an
02:58 </h4> and then we have more paragraphs.
03:04
03:06 Add an ending paragraph here and this is another <h4>, </h4>, add a
03:14 paragraph here and an ending paragraph here.
03:20 I didn't get to use my paste buffer for that very much, did I?
03:23 And this is a link
03:25
03:33 and the link will have this text in it here.
03:35 So, I'll cut and paste and then just take out this extraneous text at the end.
03:43
03:44 Scrolling down, I have another <h4>,
03:47
03:51 and another paragraph and there is a couple
03:55 of links in this one, the one here.
04:00
04:08 I'll do the same Cut and Paste and you get rid of this at end and do the same thing here.
04:17
04:24 I missed the equal sign.
04:27 That's the beauty of the syntax highlighting text editor.
04:30
04:35 And there we have it.
04:36 So that's our content and now I like to indent stuff.
04:40 I'm just like that.
04:41 It makes everything pretty. But we are not quite done, are we?
04:48
04:49 Go ahead and indent anyway at this point and every editor has a different way to do this.
04:55 Once you have it highlighted,
04:56 in this particular editor, which is Notepad++, I'll hit the Tab key.
05:00 I know that in BBEdit it's something like Command+Right bracket or something like that.
05:05 I actually use BBEdit a lot and my fingers remember how to do it, but I don't
05:10 always remember what it is I'm doing.
05:11 It's just that my fingers remember it and so anyway.
05:15 This is going to be an unordered list and so that ends at the bottom.
05:23 So, I'm cutting and pasting and put that there and then each of these has a
05:29 <li> at the beginning and an end </li> at the end and so I'll use copy and paste for this.
05:34 Copy, paste, paste, paste, paste, paste.
05:40 And copy, and paste, paste, paste, paste, paste.
05:50 There we go.
05:52 So, that is our content, rather than going through all that.
05:55 I wanted to go through it this time just to show you what my workflow looks like
05:59 as I do this sort of thing.
06:00 In the subsequent lessons, for the rest of them, I have them all HTML-ified in the text file.
06:07 So, that will make it easier for you to cut and paste them.
06:11 So, now that we have this content in here, let's just go ahead and take a look
06:14 at it in our browser.
06:15 We are going to do a little bit more CSS on it, but it's not going to look too bad,
06:19 as it is right now.
06:20 There are a few styles that we haven't yet installed.
06:24 I'm going to take the home file and drag it into the browser and there we have it.
06:29 That's not bad.
06:31 That's pretty close.
06:32 There are a few things we are going to do.
06:34 We need to enter these <h2> and <h4> levels and these links don't quite look right,
06:39 and we are going to do a little bit of formatting also on this unordered list.
06:44 So, let's go into our CSS file and we'll scroll down here to the bottom and
06:51 actually it's not at the bottom. We are going into the main content part.
06:55 All right there and we are going to enter the <h2> level.
07:01 So, I'm just going to copy this one because it's just a little change from there.
07:05 You see, I actually do this a lot in real life, create two copies of that.
07:11 One of them will be <h2> and one of them will be <h4> and then we can just change them.
07:18 So h2, font-size is 1.2em and the color is 3C3809
07:31 and it does not have this font-weight:bold in it
07:35 and the margin is the same, 0.4em.
07:39 Now the h4, it's 1.1em in size and it is bold and the color is this gray
07:49 and the margin, this is the bottom margin now, it is actually -0.2em.
07:57 So let's go ahead and take a look at all of that and see what that looks like in the browser.
08:00
08:05 Oh, it's lovely.
08:07
08:09 And that's what it looks like over here as well.
08:12 Excellent!
08:13 Now, these links aren't right, you see the links?
08:17 Look at what the links do in the finished version.
08:21 They have this orange color and they change to gray and they get this dashed
08:24 underline, which is actually not an underline at all.
08:27 It's a dashed bottom border.
08:29 So, I'm going to go ahead and actually in our CSS, we are going to make this
08:34 the default anchor style and it goes in the outer table up here.
08:40
08:44 And we say outerTable a:link and outerTable a:visited.
08:54
08:57 That's for the visited and the unvisited links and I'll get text-decoration:none,
09:05 so that takes out the underline and I'll get this color.
09:13 And then we do outerTable a:hover and that's the style for the mouseover.
09:24 When your mouse is hovering over the link, this is the style that you get there
09:29 and it will have this color
09:30 of 566440 and border-bottom: 1px dashed #566440.
09:46 So, when we save this, we'll see that our links look like we except them to see.
09:52 There we are, see that?
09:56 And that's how we want those to look and so that will also happen in the sidebar
10:01 because we put it in the outerTable level.
10:04 Finally, what we need to do now is this is unordered list.
10:08 And that will go down here in the main content, right here. #mainContent ul.
10:21
10:24 And that will be Georgia and font- size 0.9em, just like in the paragraphs.
10:37 margin-bottom.
10:39 So it would be the spacing after the whole list, 1.4em, and then finally the li,
10:48
10:50 which is the line items themselves, those will have a margin-bottom of 0.6em.
10:59 So, that's the spacing between those items.
11:02 We will go ahead and save that and look out it the browser and there now,
11:08 our list looks like we expect our list to look.
11:11 So, that's the left content there, that page.
11:13 That's pretty easy once we have the template all done. You can see that the rest
11:17 of these pages are going to go fast.
11:19 In our next lesson, we'll do the sidebar content and we'll be all done with
11:23 this main page.
11:24
Collapse this transcript
Building a main home page: sidebar content
00:00As we continue building the example website,
00:04in our last lesson, we filled in the left-hand side of the main homepage and
00:09in this lesson, we'll continue with the Sidebar Content.
00:12So, let's get started.
00:14Here in our editor we have our beginning.html, which has the content for the
00:19left-hand side that we filled in last time.
00:22And our beginning.css, which likewise has all of that style from the last time.
00:29And our home.txt which has the content here for the sidebar, which we'll be
00:34copying, and first let's go ahead and do our traditional Save As and saving as
00:39home.html, because this will be the homepage.
00:44And save the css as main.css
00:51and our home.txt, we don't have to Save As because
00:56we're only going to be reading from it not writing to it.
00:59Let's go ahead and copy this content, so I'm pressing Ctrl+C because I'm using a PC here.
01:04If I were using a Mac, I would use Command+C and over here in our home.html,
01:10we're going to scroll down to the Sidebar Content and go ahead and press Ctrl+V
01:15to paste and there we have it.
01:17So, the first thing I want to do is fill in the XHTML here, and like I said
01:23before for the home page, we're doing all of these manually in the future pages
01:26because we'll have had this experience.
01:28We're going go ahead and just cut and paste the already HTML-ified
01:32or Xhtml-ified text.
01:34So, I'm going to start with this image here and let's say img src= and there I
01:39have that and then I'm going to go to fill in the width and height.
01:47I'll go ahead here and drag this over because this Editor is kind of cool.
01:52It allows me to do it this way. Here we go.
01:55So that's our image tag and then this gets an h3, because we use h3 for the
02:03right-hand side for the sidebar and we get paragraphs here and then paragraph
02:12here and then we have another image.
02:27I can just cut/paste.
02:31That's the other way to do this.
02:37Now, this is an h3.
02:51And add another image.
03:05Drag that over. That's just fun to do it that way.
03:09And there we go.
03:11Another h3, another paragraph and an end paragraph.
03:23And then we have some links here. This is supposed to be a capital C there.
03:29I make that a href = and end a, equal to that part and take this part here and
03:42stick it in there and the same thing here.
04:00And finally, this one here.
04:15Now, one other detail. These images are in the images directory, so we'll just
04:20say images here and I'll copy that and paste it here
04:27and paste it here, there we go.
04:32I think our content is ready and I'll go ahead and take all of this and indent it.
04:40In this editor here, which is Notepad++, I select a block of text and use the Tab key.
04:46Different editors have different ways of indenting.
04:49I find it very valuable to keep my code indented.
04:53It helps me to find my way around and to know what is related to what.
04:58So we'll go ahead and save this.
05:01Now there is some formatting we're still going to need to do in css.
05:04But let's just take a peek and see what it looks like in the browser real quick.
05:08And we'll need to drag in this file, which is the home file in our home-part2.
05:14Drag this into the browser and there we have it, there is our right content. So that's great!
05:20It looks good.
05:22It's still not entirely done.
05:24We need to format these images over.
05:27If we look at our example here we see that it's very close.
05:31The images are indented a little bit and the one's that our photographs have
05:35this nice little border on them.
05:37So we'll go ahead and do that in the css right now and that's over here in
05:41our css and we're going to add a couple of styles down here in the sidebar
05:47section right over here.
05:50All right, so the first thing we want to do is we want to indent those images a
05:54little bit and so we can do this here.
05:58So this would be the selector for the images in the sidebar because they are
06:03under the contentRight, content margin 0 25 pixels.
06:10So, this makes the top margin and the bottom margin 0 and the left and right
06:15margins 25 pixels, and I'll just go over to the browser and take a look at that.
06:21Save here and reload and there we have it.
06:24Our images are now indented.
06:27Now, all we need to do is to put a border on these photographic images.
06:31We go back into the XHTML and we use a class selector here.
06:42For the ones that are photographs, so this Surf1 image of photograph, this is a product image.
06:48So this is a photograph, so put in a class selector here.
06:53Now we go and put that class in the style sheet.
07:04So we're using a combination of selectors here now.
07:08This is something we haven't done before.
07:10So, we have the ID Selector for the contentRight ID and so all of the images
07:17that are within that context that also have this class selector.
07:21So, img.photo is a class selector.
07:24Those who'll get this additional style and first they will apply this image
07:29style and then they will apply the class selector because that's where they
07:33are in the hierarchy.
07:35It's not because one is after the other in the css file.
07:37It's because hierarchically, img gets applied before the class img.photo.
07:51We're applying a padding of 5 pixels.
07:53Remember padding goes inside of the content box and it expands the content box.
07:59And the border is a 1 pixel border, which also expands the content box by 1 pixel.
08:05It will happen on the outside of the padding because the padding is inside of
08:08the content box, like margin is outside.
08:11So, we'll go ahead and save this and we would expect this to create 5 pixel
08:16padding with a dark border around.
08:19It's not quite black here.
08:20It's a gray border.
08:22Go ahead and reload in the browser and there we have it.
08:25So these boxes got a little bigger, you saw that and now there is this 5 pixel border around it.
08:30That's the padding because it's not margin.
08:32Margin would be on the outside of the border.
08:34It's on the inside, so that's the padding and that only happened on the ones that
08:37we gave that class selector to the photographs, so there we have it.
08:42We are done with the homepage.
08:44We have now created the main content and the sidebar content for the home page,
08:48and so we'll go ahead and move on to the next page.
Collapse this transcript
Creating a page with a menu, graphics, and formatted links
00:00Moving right along in building the website, we're doing the gear page now
00:05which is the second page in our website and this is what it looks like.
00:11So we have a different ID image here.
00:14We have this little menu for the different subcategories of gear for sale.
00:20We have this paragraph of text and then we have This month's special here, and
00:26the content on the right.
00:29So, let's get started.
00:32Here in our text editor, we have the empty template.
00:35We have the beginning.css, which is where we left off in our last lesson with
00:39the CSS, and we have the text that we're going to copy and paste.
00:43This is already all XHTML-ified for us.
00:49 So here we go.
00:53First thing we're going to do is we're going to Save As, which is what we always do,
00:58and in this case, it's going to be gear.html.
01:03That's the name of the page and then the CSS would be main.css and the gear text
01:12we're going to leave alone because we're only reading from that.
01:14We're not writing to it.
01:15So the first thing we do is we change the page title here and it will
01:20be Groundswell Gear.
01:22Then we're going to change this menu section here, here only save this, and
01:31we'll show you in the browser what we're doing.
01:34Here the Gear menu item is the current image, so it's taller, and it's gray and
01:41it's not a link, whereas in the previous page, it was the Home menu item.
01:46So here it's the Gear menu item and so we'll need to change that and this is the
01:51easy way to do that.
01:52I'm just going to grab this here and I'm going to cut with Ctrl+X, that would
01:59be Command+X on a Mac, and just move it down one, right to here, so it's
02:04between the end of the previous link and the beginning of the next link and
02:08press Ctrl+V to paste.
02:11Then I'll change this first one to home, and home here, and home here, and then
02:21swap the widths, this will be 80, and this one will be-- was it 73?
02:26Yes, 80 there and 73 here and then this home-current becomes gear-current, and
02:39this home becomes gear.
02:41So that's how easy that is.
02:43I just swap these pieces around and renamed them.
02:49So I'll save.
02:50We can look at our progress in the browser, gear.html, and drop it in there.
02:56There we have the Gear menu.
03:00That looks like it works just fine.
03:02So if I click on Home, we get the page we did last, but when I click on gear,
03:06we get where we are here so far.
03:08Now, I want to change this middle image to be the gear ID image.
03:16The Alt text, we'll say check out our gear.
03:26Then save that.
03:27Now we have our gear banner, hit reload in the browser and there is our gear banner.
03:34Now it's time to do the content.
03:38First, we'll cut and paste the content from in here and so this is the main part.
03:44Just right there, press Ctrl+C to copy, and Ctrl+V to paste.
03:50That's all of that.
03:52Let's go ahead and indent it with the rest our content.
03:58Go ahead and save and take a look at this.
04:01I know it's going to need some CSS work, but that's not bad.
04:06So, what are some of the things we need to do here?
04:08Well, first of all, we need to format this so that it looks more like that,
04:11instead of these default links.
04:15So let's start there.
04:16All right, so we have a class here for the leftMenu and that will be used for
04:24our formatting in the CSS.
04:27So we'll go into the CSS, we'll come down here to the bottom of the
04:31mainContent, and we'll go ahead and do a class selector. mainContent is the ID,
04:38and then it is p.leftMenu.
04:42All right, so first of all, we want this Trebuchet font so we'll go ahead and
04:51copy that from some place else.
04:54And it's got a margin bottom 1.5ex, and that will give it that space underneath it.
05:07So I'll go ahead and I'll save and we can look in the browser here.
05:14So that's that nice space underneath that helps it to look like a menu.
05:18Now we need to change these links so they look more like this.
05:22See, they don't have the dashes underneath them and they start out with the
05:26gray and the highlight as you hover the mouse over them.
05:30So I'm going to change that.
05:33So that works like this here.
05:35Now, we have a three- stage selector to work with.
05:37mainContent, that's the ID selector, p.leftMenu, that's the class selector, and
05:44then within that we have the a, for the anchor.
05:48So if we look in the XHTML here so that we have mainContent ID selector and then within
05:55that the leftMenu class selector, and then within that the <a> tags.
06:00So all these <a> tags will be selected by this selector here,
06:05this three-stage selector.
06:07So what we want do is change the default color to this color here, and then in
06:14the hover, we want to take off that border.
06:17So I'm just going to copy this so I have that selector and then edit the hover.
06:23Then it will have a different color now.
06:28It will be the #b36b00.
06:30Again, these colors were all selected for me by the designer.
06:34Then border:
06:36none and so there we have it.
06:38So now when the mouse is hovered over, save, the border won't be there.
06:45It'll just change colors.
06:47So let's look at it in the browser here and reload.
06:51So now we start with that dingy color, and we get the highlight as we
06:56move the mouse over.
06:58All right, so that's exactly what it looks like over here. Excellent!
07:04Now, we want to format this part here, because that part is not looking how--
07:09so it needs to have all this nice space around and it needs this formatting here,
07:13the header, and the body, and then the dollar amount, in this paragraph down there.
07:19So there's quite a bit of formatting to do.
07:21So let's get to it now.
07:27For this part, we want to just do a separate section.
07:30We'll go ahead and put in a comment here, which is the gear description section.
07:42The right number of equal signs there.
07:47There's a table there I'm going to use to select by.
07:52And here it is and it has a td, which is the table cell with an ID gearLeftImage.
07:56So that's just for this image here, and that image is going to float and also
08:03has this class, leftFloatImage.
08:06In this case, we're really just going to use the td gearLeftImage here and do
08:11the formatting from there.
08:12All right, so td#gearLeftImage and we are just going to give it padding of 25
08:24pixels all around and I'll go ahead and save.
08:30Then going back over here in the XHTML, we see that the next part is this other
08:34table cell that's called gear description.
08:36So I'll go ahead and enter a selector for that and that's going to get a width,
08:47290 pixels, save.
08:53Let's just take a look at what this looks like in the browser so far.
08:56Well, it's starting to get there.
09:00We see that the image looks nicely positioned there and the paragraph
09:05looks nicely set up.
09:07Now we just need to enter the formatting for this.
09:09So we have an h3 for the heading and that's going to get some
09:18interesting formatting.
09:26It's going to be the Georgia font, font-size will be 1.2em, color is the c47500 color.
09:47It's got a bottom border there and it's got padding at the bottom, just 0.2em.
10:02So it's going to be a little close.
10:05Then the margin-left, so that its flush is zero.
10:10So let's go take a look at that heading now.
10:12That heading should now be really pretty. There it is.
10:18So you see in the reference here, it's just like that, and in there, it's just like that.
10:23Now let's format the rest of these pieces.
10:26Right, so we have this paragraph here, which is going to be in the Trebuchet font,
10:30you'll notice in the browser.
10:35That's the Trebuchet font.
10:37The rest of this is all the Trebuchet font.
10:39So we can create a selector just for all the p's in this section
10:53and copy and paste that Trebuchet font from up here, and there it is.
11:03The font-size is 0.8em.
11:11Save that and get in the browser, we have the Trebuchet font for all the paragraphs.
11:18Now, the price paragraph.
11:27That has a price selector on it.
11:30Go ahead and look in the HTML, you'll see that there's a class=price, so
11:36that's a class selector.
11:41We do here is we want to right align it and give it some font size.
11:52Make it a little bit larger.
11:54So go ahead and save there and look in the browser.
11:59There we have the price, all large and to the right.
12:03So that makes this whole thing look just like this.
12:12See that link in here?
12:13It's the style from the rest of the document, and that's just fine.
12:16So that's the left side.
12:17Now the right side should be pretty easy.
12:20Go ahead and get the text for the right side.
12:25I think all this formatting is already ready.
12:30I'm just going to copy and come in here.
12:34Select these lines and paste.
12:35I'll go ahead and select those lines, and indent, and save.
12:47You'll not see anything unique in here so that just work just fine
12:51and there we have it.
12:52We have product images and they're already all nicely indented everything
12:57because of the styles we've applied before.
12:59So you can see how this kind of stuff just becomes real easy once you've done it once.
13:02This is the power of the style sheets, with all those styles setup for that column.
13:07So these elements that are in that column, they just get styled right away, and
13:11it all just looks just right.
13:13There is our Gear page and it looks exactly like the reference, and the link works,
13:20get Home and back to Gear, and there we have it.
13:23On to the next page!
Collapse this transcript
Creating a page containing an ordered list
00:00In this lesson we are going to build the Lifestyle page as we continue to build our website.
00:07This is what the page looks like.
00:08There's really not too much to it.
00:11So let's go ahead and get started.
00:13So here we have the template.html, which is our starting place, and our
00:19beginning.css, which is where we left off our css from last time, and
00:24liftstyle.txt, which has our fully XHTML-ified content.
00:29So we'll start out by doing our Save As.
00:33I'm going to Save As lifestyle.html and save beginning.css as main.css
00:46and lifestyle.txt, we don't need to change it so we are not going to do a Save As there.
00:50Then we'll start off by changing our title, Groundswell Lifestyle.
00:58Then we'll move on to our links at the top of the page.
01:02So this is the current image and that one will go where the lifestyle image is now.
01:11So we'll put that there and then we'll take the lifestyle one and we'll move
01:17that to the beginning and we'll make that into home, and home, and home and then
01:29we'll change the width to 84 and I'm going to do a cut here with Ctrl+X and
01:35you can use Command+X on a Mac.
01:38Make that 80 of the home image and then go over here with the width of the
01:43home image add Paste.
01:45Make that the width for the lifestyle and that makes it the current one, because
01:51it has this -current here and it has the height of 30 for the current.
01:57Go ahead and change the alt to "lifestyle" and there we have our menu should be updated.
02:03We can go ahead and check in the browser to make sure it got done correctly.
02:06Drag the lifestyle.html into the browser and there we have it.
02:11There is our Lifestyle.
02:12Home link works and the Gear link works and there's our Lifestyle page.
02:19We need to change this id banner.
02:22Down here we make this a lifestyle and the alt text say, "live the lifestyle".
02:34Here we go and then finally we can put in our content.
02:40We get that from the text file here.
02:44Copy with Ctrl+C and Paste with Ctrl+V and go ahead and do the indent thing
02:53and Save and take a look at it in the browser, Reload and there we go.
02:59We have the banner there and we have the "What is this surfing lifestyle?" text.
03:04You can see that's the text from over here.
03:07Finally, the sidebar.
03:09Grab this from over here.
03:11Now there is one thing in this.
03:12We are going to need to do a little formatting on this ordered list.
03:15Go ahead and copy and then paste it in our sidebar content here.
03:22And indent. We have that.
03:28Go ahead and save and reload in the browser and we can see all this on the
03:35right-hand side is fine except for that ordered list.
03:38If we look on, here we see the ordered list is formatted a little bit differently.
03:42So let's go ahead and format that.
03:45So in our CSS we are going to go down to the Sidebar section, way down at
03:50the end right here.
03:53I'll go ahead and format the ordered list, so we have contentRight and ol.
04:01So that's the ordered list and we are also going to want to format the line items.
04:07So that will be contentRight. That's li.
04:11So the Ordered List, that gets just margin stuff. margin .5em, 0, 1.5em, and 1em.
04:25So that's top, right, bottom, and left.
04:29Then the line item I'm just going to start from this and paste that in here
04:42and modify from that.
04:44So this is .8em and the color is 666 and the margin is .2em for the top and
04:55bottom and .5em for the right and left.
04:59So that stuff should make it look exactly like it does in here and there we have it.
05:06Now if you are using Internet Explorer, which is statistically a number of you are,
05:11you will notice that this looks a little bit different in Internet Explorer.
05:14So I'm just going to take a moment and talk about that.
05:16I'll bring up Internet Explorer and drag our document in there and take a look.
05:23You notice this looks significantly different in Internet Explorer.
05:26This is because Internet Explorer doesn't handle the left margin on
05:30ordered lists in the same way this Firefox and actually the rest of the
05:34browser community does.
05:36Rest of the browser community follows the standard and Internet Explorer does not.
05:42So the compromise is we can make this look passible in Internet Explorer and
05:48have it look okay in Firefox.
05:51In actuality, I would love for this margin to be a little bit farther over to
05:54the left in Firefox.
05:55But the truth is if you make it farther over this way in Internet Explorer or
05:59I make it farther to left in Firefox, one or the other of them is going to suffer terribly.
06:06So this is the compromise that we have come up with here.
06:09So that's our page.
06:11You can certainly choose a different compromise if you prefer and that's a
06:14choice that every web designer has to make when they deal with having to
06:19support the browser that's 800-pound gorilla in the market and you are wanting
06:24to make their pages attractive and work well on the browsers that actually
06:29follow the standard.
06:30So those are the choices we have to make and this is the choice that I made and
06:34you can certainly make different choices and most people do. In any event,
06:38there we are and that's our Lifestyle page and next up is the Video page.
Collapse this transcript
Creating a page containing video
00:00In this lesson, we're going to create the Videos page and this is really the
00:04final page of our website.
00:06You'll notice that this has an embedded YouTube video in it and as I wave
00:10my mouse over these things, you get all the little Flash doodads that YouTube embeds.
00:15So we'll learn how to do that.
00:17It's very easy to do.
00:18It provides free hosting for your videos and all kinds of features that would be
00:23difficult to provide on your own.
00:25So it's a very popular way to embed videos in a webpage these days.
00:30So this is our Videos page and this is what it will look like when we're done.
00:35So, let's get started.
00:38Here in our text editor we have the template file and you'll notice this is in
00:44the Videos folder under the Exercise Files.
00:47So here's our template, here's our beginning.css and here's our text file.
00:52So we'll go ahead and start with our Save As, save as videos.html and we'll save
01:01our CSS as main.css.
01:10The videos.txt we do not need to save as anything because we're not going to
01:13write to it. We're just going to be reading from it.
01:17First thing we do is change the title.
01:19That's going to say Groundswell TV.
01:24Then we're going to do our menu, so we're going take this image and move it down here.
01:31Then we're going to take the link and move it up there and change this to home
01:40and change this to home, change this to home.
01:47This becomes 80 and this one down here becomes 84.
01:53This becomes videos and finally this becomes videos over here.
01:59There we're done.
02:03So we'll save that, go ahead and test it in the browser.
02:10So we need to load up the Videos page in the browser and there we are.
02:15We have our menu and everything works.
02:23That's our Videos page.
02:24Now we want to change our ID banner. That's right here.
02:28Change home_banner to videos_banner and we'll save that and reload the browser.
02:35There we have it, Swells & Vision.
02:37Go ahead and put in the alt text, "swells and vision."
02:46Now we'll go ahead and do the content.
02:49So we have our videos text file.
02:51This is really going to be easy here just a copy and paste and copy and paste.
03:06That's really easy.
03:07Go ahead and do the indent.
03:09Let's take a look at this in the browser and there we have it.
03:17There is our Groundswell TV and there is our Video Clips. Now there's something missing.
03:21Oh, yeah, there is a video here. Ha-ha.
03:23So this video is on YouTube and I've got the YouTube page loaded up here
03:26with the video on it.
03:27You can see this guy surfing here.
03:32So we want to copy and paste this.
03:34YouTube provides this nice little Embed link and they also provide a way to customize it.
03:39So you see the little Gear icon there, I'm going to click on tha,t and we get
03:44some different options.
03:45I always like to include the Enable delayed cookies.
03:49I'm going to start with that.
03:53YouTube normally provides cookies to the browser for some of its features and
03:57what this does is it prevents it from giving cookies to the browser when the
04:02video is embedded on a page that's not on the YouTube.com domain.
04:08So what this does is it delays any cookies until somebody clicks on the link
04:12to get to YouTube.com.
04:14So viewing the movie on your website will not give cookies and I like that.
04:20So I uncheck the Include related videos, which is normally checked.
04:24So that way at the end of the movie, you don't get the related videos thing.
04:28I also don't click on Show Border.
04:30Now notice the object width is 853, so we want it to be the smallest possible size.
04:36You see that changes in there when we click on this.
04:39Now we can just copy and come over here to our text editor and paste it in here.
04:48It will go right here. There it is.
04:52Oh my God! Look how long that is.
04:54It's 464 columns wide and that's a bit longer than what we'd like.
04:59Now you could just leave it like this and that would be fine and it would show up.
05:03Let me go and show you what that looks like on our page.
05:06I'm just going to close the YouTube page there now and reload this.
05:09Before I chose just the movie, it's going to show us this security warning.
05:12If you're testing this in Internet Explorer, you'll get a similar message,
05:15but it'll look a bit different.
05:16The security message will be at the top of the browser window. You just need to
05:20click on that security message and select Allow Blocked Content.
05:25I'm going to detour now and show you what to do with this.
05:29Now what this means is that you're watching content in Flash but the content
05:34is off on a web server someplace and the page you're looking at is on your local computer.
05:39So if you're following along, you'll get this warning or something like it.
05:43That's because the HTML that you're looking at is on your local computer, but
05:47the Flash content is coming from the YouTube servers out there in the
05:51Internet someplace.
05:53Now if the page was loaded on a web server someplace on the Internet, you would
05:56not get this warning.
05:57You'll only get this when the page is loaded on your local network on your local computer.
06:03So you could just click on OK and you also get this warning, because I took a
06:07long time and that's okay.
06:09Do you want to abort the script? No.
06:11So now we get the video, okay?
06:13But if I go and reload the page again, you get the warning again.
06:16So I'm going to click on Settings. I'm going to show you what to do with this.
06:19This loads a webpage over on the Macromedia website, which is at Adobe, and
06:26it allows me to set an exception.
06:28So I'm going to edit locations, add location.
06:31This is the file on my desktop.
06:33I'm going to go ahead and copy. I'm pressing Ctrl+C on the PC or press Command+C
06:37on a Mac and Ctrl+V here, Command+V on a Mac and press Confirm.
06:43Now I have this exception.
06:44I have two of them in here.
06:46One is for the other location where I have this loaded on my computer. That's okay.
06:50You'll only have one and then I can close this and now whenever I hit Reload here,
06:54I'll just get the video.
06:56Now, back to what we were saying.
06:58Notice how big this is on the page.
07:02So I want to edit that down and I also want to make that XHTML a little bit
07:06prettier, because that matters to me.
07:08That may not matter to you at all.
07:10So I'm going to edit this a little bit.
07:13Go ahead and break there and I'm going to go ahead and break here.
07:19You notice that this param is a closed param, so actually I'm going to change it
07:25to one of these because that's allowable in XHTML.
07:28I'm going to do the same thing here.
07:31Now, I'm doing this because it matters to me and for most people it may not matter.
07:36It also makes a little bit easier to work with and I'm going to be working
07:39with it a little bit, because I'm not just sort to leave anything alone if I can
07:45do something with it.
07:47So this just takes a moment.
07:50We have our width and height here, which is where I'm going with all this.
07:54Again, with the embed you can collect that.
08:01So now I have my content like this and I'm going to go ahead and just because
08:07I'm like that I'm going to intend a little bit there. All right.
08:10You notice that this has not changed how it works at all. All right?
08:14These are all things that-- all I've done is formatted it.
08:18So when I go and look at the video in our page again, it's still there and
08:22it still looks just fine.
08:24What I'm going to do is I'm going to change the size, because it's a little big,
08:27so I'm going to make this 420x260.
08:31I figured out these dimensions earlier, and these keep the same aspect ratio.
08:37So I'll save that and I'll go ahead and look at it in the browser.
08:43Now that's a much more reasonable size and now I can do a little bit of
08:47formatting. I want to indent it a little bit.
08:50So again we'll go back to the browser.
08:52I'm going to put in a div and a closed div down here.
09:03I'll indent this and I'm going to give it an ID, youtubeVideo.
09:12I'll save that and go over to the CSS, all way down here to the end.
09:19I'm just going to create a section for miscellaneous.
09:30So I know the C is silent in miscellaneous, but somehow I've always said it as
09:34if I were Popeye. "mis-ca-llaneous."
09:52So that will be 20 pixels at the top and at the bottom, 0 on the right and
09:5730 pixels on the left.
10:00Go ahead and save this.
10:03We've saved that already.
10:05Bring it up in the browser and there we have it.
10:10So this looks exactly like it does in our reference site. All right!
10:16That page is now done and working just fine.
10:20I just want to add one thing here.
10:23The site that we've been working with was designed by James Williamson.
10:28So I appreciate that.
10:30It allowed us to have some interesting content to work with as we showed you how
10:35to build a website using tables for positioning and using all the techniques
10:40that we learned in this course on XHTML and HTML.
Collapse this transcript
Touring the finished site
00:00In this movie, I'll show you the same site that's used in the rest of this
00:03chapter, but this version uses CSS for positioning instead of tables.
00:08This will be a quick overview.
00:10If you'd like a more complete discussion, please see my course CSS Positioning
00:14Best Practices here on the lynda.com Online Training Library.
00:19So here's the site using CSS instead of tables, and here's the same site in
00:24our tables version.
00:25You can see it's pretty much the same; there are some very slight differences,
00:29and that's mostly due to the fact that you can get finer grained control of your
00:32positioning with CSS than you can with tables.
00:37And here is the code for this. This is the CSS version.
00:41You will notice that there are no tables in here at all, and here is the tables version.
00:49You see the general look of it is very, very similar.
00:53It's organized pretty much the same,
00:55only one is using tables for positioning, and one is not.
01:00In the CSS version, we're doing our positioning by using these div tags; for
01:05example we have a header div tag here and we have one for the middle banner
01:11and we have one for the content, and then way down here there is one
01:16for the sideBar. And these are using ID selectors.
01:20ID selectors are useful. We only have one particular instance of a thing on the
01:24page, and then here is the CSS for it here.
01:29In the main.css file, there is our outerDiv, there is our banner.
01:42As we come down here to the mainContent, you'll see the mainContent div, and
01:47this one has a float:
01:48left on it, and so that's this one right here, and you see it contains all of the
01:58HTML for the main side of the site. And that corresponds to this part right here
02:05from Welcome to Groundswell all in this left column.
02:09And so that's aligned to the left inside of the outer box of the content, that's
02:15aligned to the left using this float:
02:19left here in the CSS.
02:24Now when we get down to the sideBar, here is our sideBar, so you see that this says float:
02:32right, and we look at this in the website. That's this part over here, starting to
02:37the right of this vertical rule and down to the bottom. So that's that right column,
02:44and it's floating to the right. The left column is floating to the left.
02:49So in a nutshell, that's really all there is to creating columns in CSS.
02:57These same columns in the tables version are used using tds inside of a tr, and
03:06so when we get down here to contentLeft, we have a td, and when we get down here
03:12to the sideBar, we have another td adjacent to it, and that's what gives it the
03:18columns in the tables version.
03:20So here you've seen a brief overview of an alternate way to accomplish the same
03:25layout using CSS instead of tables.
03:27CSS provides some real advantages, allowing you flexibility and control that you
03:33don't get using tables for layout.
03:35For more about CSS, see my other courses, CSS for Developers and CSS Positioning
03:41Best Practices here on the lynda.com Online Training Library.
Collapse this transcript
Conclusion
Goodbye
00:00My goal in creating this course was to give you the essentials of HTML and XTML,
00:05so you can use this technology to build websites for yourself and for your clients.
00:09I have shown you the different versions of HTML and XHTML and how to specify
00:14which version you are using.
00:15I have shown you how to construct a basic document template, so you can create
00:19websites with correct XHTML, without any more trouble than using minimal HTML.
00:24So your websites will work consistently on a wide variety of platforms and devices.
00:29I have covered the most common and useful XHTML tags and CSS techniques and
00:34I've taken you thorough the process of applying these techniques in a real life website.
00:38So you can move forward with confidence, knowing that you have what it takes to
00:43apply your knowledge in the real world.
00:45I've really enjoyed creating this course for you and I sincerely hope all of
00:49this is as useful for you as it has been fun for me.
Collapse this transcript


Suggested courses to watch next:

CSS for Developers (4h 2m)
Bill Weinman

HTML5 First Look (4h 28m)
James Williamson


HTML5: Structure, Syntax, and Semantics (4h 34m)
James Williamson


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 100,984 instructional videos.

start free trial learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 1,945 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.


site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked