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

Unable to style a div

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
This could be one of those problems where the question is more complicated than the answer but here goes.
I have the following page structure which allows me to control content in columns.
Code:
<body class='spilbod'>
	<div class="spilpag">
		<div class='menucolumn'>
			<div class='menu'>
			</div>
			<div class='undermenu'>
			</div>
			<div class='undermenu'>
			</div>
			<div class='undermenu'>
			</div>
			<div class='undermenu'>
			</div>
		</div>
		<div class='body'>
			<div class='message'>
				[RED]Cannot get this div to format[/RED]
			</div>
			<div class='fullcolumn'>
			</div>
			<div class='column'>
				<div class='item'>
				</div>
				<div class='item'>
				</div>
				<div class='item'>
				</div>
			</div>
			<div class='column'>
				<div class='item'>
				</div>
				<div class='item'>
				</div>
				<div class='item'>
				</div>
			</div>
			<div class='info'>
			</div>
		</div>
	</div>
	<div class="lynx">
	</div>
</body>
</html>
I cannot format the div class 'message'.
Code:
.message{
	font-size:12px;
	font-family: Verdana, sans-serif;
	text-decoration: none;
	font-weight:bold;
	font-style:normal;
	color: #FF0000;
	border-width: 3px;
	border-style: solid;
	border-color: #FF0000;
	background-color: #DDDDCC;
}
The text just remains black and there is no border.
Up to this point, things have gone well.

Keith
 
I can see one thing possibly wrong here. I don't know but maybe naming a class 'body' could cause problems. Another possible explanation is in your CSS above the .message class declaration. I'd check for a colon instead of a semicolon at the end of each line in your CSS.

That's the best I can do.
 
It's impossible to say for sure without seeing your other style definitions, but perhaps you need to put more specifiers on the class definition:
Code:
[!]div[/!].message{

If you really want to get crazy you can trickle it all the way down to get really specific:
Code:
[!]body.spilbod div.spilpag div.body div[/!].message{


-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Thanks guys.
It's a mystery to me too.
No colons in the CSS.
I'll change the body name to something else, nevre even considered that.

kaht, do I really need to go that crazy?



Keith
 
If it is a specificity issue it is easier to test by simply adding !important at the end (before the semi-colon) of each declaration. That will make that declaration the most specific.
 
good point Vragabond, I always forget about the !important style.

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top