SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 quick and dirty css questions

    hi there,
    I just have two questions which are pretty simple...

    1) how do you create mouseovers on table cells (so that the table cell changes color when moused over) can this be done using CSS...??

    2) How can I simplify the following:

    <td Style="border-left:1px solid #ffff00;border-top:1px solid #ffff00;border-right:1px solid #ffff00">

    How can I make this shorter so that I dont have to write out the same thing over and over...

    Thanks again

  2. #2
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To minimze excessive typing use classes.

    Code:
    .myClass
      {
      border-left:1px solid #ffff00;
      border-top:1px solid #ffff00;
      border-right:1px solid #ffff00;
      }
    The "." in front of the "myClass" defines it as a class in CSS.

    Put this style declaration either in your external styleaheet or in the head of your document within a <style></style> tag.

    Then in your html:

    Code:
    <td class="myClass">
    To change the background-color onmouseover create two classes with the onmouseover background-color/onmouseout background-color defined in each then
    in the <td><p> whatever:

    <td class="yourclass" onMouseOver="this.className='yourotherclass';" onMouseOut="this.className='yourclass';"></td>

    HTH


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
  •