Jump to content


This topic is now archived and is closed to further replies.


Class issue

Recommended Posts

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

Share this post

Link to post
Share on other sites
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:
[code].newsfacts { background-color: #2299FF; }
h1 { font-size: 8pt; color:#AA5522; text-align: left;}
h2 { font-size: 4pt color:#DD9955; text-align: center;}[/code]

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?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.