In HTML, we have a comment tag that allows us to add notes to ourself or anyone else that might see our code. It has the form:
<!-- comment -->
CSS also has a comment that can be used in stylesheets.
It opens with a slash and an asterisk: /*
and closes with an asterisk and a slash: */.
The comment itself goes in between.
/* comment goes here */
/*
comment goes here
comment goes here
comment goes here
*/Let's look at an example in a stylesheet.
/* my link colors */
a:link { color: #0000ff; }
a:visited { color: #800000; }
a:active { color: #ff00ff; }
In Lesson 2 we learned how to apply a style directly to an element in a page using the form:
<tag style="property: value">.
At the time, it was mentioned that this looks like an atrribute does in an html element. In fact, that is exactly what it is. CSS has 3 attributes: style, class and id.
Hey, we already learned this one. All right! The style attribute allows us to apply a style to any element. Later, we'll learn how to apply a style to just a few words or a phrase. In the meantime, here is another example that uses 2 font stylings that we will cover soon.
Example
This code:
<p style="font-size:24pt; font-weight:bold; color:#6699ff;">
This paragraph has large, bold, light blue text.
</p>This paragraph has large, bold, light blue text.
We'll learn a more efficient way to get the above effect in our next lesson, when we discuss the class and id attributes.
Use a CSS comment in your stylesheet. Post the URL for your stylesheet and/or page.
Happy coding!
Gnubee