1、段落标签中不能嵌DIV,如<P>标签
2、CSS样式表的分类:
内联式样式表(特点:作用只局限于某个标签的内容):
<p style="font-size:50px;background-color:green"></p>
嵌入式样式表(特点:写在头部,作用只局限于某个页面的内容):
<head> <style type="text/css"> <!-- p{font-size:50px;background-color:green} --> </style> </head> <body> <p>头部定义的样式会显示在这里</p> </body>
外部样式表:
文件:main.jsp <head> <link rel="stylesheet" type="text/css" href="./style/common.css"/> </head> <body> <p>外部样式文件定义的样式会显示在这里</p> </body> 文件:style/common.css p{font-size:50px;background-color:green;}
输入样式表(特点:要特别注意格式,路径用“()”,最后要用分号):
1)、用于两个CSS文件之间:
文件:style/common.css p{font-size:50px;background-color:green;} @import url(./style/demo.css); 文件:style/demo.css p{font-size:50px;color:green;}
2)、用于CSS文件与嵌入样式表之间
文件:style/demo.css p{font-size:50px;color:green;} 文件:main.jsp <head> <style type="text/css"> <!-- p{font-size:50px;background-color:green} @import url(./style/demo.css); --> </style> </head>