Jump to content


Class issue

  • Please log in to reply
1 reply to this topic

#1 Hellusius

  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 30 July 2006 - 11:41 AM

I tried making a class to add for a news table,
this is the code
 h1 { font-size: 8pt; color:#AA5522; align="left"}
 h2 { font-size: 4pt color:#DD9955; align="center"}

I did as html
<table class"newsfact"><tr><td>

but it does not work, the background color did not work either, who can help me out here

#2 moberemk

  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 30 July 2006 - 12:19 PM

Of course not. It's class="nesfact". Style declarations are also not HTML tags-instead of an equals sign, you should have a colon and at the end a semicolon. You have it right in your font-size and color declarations, so I don't know why you didn't do it right that way-though given that the align isn't even a CSS property, it probably doesn't matter.. Also, if you want to have those h1 and h2 tags show up that way inside the newsfacts class, you don't nest them like that-you make them a separate declaration, only you would write them like .newsfacts h1 or h2. That tells it to apply the property to the newsfacts, and then only to h1 tags within that class.

Basically, your CSS code is terrible. Here's how it should look when it's well-formed:
.newsfacts { background-color: #2299FF; }
h1 { font-size: 8pt; color:#AA5522; text-align: left;}
h2 { font-size: 4pt color:#DD9955; text-align: center;}

Just a quick tip: pt sizes are for printing, and generally don't work the same accross all browsers.
And a question: why are you using a table for that? I don't quite get the reasoning as to why you've used it there-if all you're using is one cell, why not just make it a <div> instead?
Disclaimer: No matter how harsh I may be, I'm always IMO only.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users