Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder d'Anconia's Avatar
    Join Date
    Jan 2010
    Location
    Tempe, AZ
    Posts
    149
    Thanks
    16
    Thanked 6 Times in 6 Posts

    Class Style: Font Not Turning Red

    So I have a page with some PHP on it and am trying to create a class "error" that, according to the linked CSS sheet, should turn the font red. Here is the code:

    1024px.css (from a template created by Andreas Viklund). Error class is the last line:
    Code:
    /*
    Original design: 1024px (v3.0 - Jun 01, 2010) - A free xhtml/css website template by Andreas Viklund.
    For more information, see http://andreasviklund.com/templates/1024px/
    */
    
    /* General tags */
    body {background:url(images/background.gif) repeat-y top center #fff; color:#404040; font:76% Verdana,Tahoma,Arial,sans-serif; line-height:1.3em; margin:0 auto; padding:0;}
    a {color:#4088b8; font-weight:700; text-decoration:none;}
    a:hover {text-decoration:underline;}
    a img {border:0;}
    p {margin:0 0 18px 10px;}
    ul,ol,dl {font-size:0.9em; margin:2px 0 16px 35px;}
    ul ul,ol ol {margin:4px 0 4px 35px;}
    blockquote {border:1px solid #dadada; font-size:0.9em; margin:20px 10px; padding:8px;}
    blockquote p {margin:0;}
    
    /* Headers */
    h1 {color:#4088b8; font-size:3.6em; letter-spacing:-3px; margin:0 0 20px 25px;}
    h1 a {color:#4088b8; text-transform:none;}
    h2 {border-bottom:4px solid #dadada; color:#4088b8; font-size:1.4em; letter-spacing:-1px; margin:0 0 10px; padding:0 2px 2px 5px;}
    h3 {border-bottom:1px solid #dadada; color:#4088b8; font-size:1.2em; font-weight:700; margin:10px 0 8px; padding:1px 2px 2px 3px;}
    
    /* Main wrap */
    #wrap {color:#404040; margin:10px auto; padding:0; width:970px;}
    #header {margin:0;}
    #toplinks {font-size:0.9em; padding:5px 2px 2px 3px; text-align:right;}
    #toplinks a {color:gray;}
    #slogan {color:gray; font-size:1.5em; font-weight:700; letter-spacing:-1px; line-height:1.2em; margin:15px 0 20px 35px;}
    
    /* Sidebar and menu */
    #sidebar {float:left; line-height:1.4em; margin:0 0 5px; padding:1px 0 0; width:195px;}
    #sidebar ul {font-size:0.9em; list-style:none; margin:0; padding:0 0 15px 10px;}
    #sidebar li {list-style:none; margin:0 0 4px; padding:0;}
    #sidebar li a {font-size:1.2em; font-weight:700; padding:2px;}
    #sidebar ul ul {line-height:1.2em; margin:4px 0 3px 15px; padding:0;}
    #sidebar ul ul li a {font-weight:400;}
    #sidebar h2 {margin:3px 0 8px;}
    
    /* Main content */
    #content {float:right; line-height:1.5em; margin:0; padding:0; text-align:left; width:750px;}
    #contentalt {float:left; line-height:1.5em; margin-right:20px; padding:0; text-align:left; width:750px;}
    #content h3,#contentalt h3 {margin:10px 0 8px;}
    
    /* Footer */
    #footer {border-top:4px solid #dadada; clear:both; color:gray; font-size:0.9em; line-height:1.6em; margin:0 auto; padding:8px 0; text-align:right;}
    #footer p {margin:0; padding:0;}
    #footer a {color:#808080;}
    
    /* Additional classes */
    .box {background:#4088b8; border:1px solid #c8c8c8; color:#fff; font-size:0.9em; line-height:1.4em; padding:10px 10px 10px 13px;}
    .box a {color:#f0f0f0;}
    .left {float:left; margin:0 15px 4px 0;}
    .right {float:right; margin:0 0 4px 15px;}
    .readmore {margin:-10px 10px 12px 0; text-align:right;}
    .timestamp {font-size:1.2em; margin:-5px 0 15px 10px;}
    .timestamp a {font-weight:normal;}
    .blue {color:#4088b8;}
    .clear {clear:both;}
    .fade {color:#c8c8c8;}
    .gray {color:gray;}
    .photo {background:#fff; border:1px solid #bababa; margin:6px 18px 2px 5px; padding:2px;}
    .error {font-weight: bold; color:red;}
    And here is the page that is echoing the errors (the errors are not the issue, just the lack of red color):
    Code:
    <?php # Script 11.1 - login_page.inc.php
    
    // This page prints any errors associated with logging in
    // and it creates the entire login page, including the form.
    
    // Include the header:
    $page_title = 'Login';
    include ('includes/header.html');
    ?>
    <div id="content">
    <?php
    // Print any error messages, if they exist:
    if (!empty($errors)) {
    	echo '<h2>Error!</h2>
    	<p class="error">The following error(s) occurred:<br />';
    	foreach ($errors as $msg) {
    		echo " - $msg<br />\n";
    	}
    	echo '</p><p>Please try again.</p>';
    }
    
    // Display the form:
    ?>
    
    
    <h2>Login</h2>
    <form action="login.php" method="post">
    	<p>Email Address: <input type="text" name="email" size="20" maxlength="80" /> </p>
    	<p>Password: <input type="password" name="pass" size="20" maxlength="20" /></p>
    	<p><input type="submit" name="submit" value="Login" /></p>
    	<input type="hidden" name="submitted" value="TRUE" />
    </form>
    </div>
    <?php // Include the footer:
    include ('includes/footer.html');
    ?>
    Last edited by d'Anconia; 03-12-2012 at 12:55 AM.
    Datagonia Web (My Portfolio)

    Powerful ideas for all lovers of personal and political freedom:
    Freedomain Radio
    Free Talk Live

  • #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    Are you including your stylesheet in the php file that echos out the errors?

  • #3
    Regular Coder d'Anconia's Avatar
    Join Date
    Jan 2010
    Location
    Tempe, AZ
    Posts
    149
    Thanks
    16
    Thanked 6 Times in 6 Posts
    Hmmm well for some reason it seems to be working now, and yes the style sheet was included in the header.html file. Thanks for the help though!

    PS For those who are newer to PHP make sure not to forget that an included file (such as header.html) will still access other files (such as styles.css) from the original file (such as login.php). This can get confusing if the included header is not in the same folder as the original file, and thus has to access the style sheet from the location of the original file.
    Datagonia Web (My Portfolio)

    Powerful ideas for all lovers of personal and political freedom:
    Freedomain Radio
    Free Talk Live


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •