So here's a really simple CSS stylesheet.
So how do we build stylesheets?
What are some common CSS properties?
Your selectors don't have to be tags only. We previously saw a body tag selector, and tag selector does look just like that. You name a tag, and then you define a stylesheet for that tag. But you can also do something called an ID selector.
An ID selector looks pretty similar. But notice, that now I'm not using an HTML tag, I'm using, in this case, #unique, or hash unique. If you recall from our video on HTML, we talked about how tags can have attributes.
And one attribute that applies to pretty much all HTML tags, but we didn't talk about it, is something called an ID tag. So this particular CSS would apply only to HTML tag that has a very specific ID, that you've named.
You can also do something called a class selector.
This particular stylesheet would apply to every tag whose class is students. In this case, we'd set the background color to yellow, and we'd set opacity, which is a tag we didn't talk about, but just deals with how transparent something is, to 70%, in this case.
There's two options for writing stylesheets.
网友评论