Hellusius Posted July 30, 2006 Share Posted July 30, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/16014-class-issue/ Share on other sites More sharing options...
moberemk Posted July 30, 2006 Share Posted July 30, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/16014-class-issue/#findComment-65866 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.