Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a new class w/ multiple items

Status
Not open for further replies.

hawley

Programmer
Dec 16, 2002
37
US
I am just learning html and style sheets so I am not sure of how everything works. I am trying to create a style sheet with the following class:
body.standard_format {
background-color: #ffffff;
margin-left: 0;
margin-top: 0;
margin-height: 0;
margin-width: 0;
font-family: verdana, helvetica, sans-serif;
font-size: 10pt;
color: #000000;
}

For some reason when I call this class:
<body class="standard_format">

nothing happens. If I try and break them up:
body.standard_format {
background-color: #ffffff;
margin-left: 0;
margin-top: 0;
margin-height: 0;
margin-width: 0;}
body.text_font: {
font-family: verdana, helvetica, sans-serif;
font-size: 10pt;
color: #000000;
}

and call both in the body:
<body class="standard_format" class="text_font">

only the second format stays.

My questions are:
Can I not call two in one section?
Why won't the font and margins format work together?
 
Fonts and margins do work together. However, bogus css properties and real ones don't. There is no margin-height or margin-width in CSS. Wherever you pulled them out, better put them back in again. If you're trying to get rid of the gutter that exists in default body, you should just equate margin and padding of the body to 0. Do it like this:
Code:
body.standard_format {
 background-color: #ffffff;
 margin: 0;
 padding: 0;
 font-family: verdana, helvetica, sans-serif;
 font-size: 10pt;
 color: #000000;
}
Incidentally, if for some reason you might one day need two classes appended to the same element, that is also possible. The syntax is very simple: delimit classes with a space:
Code:
<body class="standard_format text_font">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top