Wednesday, September 5, 2012

4 ways to apply CSS to HTML



There are 4 ways to apply CSS to HTML:
1) Using style attribute-inline:
Code:
<td STYLE="COLOR:BLUE; font-size:9pt;" > </td>


2) Using style tag:
Code:
<STYLE TYPE="text/css">
<!--
BODY {
  color: BLUE;
  background: #FFFFCC;
  font-size: 9pt}
TD, P {
  COLOR: GREEN;
  font-size: 9pt}
-->
</STYLE>

It is better to put style between <head> and </head>

3. Using external link
Code:
<LINK REL="stylesheet" TYPE="text/css" HREF="example.css">


4. Using @import
Code:
<STYLE TYPE="text/css">
<!--
  @import url(http://yourweb/ example.css);
-->
</STYLE>

Note HTML tags are not case sensitive.

No comments:

Post a Comment