1

I'm learning CSS/HTML and am trying to import a simple css class into the html document, but something appears to have gone awry. Here is Logo.css:

.logo{
  color:rgb(255,232,57);
  background-color:rgb(0,0,75);
  font:ChopinScript;
  font-size:96pt;
}

and my html document:

<head>
  <link rel="stylesheet" href="Logo.css" type="text/css">
</head>

<div class="logo">
  <p class="logo">This text should look like my logo!</p>
</div>
<img src="404-tumblebeast.jpeg" align=center valign=center />

The image shows up fine in Safari, but the text is just generic text. Does the link tag not import as I thought? How would I do the equivalent of #import or #include, if isn't taking care of that?

6
  • 1
    Does the bg color change correctly? Or does it just not load your css at all? Commented Oct 15, 2011 at 16:47
  • nothing happens at all! Well the picture shows up and the text does, but nothing from my .css Commented Oct 15, 2011 at 16:54
  • Does your file exist? Is it served with the right mime-type (text/css)? Commented Oct 15, 2011 at 16:56
  • First chunk of code was Logo.css, second was 404.html (which is what I'm running in Safari Commented Oct 15, 2011 at 16:57
  • @RobW Explain the second part. If the code I put above is all that is in Logo.css, do I need to specify what type it is? the .logo class obviously refers to text Commented Oct 15, 2011 at 16:59

1 Answer 1

2

end the link tag (see below: the /> instead of >).

<link rel="stylesheet" href="Logo.css" type="text/css"/>

Verify that the Logo.css is in the same directory as the html file or use the correct path to the Logo.css file. Just in case you are doing this, you can't put the css under the WEB-INF directory.

You only need the class on the div element or on the p element, not both.

Edit: I was poking around and found some info about embedding fonts in a page: http://jonrohan.me/guide/css/font-face/

Sign up to request clarification or add additional context in comments.

9 Comments

Okay I deleted the class from the p element and added the end of the link tag but we are still rocking the default font/color/white background.
Yes they are sitting right next to each other in the same folder.
I'm a liar. One was created in another folder. So it now gets the colors and the size correct but not the font
Put the font inline (in the HTML page) to confirm that it works.
<p font=ChopinScript>This text should look like my logo!</p> did not change the font :(
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.