...

View Full Version : CSS styles a page sometimes and sometimes doesn't



aWishResigned
01-10-2008, 10:02 PM
Hey guys. Haven't posted in this forum before. I usually try to stick to what I know and CSS isn't one of them, at least not well.

My problem is that I have some CSS in the head tag of a page that chooses randomly to style the page or not. I can reload and probably 50% of the time, the content will be styled. Firebug even shows that there is no CSS in the page and when I look, I can see the code in the page's source.

This is a very frustrating situation and I'm willing to do whatever I can to alleviate this. Hopefully, someone has run across this problem before but, if you don't know what's going on and need more information, let me know. I'll post source, addresses, whatever is needed.

Thanks in advance.

jcdevelopment
01-10-2008, 11:13 PM
Can you post an example of the code or maybe a link?

Excavator
01-11-2008, 12:28 AM
Conflicting CSS, open tags, wrong path, incomplete or invalild code/CSS... lots of things that can cause problems. We'll need to see the page though. Got a link to the test site?

aWishResigned
01-11-2008, 05:36 PM
Here is the produced source. It is the result of multiple OOP PHP Classes.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TLC Properties - Control Panel</title>
<link href="main.css" rel="stylesheet" type="text/css" />
<link href="menu.css" rel="stylesheet" type="text/css" />
<link href="calendar.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]>
<style type="text/css" media="screen">
body {behavior: url('../includes/csshover.htc'); font-size: 100%;}

#menu ul {width: 5em;}
#menu ul li {float: left; width: 100%;}
#menu ul li a {height: 1%;}

#menu a, #menu h2 {font: 10pt arial, helvetica, sans-serif;}
</style>
<![endif]-->
<style type="text/css">
ul#tfv8, ul#tfv8 li {margin: 0; padding: 0; list-style: none;}
ul#tfv8 li {margin: 0 10px 10px 0;}
ul#tfv8 h3 {font: normal 120%/1.3 Verdana,sans-serif; margin: 0px; height: 2em; line-height: 2em; padding: 5px 0 5px; font-weight: bold; text-align: center; color: #FFF;}
ul#tfv8 p {margin:0; padding: 5px 8px 5px; border: 1px solid #D9D1A3;}
ul#tfv8 div {background: #D9D1A3;}
ul#tfv8 li h3 {background: #003D76;}
ul#tfv8 li div {border: 2px solid #003D76;}
ul#shbk, ul#shbk li {margin: 0; padding: 0; list-style: none;}
ul#shbk li {margin: 0 10px 10px 0;}
ul#shbk h3 {font: normal 120%/1.3 Verdana,sans-serif; margin: 0px; height: 2em; line-height: 2em; padding: 5px 0 5px; font-weight: bold; text-align: center; color: #FFF;}
ul#shbk p {margin:0; padding: 5px 8px 5px; border: 1px solid #D9D1A3;}
ul#shbk div {background: #D9D1A3;}
ul#shbk li h3 {background: #003D76;}
ul#shbk li div {border: 2px solid #003D76;}
ul#xpcy, ul#xpcy li {margin: 0; padding: 0; list-style: none;}
ul#xpcy li {margin: 0 10px 10px 0;}
ul#xpcy h3 {font: normal 120%/1.3 Verdana,sans-serif; margin: 0px; height: 2em; line-height: 2em; padding: 5px 0 5px; font-weight: bold; text-align: center; color: #FFF;}
ul#xpcy p {margin:0; padding: 5px 8px 5px; border: 1px solid #D9D1A3;}
ul#xpcy div {background: #D9D1A3;}
ul#xpcy li h3 {background: #003D76;}
ul#xpcy li div {border: 2px solid #003D76;}
</style>
<script type="text/javascript" src="../includes/niftycube.js"></script>
<script type="text/javascript">
window.onload = function () {
Nifty("ul#tfv8 h3","top big");
Nifty("ul#tfv8 div","none same-height");
Nifty("ul#shbk h3","top big");
Nifty("ul#shbk div","none same-height");
Nifty("ul#xpcy h3","top big");
Nifty("ul#xpcy div","none same-height");
}
</script>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
<tr>
<td width="342"><img src="images/top.jpg" width="342" height="58" /></td>
<td></td>
</tr>
<tr>
<td><img src="images/mid.jpg" width="342" height="25" /></td>
<td class="menu" style="width: 100%;"><div id="menu"><ul><li><h2>Locations</h2><ul style="width: 9.5em;"><li><a href="">Add New</a></li><li><a href="">View/Edit Locations</a></li></ul></li></ul><ul><li><h2>Public Site</h2><ul style="width: 10em;"><li><a href="edit30day.php">30-Day Guarantee</a></li><li><a href="editAmenities.php">Amenities</a></li><li><a href="editApply.php">Apply Online</a></li><li><a href="editContact.php">Contact Us</a></li><li><a href="editSupport.php">Customer Support</a></li><li><a href="editJobs.php">Job Opportunities</a></li><li><a href="editPay.php">Pay Online</a></li></ul></li></ul><ul><li><h2>Users</h2><ul style="width: 11em;"><li><a href="">Create New User</a></li><li><a href="">Manage Users</a></li><li><a href="">Change Password</a></li></ul></li></ul><ul><li><h2>Community Management</h2><ul><li><a href="calendarMain.php">Calendar</a></li><li><a href="">Contacts</a></li><li><a href="">Files</a></li><li><a href="">Inbox</a></li><li><a href="">Lease Application(s)</a></li><li><a href="">Notices</a></li><li><a href="">Online Account Application(s)</a></li><li><a href="">Payments</a></li></ul></li></ul><ul><li><h2>Reports</h2><ul style="width: 8.5em;"><li><a href="">Lease Expirations</a></li><li><a href="reportPayment.php">Payment History</a></li><li><a href="">Rent Roll</a></li><li><a href="reportResident.php">Residents</a></li><li><a href="">Vacancies</a></li><li><a href="">Waiting List</a></li></ul></li></ul><ul><li><h2>Help</h2><ul style="width: 7.5em;"><li><a href="help.php">Email Setup</a></li><li><a href="../pdf/admin_help.pdf" target="_blank">CP Manual</a></li></ul></ul><ul><li><a href="logout.php">Logout</a></li></ul></div></td>

</tr>
<tr>
<td><img src="images/low.jpg" width="342" height="44" /></td>
<td></td>
</tr>
<tr>
<td colspan="2" style="padding: 20px;">
<table width="100%" cellpadding="5">
<tr>

<td width="67%" rowspan="2">
<ul id="tfv8">
<li style="width: 100%;">
<h3><a href="calendarMain.php?month=01&year=2007"><img src="images/year_back.jpg" border=0 /></a><img src="images/month_back.jpg" /><strong>January</strong><img src="images/month_forward.jpg" /><img src="images/year_forward.jpg" /></h3>
<div>
<div id="calendar" style="margin: 0px; padding: 0px;">

<!-- BEGIN CALENDAR -->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>

<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>

<th>Sunday</th>
<tr>
<td class="notInMonth">&nbsp;</td>
<td>1</td>
<td>2</td>
<td>3
<ul>
<li class="All"><a href="taskDetail.php?id=1">Community Mixer</a></li>

</ul>
</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>

<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>

<td>13</td>
</tr>
<tr>
<td>14</td>
<td>15
<ul>
<li class="All"><a href="taskDetail.php?id=2">Time to go Home</a></li>
</ul>

</td>
<td>16</td>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>

</tr>
<tr>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>
<td>25</td>

<td>26</td>
<td>27</td>
</tr>
<tr>
<td>28</td>
<td>29</td>
<td>30</td>

<td>31</td>
<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
</tr>
</table>
<!-- END CALENDAR -->
</div>
</div>
</li>

</ul>
</td>
<td width="30%" valign="top">
<ul id="xpcy">
<li style="width: 100%;">
<h3>Tasks for This Month</h3>
<div>
<table width="100%" class="task_head">
<tr>

<td width="75" style="padding-left: 5px;">Date</td>
<td>Task</td>
<td align="right" style="padding-right: 5px;"><a href="taskAdd.php">Add New</a></td>
</tr>
</table>
<p class="task" style="background: #cec79b;">01/03/2008&emsp;<a href="taskDetail.php?id=1">Community Mixer</a></p>
<p class="task" style="background: #cec79b;">01/15/2008&emsp;<a href="taskDetail.php?id=2">Time to go Home</a></p>

</div>
</li>
</ul>
</td>
</tr>
<tr>
<td valign="bottom">
<ul id="shbk">
<li style="width: 100%;">

<h3><strong>February</strong></h3>
<div>
<div id="mini" style="margin: 0px; padding: 0px;">

<!-- BEGIN CALENDAR -->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<th>Mon</th>
<th>Tue</th>

<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
<th>Sun</th>
<tr>

<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
<td>1</td>
<td>2</td>
<td>3</td>

</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>

<td>9</td>
<td>10</td>
</tr>
<tr>
<td>11</td>
<td>12</td>
<td>13</td>

<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
</tr>
<tr>
<td>18</td>

<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>

</tr>
<tr>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>

<td class="notInMonth">&nbsp;</td>
<td class="notInMonth">&nbsp;</td>
</tr>
</table>
<!-- END CALENDAR -->
</div>
</div>
</li>
</ul>
</td>
</tr>

</table>
</td>
</tr>
</table>
</body>
</html>

Excavator
01-11-2008, 06:30 PM
Conflicting CSS, open tags, wrong path, incomplete or invalild code/CSS... lots of things that can cause problems. We'll need to see the page though. Got a link to the test site?


Well, for starters... Failed validation, 52 Errors (http://validator.w3.org/check) See my suggestion and links about validating in my sig below.

And I don't understand, when you say your CSS isn't styling your page, how does giving us only your markup help anyone figure out why?

Apostropartheid
01-11-2008, 06:59 PM
Well, he says Firebug doesn't acknowledge any CSS actually existing...

Excavator
01-11-2008, 07:01 PM
Well, he says Firebug doesn't acknowledge any CSS actually existing...

Which is why I suggested a wrong path and asked for a link.

aWishResigned
01-11-2008, 07:23 PM
Well, for starters... Failed validation, 52 Errors (http://validator.w3.org/check) See my suggestion and links about validating in my sig below.

And I don't understand, when you say your CSS isn't styling your page, how does giving us only your markup help anyone figure out why?

As far as the validation goes, thank you for that. I will look into that being the trouble. Also, the reason why I posted only the markup is because I can't give anyone a link (this is a proprietary site and we have no guest access built in) and I really doubt anyone would enjoy me posting roughly a thousand lines of code.

Thanks for your time and help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum