css question

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lewindha
Forum Newbie
Posts: 6
Joined: Wed Apr 07, 2004 10:03 pm

css question

Post by lewindha »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello all

I have a question regarding style sheets.

I have created a stylesheet 'general.css'.  I've included it in the php file using the <link> tag.

Now when I apply a class to say a <div> tag:

Code: Select all

<div class="header_div">
This works fine. The style is applied. But when I try to apply that same style to a div dynamically created in php, it doesn't work:

Code: Select all

<?
    echo '<div class="header_div">';
    echo 'content';
    echo '</div>';
?>
Can anyone tell me why this is happening?

Thanks


Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
lewindha
Forum Newbie
Posts: 6
Joined: Wed Apr 07, 2004 10:03 pm

Post by lewindha »

I take it back.

This works fine in Internet Explorer. But it won't in Firefox. Why is that?
lewindha
Forum Newbie
Posts: 6
Joined: Wed Apr 07, 2004 10:03 pm

Post by lewindha »

Can someone please help me???

Basically, Internet Explorer is applying the style to the dynamically created element and Firefox is not. Why is this? And how do I get Firefox to apply the styles?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

View the source of your page and post it here too. Then you might get some help :)
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Moved to client side
lewindha
Forum Newbie
Posts: 6
Joined: Wed Apr 07, 2004 10:03 pm

Post by lewindha »

Ok. It's working now, but I didn't do anything to it. But here is the code anyhow:

Code: Select all

<html>

<head>
  <link href="general.css" type="text/css" rel="stylesheet" />
</head>
<body>
<table id="page_layout_table" class="layout">
	<tr id="header_row" class="layout_header">
		<td colspan="2">
			<font size="16" color="white">AIS</font>
		</td>

	</tr>
	<tr>
		<td width="15%">
					 	<div id="admin_menu" class="menu_div">
	 					<div id="admin_header" class="menu_header">
	 					<font size="3"><b>Admin Menu</b></font>
	 					</div>
						<div class="menu_item">

						<a href="new_user.php" class="menu_item">New User</a>
						</div>
						<div class="menu_item">
						<a href="edit_user.php" class="menu_item">Edit User Info</a>
						</div>
						<div class="menu_item">
						<a href="user_permissions.php" class="menu_item">User Permissions</a>

						</div>
	 					</div>
					
		</td>
		<td>
		</td>
	</tr>
</table>
</body>
Basically all of the Div tags were dynamically created by php.
Post Reply