The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
CSS not applied to include
Discuss CSS not applied to include in the CSS Help forum on Dev Shed. CSS not applied to include Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 10th, 2001, 03:44 AM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Kapiti, New Zealand
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
CSS not applied to include
I've got a problem with a css class that does not display correctly for one include file.
PHP Code:
<span class="smallcart">
<?php
if ($action != "edititem") {
$action="";
include ('displaysmallcart.php');
}
include ('randombook.php');
?>
</span>
The problem is that displaysmallcart.php does not have the formatting described in the smallcart class of the css but randombook.php does. displaysmallcart doesn't have any formatting in it other than table tags.
__________________
Gravity always wins
|

July 10th, 2001, 03:56 AM
|
|
Contributing User
|
|
Join Date: Jul 2001
Location: Oslo
Posts: 1,516

Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Your problem is certainly not a PHP problem, but rather related to your CSS or the contents of displaysmallcart.php.
Try being more specific for example by posting the CSS that isn't being applied, and the HTML to which it should be applied.
|

July 10th, 2001, 04:16 AM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Kapiti, New Zealand
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
CSS:
.smallcart{
background-color: transparent;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : xx-small;
text-decoration : none;
}
displaysmallcart.php:
<?php
mysql_connect ($dbhost, $dbuser, $dbpass) or die("Could not Connect");
mysql_select_db ("testss");
$query = "select * from carttable where sessid = '$s'";
$result = mysql_query ($query) or die ("Could not execute query");
print '<table>';
while ($query_data = mysql_fetch_array($result)) {
echo "<tr><td>",$query_data[product],"</td><td>",$query_data[fabric],"</td><td>",$query_data[size], "</td><td>";
?>
<form method="post" action="edititem.php?s=<?php echo $s?>&action=<?php echo $action?>">
<input type="hidden" name="itemno" value ="<?php echo $query_data[id]?>"</input>
<input type="image" border="0" name="submit" src="images/delete.gif"></input>
</form></td></tr>
<?php
}
print '</table>';
?>
HTML source generated:
<span class="smallcart">
<table><tr><td>tights</td><td>Camel</td><td>1 Year</td><td>
<form method="post" action="edititem.php?action=">
<input type="hidden" name="itemno" value ="8"</input>
<input type="image" border="0" name="submit" src="images/delete.gif"></input>
</form></td></tr>
</table>Test to see that randombook.php is included (text only file at this stage)</span>
The table generated by displaysmallcart.php is not formatted with the smallcart class, but with the default format. randombook.php is formatted correctly by smallcart class
|

July 10th, 2001, 04:35 AM
|
|
Contributing User
|
|
Join Date: Jul 2001
Location: Oslo
Posts: 1,516

Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Ah, I guess you're using IE to display the page. One thing to remember about CSS is that the current implementations are buggy, so when using CSS, always make sure to keep a good buglist under your pillow.
As for this particular error; IE doesn't apply inheritance correctly for tables, so tables won't inherit the style set for body or any other wrapping element. The simplest workaround is to create a style definition for the table aswell:
.smallcart table {
background-color: transparent;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : xx-small;
text-decoration : none;
}
|

July 10th, 2001, 04:51 AM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Kapiti, New Zealand
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
 Fantastic!!! Thanks very much. It works perfectly 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|