SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Child of another class or tag

    Hi

    I have some CSS like this :

    Code:
     A
    {
    	font-family: tahoma , verdana;
    	font-style: normal;
    	font-variant: normal;
    	font-weight: normal;
    	font-size: 10;
    	font-stretch: normal;
    	color: #777777;
    }
    I want create some style for A:hover
    All properties are like A just color changed
    Should I wrote again ?

    What about two tags that not have any similar ponts ? for example P and A ?

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd usually define things common to the entire page or to entire sections to the parent and just let styles inherit therefore to style things that are common you'd probably use something like this...

    Code:
    body {
      font-family: tahoma, verdana, sans-serif;
      font-size: 73%;
      color: #777;
    }
    Then to style the color of your links all you'll need to do is this...

    Code:
    a, a:link {
       color: #C00;
    }
    And finally, the hovers would be applied like so...

    Code:
    a:hover {
      color: #00C;
    }
    You don't need to define all the items you've set as "normal" because usually this is their default value so you only need to define these if another style has been set earlier which changes this or when you're dealing with an element which may naturally have a different styles (e.g. th and <h>eadings are displayed in bold).

    You should also specify a generic font at the end of your styles (i.e. serif or sans-serif and should also specify fonts in % or em so that they can scale).

    Hope that helps.


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
  •