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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Body in CSS 1

Status
Not open for further replies.
Joined
Oct 11, 2006
Messages
300
Location
US
If I were to do this:

Code:
body
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-color:#5a5b5e;
font-size: 12px;
font-weight:bold;
}

Won't it not affect the entire web page?
 
Yes. The content in the body tag. And those tags that inherit from body.

But <b>bold</b> would still be bold...

Then you can style the other elements as you like.

Have at look at this reference :


It'll tell which properties are inherited.
 
And note that depending on the browser, your styling might not be applied to tables and/or input elements.

On the other note, try to avoid specifying font size in pixels. What if people find your font too big or too small for reading?
 
The reason why I am asking is because I have an unordered styled list within the div tag which is within the body tag. All the nodes within the <ul> tag are either hyperlinks or just plain text. The plain text shows as Times New Roman and not as Arial as mentioned within the body.

div tag style:

Code:
.container1
{
background-color: #ffffff;
height: 40%;
BORDER-RIGHT: #78B3E0 1px solid;
width: 25%;
float: left;
margin-top: 1em;
}

UL style

Code:
#menu {
  padding:0;
  margin:0;
  }
#menu li {
  list-style-type:none;
  }

#menu ul {
padding: 0;
margin: 6px;
list-style-type: none;
//font-family: Verdana, Arial, Helvetica, sans-serif;
font-color:#5a5b5e;
font-size: 12px;
}

In the above which I commented out (font-family), if commented out, the text appears as Times new Roman and not as Arial as mentioned within the body.

hypertext style for the UL nodes

Code:
a.a_style:link {color:#0000ff; text-decoration:none;}
a.a_style:visited {color:#0000ff; text-decoration:none;}
a.a_style:hover {color:#ff0000; text-decoration:underline;}
a.a_style:hover {color:#ff0000; text-decoration:underline;}

Thanks.
 
I just googled a bit about inheritance. Didn't find a clear example.

But I would geuss that

Code:
font-family : inherit;

... should force inheritance of the font family. Give it a go!
 
Thanks for the tip. This worked. I also changed the font from 'px' to 'em' so that it does not show as too big or too small in other browsers.
 
What was probably wrong was the fact that you used the wrong type of comment in your css. You used the javascript single line comment (//) but those do not work with css. In css you can only use the following comment:
Code:
/* this is a comment */
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top