www.webdeveloper.com
Results 1 to 6 of 6

Thread: [RESOLVED] problem with external css style sheet

  1. #1
    Join Date
    Feb 2009
    Posts
    11

    resolved [RESOLVED] problem with external css style sheet

    Hi

    I am having a little problem with my external style sheet. I am quite sure I have written it correctly, but I am having trouble with the paragraph styles in my external css style sheet. My code for my style sheet is shown below:

    Code:
    body {background-color:b0c4de;
          color:#000000;
          font-family: Arial, sans-serif, Helvetica
         }
    
    h1 {color:#000099;
        font-style:bold;
        font-family:Arial
        }
    
    p.1 {font-style:normal;}
    
    p.2 {font-style:oblique;}
    I have inserted the link into my html file linking it to the external style sheet, but need to know why the paragraphs are not displaying hwo they should. Currently, I have a user who answers 10 questions, then they are displayed on screen (from javascripting), but the problem is they are not showing. I have used the class="1", and class="2", but it is not displaying and all I get is a blank screen except for the background colour and <h1>. A little example of my code is shown below:
    Code:
    <html>
    <head>
    <title>Tester</title>
    <link rel="stylesheet" type="text/css" href="tstyle.css" />
    <script language="JavaScript"> 
    var questionOne = prompt("25+56=","");
    </script>
    </head>
    <body>
    <h1>Mathematics Quiz</h1>
    <script language="JavaScript">
    
    if(answer1 == 25+56)
    {
     document.write("<p class="1"><font color='green'>25+56 = "+questionOne+" You are totally correct!</font></p>");
    }
    else
    {
     document.write("<p class="2"><font color='red'>25+56 = " +questionOne +" ...Oh Dear!,  The correct Answer is " + (25+56) +"</font></p>");
    } 
    
    </script>
    </body>
    </html>
    Any ideas on why the paragraphs are not displaying when the user has finished the quiz and the answers are displayed?

    Thanks if you can help.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The cass names are invalid: http://www.w3.org/TR/html4/types.html#type-id

  3. #3
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Your problem was with your JavaScript and you should not be using the FONT element.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    		<title>Tester</title>
    		<link rel="stylesheet" type="text/css" href="tstyle.css">
    		<script language="JavaScript"> 
    			questionOne = prompt("25+56=","");
    		</script>
      </head>
      <body>
    		<h1>Mathematics Quiz</h1>
    		<script type="text/javascript">
    		
    			if (questionOne == 25+56) {
    				document.write ('<p class="one">25+56 = ', questionOne, ' You are totally correct!<\/p>');
    			} else {
    				document.write ('<p class="two">25+56 = ', questionOne, ' ...Oh Dear!,  The correct Answer is ', 25 + 56, '<\/p>');
    			} 
    		
    		</script>
      </body>
    </html>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  4. #4
    Join Date
    Feb 2009
    Posts
    11
    sorry. post deleted.
    Last edited by rushhour2; 03-08-2009 at 03:45 PM.

  5. #5
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Quote Originally Posted by rushhour2 View Post
    Thanks it works! Can I ask you charles to please delete your post or edit it so there is no code, it is quite important that you do so.

    Thanks in advance.
    Absolutely not. If you have committed academic dishonesty then you'll just have to take what you get. When I was in school one instance of any kind of cheating meant expulsion.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  6. #6
    Join Date
    Feb 2009
    Posts
    11
    May I say, it wasn't cheating, as I gave you my code to see where my mistakes lie, and to ask for help in how to correct the problem, so the answers actually do display, instead of not showing up at all. I do however, thank you for your help, as it has solved the problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles