SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member JAMJAMMO's Avatar
    Join Date
    Dec 2000
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i use an external link to my style sheet.
    several of my .html pages have multiple tables.
    some for data and others used for aligning images and such.

    ok, now my navigation bar is a table updated using an external .js file also linking to my "style1.css" file.
    this table has a colored background with colored text.

    further down the page i have a regular table filled with text. this table should not have a colored background nor colored text.

    here is what i am using:
    Code:
      <style>
        td
    	{ color: #000000;
    	  background-color: #FFF000;
    	  font: bold x-small Arial, Helvetica;
    	  text-decoration: none; }
        p
    	{ color: #000000; 
    	  font: x-small Arial, Helvetica;
    	  text-decoration: none; }
      </style>
    its gotten to the point where i must put a <p> tag after every <td> when i do not want it to follow the <td> style, yet i need that style to draw attention to the navigation bar. how can i have two different <td> styles??
    --------------------------------
    reach me online with AIM screen name "JAMJAMMO"
    or YAHOO screen name "JAMJAMMO"

  2. #2
    SitePoint Enthusiast Bartimeus's Avatar
    Join Date
    Dec 2000
    Location
    Norway, Trondheim
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can specify different styles with the class separator:

    css:
    td.black{ color: #FFFFFF;
    background-color: #000000;
    font: bold x-small Arial, Helvetica;
    text-decoration: none; }
    td.white{ color: #000000;
    background-color: #FFF000;
    font: bold x-small Arial, Helvetica;
    text-decoration: none; }

    <html>
    <td class="white">text...</td>
    <td class="black">text...</td>

    you can also use the class separator like this:
    .black{,,,} and apply it to <p>, <td> aso..

    hope this helps

    Bjarte S Karlsen
    Roleplayer and webdeveloper with a high nerd factor.

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just to clarify, JAMJAMMO...

    CSS gives you several ways to create a "style".

    The most common way is to give a certain style to every instance of a tag like TD which is what you are doing.

    The next most common way is to assign a style to a "class" of that tag like so: td.black (to use Bartimeus' example). WHat that does is to let you use that style ONLY on TD elements that say <TD "class="black">.

    One other way to do it is to create a "free" class (my own words) like:

    .black {font-family: arial; font-weight: bold; color: #000000; }

    That allows you to use that class in ANY element.

    <a href="link.html class="black">

    <td class="black">

    <span class="black">

    That is the method that I use as it allows you to be a little more flexible in your style setup.

    There are other ways to create styles as well, such as pseudo classes for A tags, #id etc, but I won't go over those.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •