添加css样式表有三种方式:
(1)直接在标签内定义,例如,<p style="color:red;font-size:12px;">content</p>;
(2)在<head></head>标签中间实现css样式,代码如下:
<style type="text/css">
<!--
H1{
font-size:large;
color:red;
}
-->
</style>
其中<!-- -->是隐藏符号,当浏览器不支持css时,将隐藏这段代码。
(3)导入外部定义好的css文件,代码如下:
<link rel="stylesheet" href="css/style.css" type="text/css" />
(1)直接在标签内定义,例如,<p style="color:red;font-size:12px;">content</p>;
(2)在<head></head>标签中间实现css样式,代码如下:
<style type="text/css">
<!--
H1{
font-size:large;
color:red;
}
-->
</style>
其中<!-- -->是隐藏符号,当浏览器不支持css时,将隐藏这段代码。
(3)导入外部定义好的css文件,代码如下:
<link rel="stylesheet" href="css/style.css" type="text/css" />
单元格自动换行与不换行
1、强制换行:
<style type="text/css">
.AutoNewline
{
word-break: break-all;/*必须*/
}
</style>
<table>
<tr>
<td class="AutoNewline">需要换行的内容</td>
</tr>
</table>
.AutoNewline
{
word-break: break-all;/*必须*/
}
</style>
<table>
<tr>
<td class="AutoNewline">需要换行的内容</td>
</tr>
</table>
2、强制不换行:
<style type="text/css">
.NoNewline
{
word-break: keep-all;/*必须*/
}
</style>
<table>
<tr>
<td class="NoNewline">不换行的内容</td>
</tr>
</table>
.NoNewline
{
word-break: keep-all;/*必须*/
}
</style>
<table>
<tr>
<td class="NoNewline">不换行的内容</td>
</tr>
</table>
3 td上换行可以使用
nowrap = "nowrap"