What Takes Precendence - Class or ID

Discussion in 'CSS' started by qdsouza, Jan 4, 2006.

  1. #1
    In a CSS which format takes precendence over the other, and can you reverse the precendence?

    Here is an example of class as Canvas and Id as header. I would like the header format to appear, but it seems to be canceled out by whatever I do in the Canvas section.

    Any help or a direction would be really appreciated.



    /*
     * canvas
    **/
    
    body
    {
    	font-size: 10pt;
    	background-color: #0033CC;
    }
    
    table.canvas
    {
    	width: 95%;
    	border: solid 1px DimGray;
    	border-collapse: collapse;
    	padding: 0px 0px 0px 0px;
    	margin: 0px auto 0px auto;
    	background-color: #0033CC;
    }
    
    
    /*
     * header
    **/
    
    #header
    {
    	background-color: #0033CC;
            font-family: Verdana, Arial, Helvetica, sans-serif; 
    	color: #FFFFFF; 
    	text-decoration: none; 
    	font-size: 12px; 
    	font-weight: bold;
    Code (markup):
     
    qdsouza, Jan 4, 2006 IP
  2. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #2
    Colleen, Jan 5, 2006 IP
  3. ramakrishna p

    ramakrishna p Notable Member

    Messages:
    1,798
    Likes Received:
    361
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Thank you for the reference url...
     
    ramakrishna p, Jan 5, 2006 IP
    Colleen likes this.
  4. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #4
    Thank you for thanking me, you're welcome.... :D
     
    Colleen, Jan 5, 2006 IP
  5. qdsouza

    qdsouza Guest

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks Colleen - I am placing the header ID in the table with the class 'canvas'.

    Like this -
    <table id="header" class="canvas">
    Code (markup):
     
    qdsouza, Jan 5, 2006 IP
  6. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #6
    Colleen, Jan 5, 2006 IP
  7. tommie

    tommie Guest

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Just a question, why place an ID in a table? You could use <div id="header">
    and drop the table tag in whole. And answer to your question id goes over class.

    Good luck
     
    tommie, Jan 5, 2006 IP
  8. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #8
    I was wondering why use a table myself. Thanks for answering which takes precedence, Tommie. ;)
     
    Colleen, Jan 5, 2006 IP
  9. tommie

    tommie Guest

    Messages:
    114
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    sjees thats fast colleen, arent you also active on sponsorchat? (recognize that photo :))
     
    tommie, Jan 5, 2006 IP
  10. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #10
    Yep, I am a little active there. Dave invited me and likes to send those reminders to 'come post' lol. :)
     
    Colleen, Jan 5, 2006 IP