Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
There are indeed many different ways to write CSS comments, and in this movie I'm going to explore how to write the single line format of comments. And there's actually a few different ways that you can do that. And so the first way to do that is just the very basic way of putting a slash, adding an asterisk, and then writing out your comment. At the end of this, you want to close it with an asterisk and another slash. Now that's one way to do it. This, however, sometimes doesn't get the attention of everybody because there's not a whole lot going on here.
And so, another great way to do a single line comment would be to add a few more asterisks to this. So something like this, and then close it with asterisks as well, something like that. This gives it a little bit of more definition, gives it a little bit more prominence in the code and allows people to actually say oh, okay there's something going on here that I need to pay attention to. In addition to asterisks, you could also use dashes or hyphens, so you could do something like this.
Just make sure that when you're doing it this way that you do not take away the leading or the trailing asterisk at the front, because that's what makes it a comment. You have to have the slash asterisk here and the asterisk and the slash here. So either way it's fine, but this is the way that I usually write single line comments. I usually do either the hyphen way, or I do the multiple asterisks way. You can of course just do the standard all two asterisk method. That's totally up to you, but either way try to find a way that works for you, a way that you can do this quickly and a way that is also going to draw attention to these comments, because that's why we're putting them in there so that people will read them, understand them, and see exactly where we were trying to go with our CSS
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 60245 Viewers
61 Video lessons · 92823 Viewers
82 Video lessons · 104225 Viewers
56 Video lessons · 107276 Viewers
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.
Your file was successfully uploaded.