Jump to content

Recommended Posts

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

I did as html
<table class"newsfact"><tr><td>
<h1>title</h1>
<h2>description</h2>
</td</tr></table>

but it does not work, the background color did not work either, who can help me out here
Link to comment
https://forums.phpfreaks.com/topic/16014-class-issue/
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?
Link to comment
https://forums.phpfreaks.com/topic/16014-class-issue/#findComment-65866
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.