[codecademy]css
Great work! You've learned the basics of CSS structure and syntax. We'll continue to build on these basics as you learn more about CSS.
Let's review what you've learned so far:
1. A CSS selector targets an HTML element.
2. CSS declarations style HTML elements. Declarations must contain the following two things:
- property - the property you want to style.
- value - the value for the property you are styling.
3. CSS declarations must end in a semicolon (;
)
4. A CSS rule consists of a CSS selector and the declarations inside of the selector.
5. Multiple element selectors can be used to style multiple elements at once.
6. Comments keep code easy to read and allow you to experiment with new code without having to remove old code.
7. CSS follows certain best practices for spacing and indentation:
- One line of spacing between a selector and the opening curly brace.
- No spacing between CSS declarations and the opening and closing curly braces of the CSS rule.
- Two spaces of indentation for CSS declarations.
- One line of spacing between CSS rules.
Color:
The current revision of CSS, CSS3 (at the time of this writing), introduces a new way to specify colors using HSL colors.
HSL stands for Hue, Saturation, and Lightness. Specifically, this is what each means:
Hue - the technical term that describes what we understand as "color." In HSL, hue is represented on a color wheel. It can take on values between 0 and 360.
Saturation - the amount of gray in a given color. In HSL, saturation is specified using a percentage between 0% and 100%. The percentage 0% represents a shade of gray, whereas 100% represents full saturation.
Lightness - the amount of white in a given color. Similar to saturation, lightness is specified using a percentage between 0% and 100%. The percentage 0% represents black, whereas 100% represents white. 50% is normal.
You can use HSL colors in your CSS like this:
Notice that using HSL is very similar to using RGB.
Note: Because HSL is a part of CSS3, older browsers may not support it. In a later exercise, you'll learn how to work around support issues for colors.
RGB colors, hex color codes, and HSL colors offer web developers an extraordinary amount of color customization options. As these properties become more advanced, however, it's important to keep in mind that not all users browse the Internet with the same browser, let alone the same version of a given browser.
How does this affect web development? Newer revisions of HTML and CSS affect older browsers. Older browsers, over time, will become dated (possibly obsolete) and not be able to support newer CSS features. For example, many older browsers do not support RGBa, HSL, or HSLa.
Because of this, we must include redundant color options in our CSS code that can cater to a wide audience of different browsers.
Specifically, we can add multiple CSS color declarations, just in case a user's browser can't support a certain declaration.
In CSS, the latter of multiple declarations takes priority. In the example above, if the user's browser supports rgba()
, then that color will be applied to the heading. If it does not, then CSS will use the first rgb()
color declaration, as a backup.
Using redundant declarations allow you to support as many users as possible across multiple versions of different Internet browsers.
reat job! You've learned how to style an important aspect of the user experience: color.
Let's review what you've learned so far:
- Foreground color refers to the actual color of an element, styled with the
color
property. - Background color refers to the color behind an element, styled with the
background-color
property. - There are 147 named colors available.
- RGB and hexadecimal colors offer over 16 million color possibilities.
- HSL is a new way of defining colors in CSS3.
- You can modify the opacity of a color with RGBa or HSLa colors.
- Not all browsers support newer CSS features, like opacity or HSL, so additional declarations should be made to support a wide audience of users.
- There are many color picker resources available on the Internet to help you select specific colors, as well as provide colors in different formats.
[codecademy]css的更多相关文章
- Matplotlib数据可视化(3):文本与轴
在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...
- [Codecademy] HTML&CSS 第三课:HTML Basic II
本文出自 http://blog.csdn.net/shuangde800 [Codecademy] HTML && CSS课程学习目录 --------------------- ...
- [Codecademy] HTML&CSS第八课:Design a Button for Your Webwite
本文出自 http://blog.csdn.net/shuangde800 [Codecademy] HTML && CSS课程学习目录 --------------------- ...
- [Codecademy] HTML&CSS 第七课:CSS: An Overview
本文出自 http://blog.csdn.net/shuangde800 [Codecademy] HTML && CSS课程学习目录 --------------------- ...
- [Codecademy] HTML&CSS 第一课:HTML Basic
本文出自 http://blog.csdn.net/shuangde800 ------------------------------------------------------------ ...
- [codecademy]html&css
1. HTML is the language used to create the web pages you visit everyday. It provides a logical way t ...
- [codecademy]fonts in css
Great job! You learned how to style an important aspect of the user experience: fonts! Let's review ...
- CSS的未来
仅供参考 前言 完成<CSS核心技术与实战>这本书,已有一个多月了,而这篇文章原本是打算写在那本书里面的,但本章讲解的内容,毕竟属于CSS未来的范畴,而这一切都还不能够确定下来,所以这一章 ...
- 前端极易被误导的css选择器权重计算及css内联样式的妙用技巧
记得大学时候,专业课的网页设计书籍里面讲过css选择器权重的计算:id是100,class是10,html标签是5等等,然后全部加起来的和进行比较... 我只想说:真是误人子弟,害人不浅! 最近,在前 ...
随机推荐
- windows系统,MongoDB开启用户验证登录的正确姿势
MongoDB默认安装并没有开启用户名密码登录,这样太不安全了,百度出来的开启验证登录的文章,对初次使用MongoDB的小白太不友好了,总结下经验,自己写一份指引. 1,我的安装路径是C:\Progr ...
- PhpStorm中实现代码自动换行
方法一: 随便打开一个页面,在显示行号(最左边)这里鼠标右击,勾选"Use Soft Wraps". 方法二: 选择"File-->>Settings--&g ...
- laravel5.5源码笔记(六、中间件)
laravel中的中间件作为一个请求与响应的过滤器,主要分为两个功能. 1.在请求到达控制器层之前进行拦截与过滤,只有通过验证的请求才能到达controller层 2.或者是在controller中运 ...
- 两张图证明 WolframAlpha 的强大
引用于:https://capbone.com/wolfram-alpha/ 两张图证明 WolframAlpha 的强大 之前在" 我手机中有哪些应用 "里提到过 Wolfram ...
- 《你不知道的JavaScript》系列分享专栏
<你不知道的JavaScript>系列分享专栏 你不知道的JavaScript”系列就是要让不求甚解的JavaScript开发者迎难而上,深入语言内部,弄清楚JavaScript每一个零部 ...
- 基于visual studio 2017 以及cubemx 搭建stm32的开发环境(1)
参考如下文档: 传送门:http://www.stm32cube.com/article/128 如果链接不存在的话,下载我截屏好的图: 传送门:https://pan.baidu.com/s/1NC ...
- linux——Shell编程基础
1. shell 脚本的执行方式 1.1 直接绝对路径执行 1.2 相对路径执行 首先进入到shell脚本所造的目录 PS:用./执行要增加x权限.用bash执行可以不增加x权限 1.3 在当前she ...
- Altera三速以太网IP核使用(下篇)--- 百兆网接口设计与使用
MAC IP核的主要作用是:实现数据链路层协议,分为TX方向与RX方向,TX方向实现的是在原包文的前面加上7个55和1个D5,RX方向则相反.在使用这个 MAC IP核之前,首先确认下自己使用的网卡是 ...
- 20155203 2016-2017-3 《Java程序设计》第三周学习总结
20155203 2016-2017-3 <Java程序设计>第三周学习总结 教材知识要点总结 第四章 文档主文档名必须与公开类名称相同.一个原始码中可以定义多个类,但是只能有一个公开类. ...
- day7 opencv+python 读取视频,没有东西
1.读取视频man.avi, 报错. 我的视频和文件在同一目录下. #coding=utf-8 import numpy as np import cv2 cap = cv2.VideoCapture ...