这么理解大概没错。 因为网页中不但包含文字,还有图片、视频、Flash小游戏,有复杂的排版、动画效果,所以,HTML定义了一套语法规则,来告诉浏览器如何把一个丰富多彩的页面显示出来。
上次我们看了新浪首页的HTML源码,如果仔细数数,竟然有6000多行!
所以,学HTML,就不要指望从新浪入手了。
通过列表生成式,我们可以直接创建一个列表。
但是,受到内存限制,列表容量肯定是有限的。
而且,创建一个包含100万个元素的列表,不仅占用很大的存储空间,如果我们仅仅需要访问前面几个元素,那后面绝大多数元素占用的空间都白白浪费了。
所以,如果列表元素可以按照某种算法推算出来,那我们是否可以在循环的过程中不断推算出后续的元素呢?这样就不必创建完整的list,从而节省大量的空间。
在Python中,这种一边循环一边计算的机制,称为生成器:generator。
As our first goal, let’s create a web page that outputs that famous example message: “Hello world.”
If you were publishing a simple “Hello world” web page without a web framework, you’d simply type “Hello world” into a text file, call it “hello.html“, and upload it to a directory on a web server somewhere. Notice in that process you’ve specified two key pieces of information about that web page:
| <script src="https://code.highcharts.com/highcharts.js"></script> | |
| <script src="https://code.highcharts.com/highcharts-more.js"></script> | |
| <script src="https://code.highcharts.com/modules/exporting.js"></script> | |
| <div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div> |
| Highcharts.chart('container', { | |
| chart: { | |
| polar: true, | |
| type: 'line', | |
| backgroundColor: 'transparent' | |
| }, | |
| title: { | |
| text: null, |
| <script src="https://code.highcharts.com/highcharts.js"></script> | |
| <script src="https://code.highcharts.com/modules/exporting.js"></script> | |
| <div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div> |
| #container { | |
| min-width: 310px; | |
| max-width: 1000px; | |
| max-height: 200px; | |
| margin: 0 auto | |
| } |
aims at :
providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word "flex").
| CSS Grid Layout | CSS Flexbox Layout |
|---|---|
| 2-dimensional system (handle both columns and rows) | largly a 1-dimensional system |
| apply CSS rules both to a parent element (Grid Container) + that elements' children (Grid Items) |