[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
colorproperty. - Background color refers to the color behind an element, styled with the
background-colorproperty. - 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等等,然后全部加起来的和进行比较... 我只想说:真是误人子弟,害人不浅! 最近,在前 ...
随机推荐
- 高性能MySQL--MySQL数据类型介绍和最优数据类型选择
MySQL支持的数据类型很多,那么选择合适的数据类型对于获得高性能就至关重要.那么就先了解各种类型的优缺点! 一.类型介绍 1.整型类型 整型类型有: TINYINT,SMALLINT,MEDIUMI ...
- php实现姓名按首字母排序的类与方法
php将名字按首字母进行排序 <?php public function getFirstChar($s){ $s0 = mb_substr($s,0,3); //获取名字的姓 $s = ico ...
- Hbase(1)-MySQL海量数据存储的启发
宽表拆分 有一张user表,记录了用户的信息,,如果表中的列有很多,就称之为宽表,为了提升效率,会进行垂直拆分 拆分后 将用户的信息分为基本信息和其他信息,页面一开打就需要展示的信息为基本信息,其他信 ...
- go语言的cron包的简单使用
3.cron举例说明 每隔5秒执行一次:*/5 * * * * ? 每隔1分钟执行一次:0 */1 * * * ? 每天23点执行一次:0 0 ...
- vs2013发布网站合并程序是出错(ILmerge.merge:error)
Vs2013发布网站时,生成错误提示: 合并程序集时出错: ILMerge.Merge: ERROR!!: Duplicate type 'manage_ForcePasswrod' found in ...
- # 2017-2018-1 20155337《信息安全系统设计基础》第5周学习总结+mybash
2017-2018-1 20155337<信息安全系统设计基础>第5周学习总结 教材学习内容总结 不论我们是在用C语言还是用JAVA或是其他的语言编程时,我们会被屏蔽了程序的机器级的实现. ...
- 考研编程练习----最大公约数与最小公倍数(c语言)
int gcd(int a, int b){return (a = a % b) ? gcd (b,a): b;} int lcm(int a, int b){return a * b / gcd(a ...
- spring_cloud多个微服务访问时偶发forward_error问题
1.问题: 最近在做SpringBoot项目的时候,有多个分开的微服务,偶发forward error 问题 2.猜想: 个人理解为服务跳转错误,可能本身没找到目标服务,或者目标服务损坏 3.解决: ...
- 【LG4169】[Violet]天使玩偶/SJY摆棋子
[LG4169][Violet]天使玩偶/SJY摆棋子 题面 洛谷 题解 至于\(cdq\)分治的解法,以前写过 \(kdTree\)的解法好像还\(sb\)一些 就是记一下子树的横.纵坐标最值然后求 ...
- 4361: isn
4361: isn https://lydsy.com/JudgeOnline/problem.php?id=4361 分析: dp+容斥. 首先计算出每个长度有多少种子序列是非降的.这一步可以$n^ ...