In what to write CSS "codes" so they can work? I am doint it the same way i did with hml codes and it doesn't work properly!
Css?
Started by Vojkan, Jan 17 2007 11:44 AM
5 replies to this topic
#1
Posted 17 January 2007 - 11:44 AM
|
|
|
#2
Posted 17 January 2007 - 12:07 PM
You need to place the CSS between the <style> tags in the header. Then you can give parts of your html document names to specifically reference to or you can just reference all of a particular tag...here is an example of a specific reference
here is an example to a general reference (coloring all the td cells blue)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
color: #0000FF;
}
-->
</style>
</head>
<body>
<span class="style1">Blue Text</span>
</body>
</html>
here is an example to a general reference (coloring all the td cells blue)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
tr {
background-color: #0000FF;
}
-->
</style>
</head>
<body>
<table width="100%" border="1">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
#3
Posted 17 January 2007 - 12:57 PM
So basically for any "code" to work as CSS i have first to write this: <style type=”text/css”>? And end with </style>?
#4
Posted 17 January 2007 - 03:40 PM
Vojkan said:
So basically for any "code" to work as CSS i have first to write this: <style type=”text/css”>? And end with </style>?
pretty much. :D There are other ways to do it but I like this way the best.
#5
Posted 18 January 2007 - 05:41 AM
Or you can create a style.css ( can change ) file with codes which you are going to put between <style> tag and connect it with the HTML document. So, it will make the HTML file shorter to read and easy to edit.
#6
Posted 18 January 2007 - 08:21 AM
Or you can include the style in the actual html tag like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <span style="color:#FF0000">This is red</span> </body> </html>


Sign In
Create Account


Back to top









