Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Adding comments

From: Dreamweaver CS6 Essential Training

Video: Adding comments

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.

Adding comments

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.

Now depending upon whether you're working with HTML or CSS or JavaScript or some other scripting language, you're going to be using different types of comments and these comments sort of sometimes have different rules, so I'm going to switchover to main.css. Now before we scroll down and actually add a comment I want to show you guys some of the ways that I use commenting for myself in CSS. One of the things that I really wish they would add to Dreamweaver, and I've been requesting this for years, so I don't know if Adobe listing is listing or not, but hey guys, I've been requesting these for years, can I please have a Color Swatch Panel inside my CSS where I can store custom swatches? No? Okay.

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.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 54223 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS6 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

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.

Sign up and receive emails about lynda.com and our online training library:

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

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.