div inheritance

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

div inheritance

Post by s.dot »

Code: Select all

<style type="text/css">
body {
	font-family: verdana, tahoma, arial;
	color: #000000;
	font-size: 9pt;
}
body A:link {
	font-size: 7pt;
	font-family: verdana, tahoma, arial;
	color: #000000;
	font-weight: bold;
	text-decoration: none;
}
body A:visited {
	font-size: 7pt;
	font-family: verdana, tahoma, arial;
	color: #000000;
	font-weight: bold;
	text-decoration: none;
}
body A:active {
	font-size: 7pt;
	font-family: verdana, tahoma, arial;
	color: #000000;
	font-weight: bold;
	text-decoration: none;
}
body A:hover {
	font-size: 7pt;
	font-family: verdana, tahoma, arial;
	color: green;
	font-weight: bold;
	text-decoration: none;
}
.box
{
	border: solid 2px #000000;
	background: #FFFFFF;
	padding: 2px;
}
.form {
	border: solid 1px #000000;
	cursor: default;
}
.nav {
	font-family: verdana, tahoma, arial;
	font-size: 9pt;
	color: #000000;
}
</style>
Suppose I had <div class="box">Regular text - <a href="#">Link text</a></div>

The link text will inherit the body's link style, but the regular text will not be the body's text style. Am I doing something wrong?

I would like for a <div class="box"></div> to inherit BOTH the regular text style, and the link text style
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

box does not inherit from body
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

then why are the links inside of "box'' the same style as body link? when i have not set the box links
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

I don't see it. When testing It inherits just fine (IE6 , Ff 1.06 and Opera 8.5). Which browser are you using?

Code: Select all

body { 
   font-family: verdana, tahoma, arial; 
   color: #ff0000; 
   font-size: 20pt; 
}
...
.box 
{ 
   border: solid 2px #000000; 
   background: #FFFFFF; 
   padding: 2px; 
} 
... 
<p>
Regular text- <a href="#">Link</a>
</p>

<div class="box">
Regular text- <a href="#">Link</a>
</div>
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Heh.. that is weird. =/ thanks for the reply! given second testing it now works.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

ah, turns out it was because my <div></div> was inside a table cell. i guess table cells inhert the body td {} which wasn't set.. so it used default settings.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply