|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
在做动动手00的过程中,对比了一下代码内容,有几行不是很理解。。
- <style>
- h1{
- text-align: left;
- }
- p{
- text-align: left;
- font-size: 22px;
- }
- img{
- position: absolute;
- margin-top: 0;
- margin-left: 0;
- }
- </style>
复制代码
这是题目网页中修改前的代码
这是修改后:
- ……
- <style type="text/css"> /*为何这里要添加type=''text/css'',而原网页里的代码不用添加这一行代码,直接用<style>标签?*/
- h1{
- text-align: center;
- }
- p{
- text-align: center;
- font-size: 22px;
- }
- img{
- position: absolute;
- margin-top: -10%;
- margin-left: 60%;
- }
- </style>
- ……
复制代码
鱼油的问题,添加type=''text/css'',更确切的将是“为什么用type全局属性?”
定义上讲,type 属性规定代码的 MIME 类型。
什么意思?
这个是XML时代的产物,告诉浏览器代码,我这里用的是什么类型。
而对于目前处于的H5时代,主流浏览器都可以直接识别style
意味着,不写type属性也完全okay~
|
|