Jump to content

Css?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Vojkan

Vojkan

    Newbie

  • Members
  • PipPip
  • 26 posts
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!

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
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

<!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
Vojkan

Vojkan

    Newbie

  • Members
  • PipPip
  • 26 posts
So basically for any "code" to work as CSS i have first to write this: <style type=”text/css”>? And end with </style>?

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

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
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
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
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
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>