PDA

View Full Version : What's wrong with my CSS script?


DarkTemplar
07-05-2005, 01:13 AM
In the body tag of my CSS script, I have this:

body { background-color: #000000;
font-family: Arial, sans-serif;
font-size: 10pt;
color: #CCCCCC }

From what I understand, the font properties specified in the body tag should apply everywhere thoughout the webpage. When I put my text within a table however, the font size appears in 12pt instead of 10pt. Am I missing something?

Thanks. http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif

fmuder
07-05-2005, 02:43 AM
Hope you don't mind...I also have a CSS problem.

Page (http://members.shaw.ca/lucia_engel)

In IE, the result is exactly what I want, but in Firefox, the middle part is shifted towards the right abit. Another weird thing is, after I add the DOCtype, the IE view is screwed as well with the top navigation bar having two lines.

This is my first CSS attempt, so i combined a few template code and added some of my own.

Here (http://members.shaw.ca/lucia_engel/all.css)'s my CSS script.

Edit: Can't see anything wrong with your script, I tried it out myself. Are you sure you didn't override the code somewhere else?

NetNessie
07-05-2005, 05:52 AM
The font-size properties of the Body tag are reset when text appears in a table.

Instead use:

table {font-size: 10pt;}

biXen
07-05-2005, 06:13 AM
Better yet, make something like:


td,div {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}


Body should be for body stuff, not text. And if you put text in a table you put it in a td, so you shouldn't define it in the table properties, it would be confusing, that's for the table properties.

the pineapplehead
07-08-2005, 10:12 AM
The star selector will help:

* {

}

Anything you put in there will be applied to EVERY element on the page. It's very useful for zeroing margins and padding for pixel-perfect designs.

Also, the Doctype throws IE into Standards Mode. This is what you want.

SippyCup
07-19-2005, 01:33 PM
You know, as much as I've used CSS, I never thought about *{}.

NetNessie
07-20-2005, 01:19 AM
SippyCup said:
You know, as much as I've used CSS, I never thought about *{}.



I never thought of using it that way either. How supported is that selector though?

the pineapplehead
07-20-2005, 03:05 PM
Everything supports it, afaik.

IE (being crap that it is) is great with it. It seems to think that <html> is contained by a mysterious tag, <*>.

Therefore,

* html #blah {
}

is used to target IE.

SippyCup
07-26-2005, 01:34 AM
Ha!

<*>
<html>
</html>
</*>