第2课 CSS 的工具与平台
CSS 的工具与平台,要学习是使用CSS 那么就需要一个平台或工具来帮助学习,通过这些工具可以快速
验证我们写出来的代码是否正确,
工具一:文本编辑器+浏览器,CSS是可以用文本编辑器要书写代码的。只要我们能熟练了解CSS的语法和属性那么
可以用文本编辑器写出CSS代码。这个对使用者要求比较高,刚入门的朋友就不要这么玩了。如果真想这么做的话,建议把CSS的选择器和属性罗列
出来,做个表单也许有帮助。
工具二:专业的HTML工具+浏览器,专用的html工具都会把CSS的创建加进来。例如 bluefish ,dreamweaver,等。在bluefish的菜单和工具栏里都有
CSS的功能。
用bluefish新建一个文件,保存为1.css 。那么这个CSS里我们就可以添加样式表了。 在工具栏里点开 CSS 。可以看到 有要个按钮 创建CSS表,span
div , 多列。 第一个就是向CSS文件里加样式表的。
点 创建样式表,打开 对话框,在选择器下拉框里看到如下内容:
acronym big frame frameset noframes
tt a abbr address
area b base bdo blockquote
body br button caption cite
code col colgroup dd del
dfn div dl dt em
fieldset form h1 h2 h3
h4 h5 h6 head hr
html i iframe img input
ins kbd label legend li
link map meta noscript object
ol optgroup option p param
pre q samp script select
small span strong style sub
sup table tbody td textarea
tfoot th thead title tr
ul var
从上面的内容可以看到,基本都是标签元素。这戏标签是可以做为选择器的。当这些选择器的属性别改变后,引用
这个CSS 文件的html的相应标签的属性就会发生变化。每个标签的属性都是有默认值的。我们要做的CSS就是为了改变
这些值。
从上面的这么多标签可以想像到,如果不查表记忆比较麻烦,那么用专用的工具就不用记了,只用去选择就可以了。
下面来看一下属性:
font-family font-style font-variant font-weight
font-size font color background-color
background-image background-repeat background-attachment background-position
background word-spacing letter-spacing text-decoration
text-transform text-align text-indent text-decoration
line-height margin-top margin-right margin-bottom
margin-left margin padding-top padding-right
padding-bottom padding-left padding border-top-width
border-right-width border-bottom-width border-left-width border-width
border-top-color border-right-color border-bottom-color border-left-color
border-color border-top-style border-right-style border-bottom-style
border-left-style border-style border-top border-right
border-bottom border-left border wider
height float position top
right bottom left clear
display direction unicode-bidi z-index
min-width max-width min-height max-height
line-height white-space list-style list-style-type
list-style-image list-style-position vertical-alignt overflow
clip visibility caption-side table-layout
border-collapse border-spacing empty-cells content
counter-increment counter-reset cursor opacity
outline outline-color outline-style outline-width
quotes
上面的属性很多,但是并不是每个元素都要有上面的全部属性的。后面我们会慢慢讲。