知识点17:样式CSS

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.

The End

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容