Viewers: in countries Watching now:
Discover how to build web sites, prototypes, and more in this course on Adobe Dreamweaver CS6. Author James Williamson shows designers how to take control of their site by properly naming and structuring files and folders; how to create new documents and web pages from scratch or with starter pages; and how to add content such as text, images, tables, and links. James also provides a background on the languages that power projects built in Dreamweaver—HTML and CSS—and introduces the programming features in the application, for developers who want to dig right into the code. The last chapter shows how to finesse your project with interactive content such as CSS3 transitions and Spry widgets.
Depending upon whether you're just reminding yourself of what a specific element or property does, communicating with your team or performing functional conditional code, commenting your code is an important part of offering it. As you would imagine Dreamweaver makes it extremely easy to add comments to your code. So, again I'm just in the Index file here and what I'm going to do is scroll down to about line 15 I actually don't even scroll, it's right there I can see it. All right, so I want to add a comment. So you might be thinking yourself What's a comment? Take a look at this code right up here in gray all that code is commented out.
Commented code is basically code that you'll either turning off to test functionality and see if maybe that was the thing causing the problem or it's code that you're just basically giving yourself a message or giving somebody else a message, let me show you. So if I go right above the header class I could do something like I could type-in header content starts here. People that create templates and a lot of like Drupal and Joomla! templates will often comment those little sections to let them know that hey this is where this snippet of code goes or this is what this is.
So if I highlight this, I can come over to my Coding Toolbar and I've got two great little tools right over here; one is to add a comment and the other one is to strip the comment out if I no longer need it. So, if I click on the Apply Comment, I notice that I have several different types. And based upon the type of scripting language that you're using, you're going to use one or the other. Now obviously we're in HTML, so I'm going to choose Apply HTML Comment. You can see that now the text is wrapped in an opening comment tag and a closing comment tag. You also notice that the default code coloring inside Dreamweaver is to make comments gray, and it sort of talks about there are sort of nature of being sort of in the background. They're not going to actually render.
You're not going to see that code within the Browser. Now if I scroll down right to where the header ends, I could also come in here and add another little line. Now last time I typed in the code and then I wrapped it with a comment, but I could actually start out with the comment. I can come right over here to my Coding Toolbar, apply an HTML comment. It's going to place my cursor right in the middle of it and I could type something like header content ends here, here we go. And now for anybody visiting my page or if I'm working within a team environment and the team would know very quickly and easily sort of where the breaks for this content is; Okay the header starts here, it ends here, if something is going to be in the header it needs to be within this section.
So, obviously it's a nice way to leave yourself notes or work within a team or even let people that are coming in and looking at your code later on learn a little bit from that. If you go out to the Web and you find a page that you really like, you can use the Browser's development tools to view the source code of that particular page, and lot of times you'll find that the designers and the developers have been really nice in terms of leaving comments behind to instruct you as to what's going on there. Now that's probably not their number one goal behind it, but well commented code is code that's very easy to learn from. So doing that sort of helps you figure out exactly kind of what you're doing.
So I end up doing this, you will notice that I have my Color Palette for the Roux Academy up here, I have hexadecimal notation for the color value, I have rgb notation for it and then I'll just give the name of the color to remind myself what it is. So, I know if an element needs to be orange for example, I'm going to use one of these two notations to apply the color. In a lot cases I'm just sort of copying and pasting from this, but this is a nice way of letting my team know what the color scheme is going to be and it's also nice way for me not having to memorize all these color declarations.
And you can also pass in copyright information, you can say hi to your mom, whatever you want to do within the comments. All right, I'm going to scroll down to about Line 125 and show you guys have commenting works in CSS. So, here we've got a nice comment that lets people know that the technique that I'm doing here with a clearfix was created by a gentleman name Nicolas Gallagher and I even give a link to his blog-post on that particular technique. That's something that a lot of Web designers do, just add a sign of respect, if you're using a technique that somebody else sort of came up with or blogged about, lot of times people will write in there, hey, Paul Irish created this or Nicolas Gallagher create this, here's where you can go learn a little bit more about it.
Okay, but one of the things I also like to do is to let people know why certain things are being done. For example, this little clearfix zoom:1. What's that all about, right? Well, I'm going to leave a comment to let people know what that is all about. Again I can go ahead and type the text in first and then wrap it in a comment or I can just come right up here and apply a CSS comment. Now the comments that are used in CSS have sort of the /* */, and you can do multiple lines of comment with that or a single line, it doesn't really matter. So you just wrap whatever text you want into those two characters.
All right, now here what I'm going to do is I'm going to type in for IE 6/7 and then I'm going to type-in something like this will trigger hasLayout, which one of the really big bugs in Internet Explorer, older versions of it, there's sort of no layout apply to an element causing something to break. So just that zoom:1 property is only for Internet 6 and 7, it's going to trigger hasLayout, so it's just letting people know what this is doing. Now in CSS you can apply comments in a couple of different locations.
Here I'm applying it right above the property. But notice I can also grab this and I can drag it right here and apply after the property is set to if I really want to be specific. The only thing I can't do is place it between the property and the value itself, So it needs to stay either above or beside that particular property, one or the other. So I'm just going to leave it right there and then save the file. Now for the most part you'll probably use comments as a way to communicate with others reading your code, or if you're like me, even as a way of reminding yourself why you did something a specific way, because I'll look back at code I wrote six months ago and I'm like why did I do that, so if don't comment it then I just don't know.
Now in certain instances comments can even have specific functionality and that's something that we're going to explore in our next movie as we discuss Code Snippets.
There are currently no FAQs about Dreamweaver CS6 Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.